mirror of https://github.com/rusefi/wideband.git
Underheat issue (#314)
* f0_module needs hack to start pump before closed loop * Fix paranoid check * Make START_PUMP_TEMP_THRESHOLD relative
This commit is contained in:
parent
63b77f723e
commit
e70df58290
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue