mirror of https://github.com/rusefi/wideband.git
heater: do index to channels mapping in all cases (#189)
Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
parent
6d908fb110
commit
4148ba1567
|
@ -230,7 +230,7 @@ static float GetVoltageForState(struct heater_state &s, float heaterEsr)
|
||||||
static THD_WORKING_AREA(waHeaterThread, 256);
|
static THD_WORKING_AREA(waHeaterThread, 256);
|
||||||
static void HeaterThread(void*)
|
static void HeaterThread(void*)
|
||||||
{
|
{
|
||||||
int ch;
|
int i;
|
||||||
|
|
||||||
chRegSetThreadName("Heater");
|
chRegSetThreadName("Heater");
|
||||||
|
|
||||||
|
@ -245,16 +245,16 @@ static void HeaterThread(void*)
|
||||||
{
|
{
|
||||||
auto heaterAllowState = GetHeaterAllowed();
|
auto heaterAllowState = GetHeaterAllowed();
|
||||||
|
|
||||||
for (ch = 0; ch < AFR_CHANNELS; ch++) {
|
for (i = 0; i < AFR_CHANNELS; i++) {
|
||||||
heater_state &s = state[ch];
|
heater_state &s = state[i];
|
||||||
|
|
||||||
// Read sensor state
|
// Read sensor state
|
||||||
float heaterEsr = GetSensorInternalResistance(ch);
|
float heaterEsr = GetSensorInternalResistance(s.ch);
|
||||||
|
|
||||||
// If we haven't heard from rusEFI, use the internally sensed
|
// If we haven't heard from rusEFI, use the internally sensed
|
||||||
// battery voltage instead of voltage over CAN.
|
// battery voltage instead of voltage over CAN.
|
||||||
float batteryVoltage = heaterAllowState == HeaterAllow::Unknown
|
float batteryVoltage = heaterAllowState == HeaterAllow::Unknown
|
||||||
? GetInternalBatteryVoltage(ch)
|
? GetInternalBatteryVoltage(s.ch)
|
||||||
: GetRemoteBatteryVoltage();
|
: GetRemoteBatteryVoltage();
|
||||||
|
|
||||||
// Run the state machine
|
// Run the state machine
|
||||||
|
|
Loading…
Reference in New Issue