mirror of https://github.com/rusefi/wideband.git
TS: report heater effective voltage (#225)
(cherry picked from commit c37180517d5522876a7efb7fcc17a3ca40ffee9f) Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
parent
0abaae13e7
commit
36d57e7d73
|
@ -73,6 +73,7 @@ struct heater_state {
|
|||
int timeCounter;
|
||||
int batteryStabTime;
|
||||
float rampVoltage;
|
||||
float heaterVoltage;
|
||||
HeaterState heaterState;
|
||||
#ifdef HEATER_MAX_DUTY
|
||||
int cycle;
|
||||
|
@ -291,16 +292,14 @@ static void HeaterThread(void*)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (batteryVoltage < 23)
|
||||
if (batteryVoltage >= 23)
|
||||
{
|
||||
// Pipe the output to the heater driver
|
||||
heaterPwm.SetDuty(s.pwm_ch, duty);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Overvoltage protection - sensor not rated for PWM above 24v
|
||||
heaterPwm.SetDuty(s.pwm_ch, 0);
|
||||
duty = 0;
|
||||
heaterVoltage = 0;
|
||||
}
|
||||
// Pipe the output to the heater driver
|
||||
heaterPwm.SetDuty(s.pwm_ch, duty);
|
||||
s.heaterVoltage = heaterVoltage;
|
||||
}
|
||||
|
||||
// Loop at ~20hz
|
||||
|
@ -329,6 +328,11 @@ float GetHeaterDuty(int ch)
|
|||
return heaterPwm.GetLastDuty(state[ch].pwm_ch);
|
||||
}
|
||||
|
||||
float GetHeaterEffVoltage(int ch)
|
||||
{
|
||||
return state[ch].heaterVoltage;
|
||||
}
|
||||
|
||||
HeaterState GetHeaterState(int ch)
|
||||
{
|
||||
return state[ch].heaterState;
|
||||
|
|
|
@ -14,5 +14,6 @@ enum class HeaterState
|
|||
void StartHeaterControl();
|
||||
bool IsRunningClosedLoop(int ch);
|
||||
float GetHeaterDuty(int ch);
|
||||
float GetHeaterEffVoltage(int ch);
|
||||
HeaterState GetHeaterState(int ch);
|
||||
const char* describeHeaterState(HeaterState state);
|
||||
|
|
|
@ -93,7 +93,8 @@ AFR0_temp = scalar, F32, 36, "C", 1, 0
|
|||
AFR0_Nernst = scalar, F32, 40, "V", 1, 0
|
||||
AFR0_PumpITarget = scalar, F32, 44, "mA", 1, 0
|
||||
AFR0_PumpIMeasure = scalar, F32, 48, "mA", 1, 0
|
||||
AFR0_HeaterDuty = scalar, F32, 52, "%", 100, 0
|
||||
AFR0_HeaterDuty = scalar, U16, 52, "%", 0.1, 0
|
||||
AFR0_HeaterEffV = scalar, U16, 54, "V", 0.01, 0
|
||||
AFR0_esr = scalar, F32, 56, "ohms", 1, 0
|
||||
AFR0_fault = scalar, U08, 60, "", 1, 0
|
||||
AFR0_heater = scalar, U08, 61, "", 1, 0
|
||||
|
@ -122,6 +123,7 @@ AFR0_AfrGauge = AFR0_afr, "0: AFR", "",
|
|||
AFR0_TempGauge = AFR0_temp, "0: AFR t", "C", 500, 1050, 500, 650, 800, 950, 0, 0
|
||||
AFR0_NernstGauge = AFR0_Nernst, "0: nernst", "V", 0.0, 1.0, 0.0, 0.0, 0.9, 0.95, 3, 3
|
||||
AFR0_HeaterDutyGauge = AFR0_HeaterDuty, "0: Heater Duty", "%", 0.0, 100.0, 1.0, 3.0, 90, 95, 1, 1
|
||||
AFR0_HeaterEffVGauge = AFR0_HeaterEffV, "0: Heater Voltage", "V", 0.0, 18.0, 1.5, 6.0, 9, 16, 1, 1
|
||||
AFR0_PumpITargetGauge = AFR0_PumpITarget, "0: Ipump Target", "mA", -5.0, 5.0, -4.0, -3.0, 3.0, 4.0, 2, 2
|
||||
AFR0_PumpIMeasureGauge = AFR0_PumpIMeasure, "0: Ipump Actual", "mA", -5.0, 5.0, -4.0, -3.0, 3.0, 4.0, 2, 2
|
||||
AFR0_EsrGauge = AFR0_esr, "0: ESR", "ohms", 0, 600, 200, 200, 350, 400, 0, 0
|
||||
|
@ -161,6 +163,7 @@ entry = AFR0_Nernst, "0: Nernst", float, "%.3f"
|
|||
entry = AFR0_PumpITarget, "0: Ipump target", float, "%.2f"
|
||||
entry = AFR0_PumpIMeasure, "0: Ipump actual", float, "%.2f"
|
||||
entry = AFR0_HeaterDuty, "0: Heater duty", float, "%.1f"
|
||||
entry = AFR0_HeaterEffV, "0: Heater voltage", float, "%.1f"
|
||||
entry = AFR0_fault, "0: Fault code", int, "%d"
|
||||
entry = AFR0_heater, "0: Heater status code", int, "%d"
|
||||
entry = AFR0_esr, "0: ESR", float, "%.1f"
|
||||
|
|
|
@ -100,7 +100,8 @@ AFR0_temp = scalar, F32, 36, "C", 1, 0
|
|||
AFR0_Nernst = scalar, F32, 40, "V", 1, 0
|
||||
AFR0_PumpITarget = scalar, F32, 44, "mA", 1, 0
|
||||
AFR0_PumpIMeasure = scalar, F32, 48, "mA", 1, 0
|
||||
AFR0_HeaterDuty = scalar, F32, 52, "%", 100, 0
|
||||
AFR0_HeaterDuty = scalar, U16, 52, "%", 0.1, 0
|
||||
AFR0_HeaterEffV = scalar, U16, 54, "V", 0.01, 0
|
||||
AFR0_esr = scalar, F32, 56, "ohms", 1, 0
|
||||
AFR0_fault = scalar, U08, 60, "", 1, 0
|
||||
AFR0_heater = scalar, U08, 61, "", 1, 0
|
||||
|
@ -112,7 +113,8 @@ AFR1_temp = scalar, F32, 68, "C", 1, 0
|
|||
AFR1_Nernst = scalar, F32, 72, "V", 1, 0
|
||||
AFR1_PumpITarget = scalar, F32, 76, "mA", 1, 0
|
||||
AFR1_PumpIMeasure = scalar, F32, 80, "mA", 1, 0
|
||||
AFR1_HeaterDuty = scalar, F32, 84, "%", 100, 0
|
||||
AFR1_HeaterDuty = scalar, U16, 84, "%", 0.1, 0
|
||||
AFR1_HeaterEffV = scalar, U16, 86, "V", 0.01, 0
|
||||
AFR1_esr = scalar, F32, 88, "ohms", 1, 0
|
||||
AFR1_fault = scalar, U08, 92, "", 1, 0
|
||||
AFR1_heater = scalar, U08, 93, "", 1, 0
|
||||
|
@ -175,6 +177,7 @@ AFR0_AfrGauge = AFR0_afr, "0: AFR", "",
|
|||
AFR0_TempGauge = AFR0_temp, "0: AFR t", "C", 500, 1050, 500, 650, 800, 950, 0, 0
|
||||
AFR0_NernstGauge = AFR0_Nernst, "0: nernst", "V", 0.0, 1.0, 0.0, 0.0, 0.9, 0.95, 3, 3
|
||||
AFR0_HeaterDutyGauge = AFR0_HeaterDuty, "0: Heater Duty", "%", 0.0, 100.0, 1.0, 3.0, 90, 95, 1, 1
|
||||
AFR0_HeaterEffVGauge = AFR0_HeaterEffV, "0: Heater Voltage", "V", 0.0, 18.0, 1.5, 6.0, 9, 16, 1, 1
|
||||
AFR0_PumpITargetGauge = AFR0_PumpITarget, "0: Ipump Target", "mA", -5.0, 5.0, -4.0, -3.0, 3.0, 4.0, 2, 2
|
||||
AFR0_PumpIMeasureGauge = AFR0_PumpIMeasure, "0: Ipump Actual", "mA", -5.0, 5.0, -4.0, -3.0, 3.0, 4.0, 2, 2
|
||||
AFR0_EsrGauge = AFR0_esr, "0: ESR", "ohms", 0, 600, 200, 200, 350, 400, 0, 0
|
||||
|
@ -187,6 +190,7 @@ AFR1_AfrGauge = AFR1_afr, "1: AFR", "",
|
|||
AFR1_TempGauge = AFR1_temp, "1: AFR t", "C", 500, 1050, 500, 650, 800, 950, 0, 0
|
||||
AFR1_NernstGauge = AFR1_Nernst, "1: nernst", "V", 0.0, 1.0, 0.0, 0.0, 0.9, 0.95, 3, 3
|
||||
AFR1_HeaterDutyGauge = AFR1_HeaterDuty, "1: Heater Duty", "%", 0.0, 100.0, 1.0, 3.0, 90, 95, 1, 1
|
||||
AFR1_HeaterEffVGauge = AFR1_HeaterEffV, "1: Heater Voltage", "V", 0.0, 18.0, 1.5, 6.0, 9, 16, 1, 1
|
||||
AFR1_PumpITargetGauge = AFR1_PumpITarget, "1: Ipump Target", "mA", -5.0, 5.0, -4.0, -3.0, 3.0, 4.0, 2, 2
|
||||
AFR1_PumpIMeasureGauge = AFR1_PumpIMeasure, "1: Ipump Actual", "mA", -5.0, 5.0, -4.0, -3.0, 3.0, 4.0, 2, 2
|
||||
AFR1_EsrGauge = AFR1_esr, "1: ESR", "ohms", 0, 600, 200, 200, 350, 400, 0, 0
|
||||
|
@ -248,6 +252,7 @@ entry = AFR0_Nernst, "0: Nernst", float, "%.3f"
|
|||
entry = AFR0_PumpITarget, "0: Ipump target", float, "%.2f"
|
||||
entry = AFR0_PumpIMeasure, "0: Ipump actual", float, "%.2f"
|
||||
entry = AFR0_HeaterDuty, "0: Heater duty", float, "%.1f"
|
||||
entry = AFR0_HeaterEffV, "0: Heater voltage", float, "%.1f"
|
||||
entry = AFR0_fault, "0: Fault code", int, "%d"
|
||||
entry = AFR0_heater, "0: Heater status code", int, "%d"
|
||||
entry = AFR0_esr, "0: ESR", float, "%.1f"
|
||||
|
@ -260,6 +265,7 @@ entry = AFR1_Nernst, "1: Nernst", float, "%.3f"
|
|||
entry = AFR1_PumpITarget, "1: Ipump target", float, "%.2f"
|
||||
entry = AFR1_PumpIMeasure, "1: Ipump actual", float, "%.2f"
|
||||
entry = AFR1_HeaterDuty, "1: Heater duty", float, "%.1f"
|
||||
entry = AFR1_HeaterEffV, "1: Heater voltage", float, "%.1f"
|
||||
entry = AFR1_fault, "1: Fault code", int, "%d"
|
||||
entry = AFR1_heater, "1: Heater status code", int, "%d"
|
||||
entry = AFR1_esr, "1: ESR", float, "%.1f"
|
||||
|
|
|
@ -25,7 +25,8 @@ void SamplingUpdateLiveData()
|
|||
data->nernstVoltage = GetNernstDc(ch);
|
||||
data->pumpCurrentTarget = GetPumpCurrent(ch);
|
||||
data->pumpCurrentMeasured = GetPumpNominalCurrent(ch);
|
||||
data->heaterDuty = GetHeaterDuty(ch);
|
||||
data->heaterDuty = GetHeaterDuty(ch) * 1000; // 0.1 %
|
||||
data->heaterEffectiveVoltage = GetHeaterEffVoltage(ch) * 100;
|
||||
data->esr = GetSensorInternalResistance(ch);
|
||||
data->fault = (uint8_t)GetCurrentFault(ch);
|
||||
data->heaterState = (uint8_t)GetHeaterState(ch);
|
||||
|
|
|
@ -26,7 +26,8 @@ struct livedata_afr_s {
|
|||
float nernstVoltage;
|
||||
float pumpCurrentTarget;
|
||||
float pumpCurrentMeasured;
|
||||
float heaterDuty;
|
||||
uint16_t heaterDuty;
|
||||
uint16_t heaterEffectiveVoltage;
|
||||
float esr;
|
||||
uint8_t fault; // See wbo::Fault
|
||||
uint8_t heaterState;
|
||||
|
|
Loading…
Reference in New Issue