diff --git a/firmware/boards/f0_module/wideband_board_config.h b/firmware/boards/f0_module/wideband_board_config.h index 529dcf9..b71fc98 100644 --- a/firmware/boards/f0_module/wideband_board_config.h +++ b/firmware/boards/f0_module/wideband_board_config.h @@ -17,3 +17,9 @@ // Nernst voltage & ESR sense // ******************************* #define VM_RESISTOR_VALUE (10) + +// ******************************* +// Hack: allow pump driving above target temperature +// minus this offset to avoid Vnerns voltage clamp near 0V +// ******************************* +#define START_PUMP_TEMP_OFFSET (200.0) diff --git a/firmware/heater_control.cpp b/firmware/heater_control.cpp index 03329ec..44ba203 100644 --- a/firmware/heater_control.cpp +++ b/firmware/heater_control.cpp @@ -27,6 +27,11 @@ bool HeaterControllerBase::IsRunningClosedLoop() const return heaterState == HeaterState::ClosedLoop; } +float HeaterControllerBase::GetTargetTemp() const +{ + return m_targetTempC; +} + float HeaterControllerBase::GetHeaterEffectiveVoltage() const { return heaterVoltage; diff --git a/firmware/heater_control.h b/firmware/heater_control.h index df0b2a2..02149a2 100644 --- a/firmware/heater_control.h +++ b/firmware/heater_control.h @@ -25,6 +25,7 @@ struct IHeaterController virtual bool IsRunningClosedLoop() const = 0; virtual float GetHeaterEffectiveVoltage() const = 0; virtual HeaterState GetHeaterState() const = 0; + virtual float GetTargetTemp() const = 0; }; class HeaterControllerBase : public IHeaterController @@ -37,6 +38,7 @@ public: bool IsRunningClosedLoop() const override; float GetHeaterEffectiveVoltage() const override; HeaterState GetHeaterState() const override; + float GetTargetTemp() const override; virtual void SetDuty(float duty) const = 0; diff --git a/firmware/pump_control.cpp b/firmware/pump_control.cpp index 601d7d9..9bf6eb9 100644 --- a/firmware/pump_control.cpp +++ b/firmware/pump_control.cpp @@ -38,7 +38,11 @@ static void PumpThread(void*) const auto& heater = GetHeaterController(ch); // Only actuate pump when running closed loop! - if (heater.IsRunningClosedLoop()) + if (heater.IsRunningClosedLoop() || +#ifdef START_PUMP_TEMP_OFFSET + (sampler.GetSensorTemperature() >= heater.GetTargetTemp() - START_PUMP_TEMP_OFFSET) || +#endif + (0)) { float nernstVoltage = sampler.GetNernstDc(); diff --git a/firmware/pump_dac.cpp b/firmware/pump_dac.cpp index ed543a6..9d6576f 100644 --- a/firmware/pump_dac.cpp +++ b/firmware/pump_dac.cpp @@ -90,11 +90,13 @@ void InitPumpDac() void SetPumpCurrentTarget(int ch, int32_t microampere) { +#ifndef START_PUMP_TEMP_OFFSET // Don't allow pump current when the sensor isn't hot if (!GetHeaterController(ch).IsRunningClosedLoop()) { microampere = 0; } +#endif state[ch].curIpump = microampere;