heater: shortcut if sensor is hot enough (#277)

* heater: shortcut if sensor is hot enough

* heater: shortcut if sensor is hot enougth

---------

Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
rusefillc 2023-11-19 16:10:42 -05:00 committed by GitHub
parent 4bdd8f5c44
commit fa042fb6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,10 @@
#define ADC_MAX_COUNT (4095) #define ADC_MAX_COUNT (4095)
#define ADC_OVERSAMPLE 16 #define ADC_OVERSAMPLE 16
// Algo settings
// TODO: move to settings
#define HEATER_FAST_HEATING_THRESHOLD_T 550
// ******************************* // *******************************
// Nernst voltage & ESR sense // Nernst voltage & ESR sense
// ******************************* // *******************************

View File

@ -71,6 +71,18 @@ HeaterState HeaterControllerBase::GetNextState(HeaterState currentState, HeaterA
switch (currentState) switch (currentState)
{ {
case HeaterState::Preheat: case HeaterState::Preheat:
#ifdef HEATER_FAST_HEATING_THRESHOLD_T
if (sensorTemp >= HEATER_FAST_HEATING_THRESHOLD_T) {
// if sensor is already hot - we can start from higher heater voltage
rampVoltage = 7.5;
// Reset the timer for the warmup phase
m_warmupTimer.reset();
return HeaterState::WarmupRamp;
}
#endif
// If preheat timeout, or sensor is already hot (engine running?) // If preheat timeout, or sensor is already hot (engine running?)
if (m_preheatTimer.hasElapsedSec(m_preheatTimeSec) || sensorTemp > closedLoopTemp) if (m_preheatTimer.hasElapsedSec(m_preheatTimeSec) || sensorTemp > closedLoopTemp)
{ {