diff --git a/firmware/boards/f1_dual/port.cpp b/firmware/boards/f1_dual/port.cpp index 549c55a..217dade 100644 --- a/firmware/boards/f1_dual/port.cpp +++ b/firmware/boards/f1_dual/port.cpp @@ -79,8 +79,8 @@ static float GetMaxSample(adcsample_t* buffer, size_t idx) return (float)max * scale; } -static float l_vbatt = 0; -static float r_vbatt = 0; +static float l_heater_voltage = 0; +static float r_heater_voltage = 0; AnalogResult AnalogSample() { @@ -94,14 +94,14 @@ AnalogResult AnalogSample() if (l_heater && l_heater_new) { - float vbatt_raw = GetMaxSample(adcBuffer, 6) / BATTERY_INPUT_DIVIDER; - l_vbatt = BATTERY_FILTER_ALPHA * vbatt_raw + (1.0 - BATTERY_FILTER_ALPHA) * l_vbatt; + float vbatt_raw = GetMaxSample(adcBuffer, 6) / HEATER_INPUT_DIVIDER; + l_heater_voltage = HEATER_FILTER_ALPHA * vbatt_raw + (1.0 - HEATER_FILTER_ALPHA) * l_heater_voltage; } if (r_heater && r_heater_new) { - float vbatt_raw = GetMaxSample(adcBuffer, 7) / BATTERY_INPUT_DIVIDER; - r_vbatt = BATTERY_FILTER_ALPHA * vbatt_raw + (1.0 - BATTERY_FILTER_ALPHA) * r_vbatt; + float vbatt_raw = GetMaxSample(adcBuffer, 7) / HEATER_INPUT_DIVIDER; + r_heater_voltage = HEATER_FILTER_ALPHA * vbatt_raw + (1.0 - HEATER_FILTER_ALPHA) * r_heater_voltage; } return @@ -111,13 +111,13 @@ AnalogResult AnalogSample() /* left */ .NernstVoltage = AverageSamples(adcBuffer, 3) * NERNST_INPUT_GAIN, .PumpCurrentVoltage = AverageSamples(adcBuffer, 2), - .BatteryVoltage = l_vbatt, + .BatteryVoltage = l_heater_voltage, }, { /* right */ .NernstVoltage = AverageSamples(adcBuffer, 1) * NERNST_INPUT_GAIN, .PumpCurrentVoltage = AverageSamples(adcBuffer, 0), - .BatteryVoltage = r_vbatt, + .BatteryVoltage = r_heater_voltage, }, }, /* Dual board has separate internal virtual ground = 3.3V / 2 diff --git a/firmware/boards/f1_dual/wideband_board_config.h b/firmware/boards/f1_dual/wideband_board_config.h index ec3f3dc..514f368 100644 --- a/firmware/boards/f1_dual/wideband_board_config.h +++ b/firmware/boards/f1_dual/wideband_board_config.h @@ -23,13 +23,13 @@ // ******************************* // 100K + 10K divider #define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0)) -#define BATTERY_FILTER_ALPHA (0.1f) // ******************************* // Heater low side Sensing // ******************************* // 100K + 10K divider #define HEATER_INPUT_DIVIDER (10.0 / (10.0 + 100.0)) +#define HEATER_FILTER_ALPHA (0.1f) // ******************************* // Vm output Sensing diff --git a/firmware/boards/f1_dual_rev1/port.cpp b/firmware/boards/f1_dual_rev1/port.cpp index aba8a5c..91d884d 100644 --- a/firmware/boards/f1_dual_rev1/port.cpp +++ b/firmware/boards/f1_dual_rev1/port.cpp @@ -89,8 +89,8 @@ static float GetMaxSample(adcsample_t* buffer, size_t idx) return (float)max * scale; } -static float l_vbatt = 0; -static float r_vbatt = 0; +static float l_heater_voltage = 0; +static float r_heater_voltage = 0; AnalogResult AnalogSample() { @@ -108,14 +108,14 @@ AnalogResult AnalogSample() if (l_heater && l_heater_new) { - float vbatt_raw = GetMaxSample(adcBuffer, 6) / BATTERY_INPUT_DIVIDER; - l_vbatt = BATTERY_FILTER_ALPHA * vbatt_raw + (1.0 - BATTERY_FILTER_ALPHA) * l_vbatt; + float vbatt_raw = GetMaxSample(adcBuffer, 6) / HEATER_INPUT_DIVIDER; + l_heater_voltage = HEATER_FILTER_ALPHA * vbatt_raw + (1.0 - HEATER_FILTER_ALPHA) * l_heater_voltage; } if (r_heater && r_heater_new) { - float vbatt_raw = GetMaxSample(adcBuffer, 7) / BATTERY_INPUT_DIVIDER; - r_vbatt = BATTERY_FILTER_ALPHA * vbatt_raw + (1.0 - BATTERY_FILTER_ALPHA) * r_vbatt; + float vbatt_raw = GetMaxSample(adcBuffer, 7) / HEATER_INPUT_DIVIDER; + r_heater_voltage = HEATER_FILTER_ALPHA * vbatt_raw + (1.0 - HEATER_FILTER_ALPHA) * r_heater_voltage; } /* Dual board has separate internal virtual ground = 3.3V / 2 @@ -135,10 +135,10 @@ AnalogResult AnalogSample() } /* left */ res.ch[0].PumpCurrentVoltage = AverageSamples(adcBuffer, 2); - res.ch[0].BatteryVoltage = l_vbatt; + res.ch[0].BatteryVoltage = l_heater_voltage; /* right */ res.ch[1].PumpCurrentVoltage = AverageSamples(adcBuffer, 0); - res.ch[1].BatteryVoltage = r_vbatt; + res.ch[1].BatteryVoltage = r_heater_voltage; return res; } diff --git a/firmware/boards/f1_dual_rev1/wideband_board_config.h b/firmware/boards/f1_dual_rev1/wideband_board_config.h index c3325d1..2e990f4 100644 --- a/firmware/boards/f1_dual_rev1/wideband_board_config.h +++ b/firmware/boards/f1_dual_rev1/wideband_board_config.h @@ -24,13 +24,13 @@ // ******************************* // 100K + 10K divider #define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0)) -#define BATTERY_FILTER_ALPHA (0.1f) // ******************************* // Heater low side Sensing // ******************************* // 100K + 10K divider #define HEATER_INPUT_DIVIDER (10.0 / (10.0 + 100.0)) +#define HEATER_FILTER_ALPHA (0.1f) // ******************************* // Vm output Sensing