Skip to content

Commit

Permalink
Make START_PUMP_TEMP_THRESHOLD relative
Browse files Browse the repository at this point in the history
  • Loading branch information
dron0gus committed Jun 1, 2024
1 parent 5c672e4 commit 4adc794
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions firmware/boards/f0_module/wideband_board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define VM_RESISTOR_VALUE (10)

// *******************************
// Hack: allow pump driving above this temperature
// to avoid Vnerns voltage clamp near 0V
// Hack: allow pump driving above target temperature
// minus this offset to avoid Vnerns voltage clamp near 0V
// *******************************
#define START_PUMP_TEMP_THRESHOLD (650.0)
#define START_PUMP_TEMP_OFFSET (200.0)
5 changes: 5 additions & 0 deletions firmware/heater_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ bool HeaterControllerBase::IsRunningClosedLoop() const
return heaterState == HeaterState::ClosedLoop;
}

float HeaterControllerBase::GetTargetTemp() const
{
return m_targetTempC;
}

float HeaterControllerBase::GetHeaterEffectiveVoltage() const
{
return heaterVoltage;
Expand Down
2 changes: 2 additions & 0 deletions firmware/heater_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,6 +38,7 @@ class HeaterControllerBase : public IHeaterController
bool IsRunningClosedLoop() const override;
float GetHeaterEffectiveVoltage() const override;
HeaterState GetHeaterState() const override;
float GetTargetTemp() const override;

virtual void SetDuty(float duty) const = 0;

Expand Down
4 changes: 2 additions & 2 deletions firmware/pump_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ static void PumpThread(void*)

// Only actuate pump when running closed loop!
if (heater.IsRunningClosedLoop() ||
#ifdef START_PUMP_TEMP_THRESHOLD
(sampler.GetSensorTemperature() >= START_PUMP_TEMP_THRESHOLD) ||
#ifdef START_PUMP_TEMP_OFFSET
(sampler.GetSensorTemperature() >= heater.GetTargetTemp() - START_PUMP_TEMP_OFFSET) ||
#endif
(0))
{
Expand Down
2 changes: 1 addition & 1 deletion firmware/pump_dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void InitPumpDac()

void SetPumpCurrentTarget(int ch, int32_t microampere)
{
#ifndef START_PUMP_TEMP_THRESHOLD
#ifndef START_PUMP_TEMP_OFFSET
// Don't allow pump current when the sensor isn't hot
if (!GetHeaterController(ch).IsRunningClosedLoop())
{
Expand Down

0 comments on commit 4adc794

Please sign in to comment.