mirror of
https://github.com/mck1117/wideband.git
synced 2026-09-30 09:57:06 -04:00
better voltage sense guards
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
float nernstDc = 0;
|
||||
float pumpCurrentSenseVoltage = 0;
|
||||
|
||||
#ifdef BATTERY_INPUT_DIVIDER
|
||||
#ifdef BOARD_HAS_VOLTAGE_SENSE
|
||||
float internalHeaterVoltage = 0;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user