better voltage sense guards

This commit is contained in:
Matthew Kennedy
2025-07-26 19:12:13 -07:00
parent 77916b4f14
commit b4cfb51413
6 changed files with 7 additions and 3 deletions

View File

@@ -23,6 +23,7 @@
// *******************************
// 100K + 10K divider
#define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0))
#define BOARD_HAS_VOLTAGE_SENSE
// *******************************
// Heater low side Sensing

View File

@@ -28,6 +28,7 @@
// *******************************
// 100K + 10K divider
#define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0))
#define BOARD_HAS_VOLTAGE_SENSE
// *******************************
// Heater low side Sensing

View File

@@ -19,6 +19,7 @@
// *******************************
// 100K + 10K divider
#define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0))
#define BOARD_HAS_VOLTAGE_SENSE
// *******************************
// Heater low side Sensing

View File

@@ -19,6 +19,7 @@
// *******************************
// 100K + 10K divider
#define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0))
#define BOARD_HAS_VOLTAGE_SENSE
// *******************************
// Heater low side Sensing

View File

@@ -40,7 +40,7 @@ float Sampler::GetPumpNominalCurrent() const
float Sampler::GetInternalHeaterVoltage() const
{
#ifdef BATTERY_INPUT_DIVIDER
#ifdef BOARD_HAS_VOLTAGE_SENSE
// Dual HW can measure heater voltage for each channel
// by measuring voltage on Heater- while FET is off
return internalHeaterVoltage;
@@ -114,7 +114,7 @@ void Sampler::ApplySample(AnalogChannelResult& result, float virtualGroundVoltag
(1 - PUMP_FILTER_ALPHA) * pumpCurrentSenseVoltage +
PUMP_FILTER_ALPHA * (result.PumpCurrentVoltage - virtualGroundVoltageInt);
#ifdef BATTERY_INPUT_DIVIDER
#ifdef BOARD_HAS_VOLTAGE_SENSE
internalHeaterVoltage = result.HeaterSupplyVoltage;
#endif

View File

@@ -37,7 +37,7 @@ private:
float nernstDc = 0;
float pumpCurrentSenseVoltage = 0;
#ifdef BATTERY_INPUT_DIVIDER
#ifdef BOARD_HAS_VOLTAGE_SENSE
float internalHeaterVoltage = 0;
#endif