Skip to content

Commit

Permalink
ETB overheats due to constant isTpsError true/false/true/false jitter #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Nov 28, 2022
1 parent 7404256 commit 9e3b7fa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions firmware/controllers/actuators/electronic_throttle.cpp
Expand Up @@ -501,6 +501,7 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
}

if (m_isAutotune) {
etbInputErrorCounter = 0;
return getClosedLoopAutotune(target, observation);
} else {
// Check that we're not over the error limit
Expand All @@ -517,7 +518,12 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
etbDutyRateOfChange = m_dutyIntegrator.accumulate(prevOutput - output);
prevOutput = output;

static bool wasInputError = false; // 'static' meaning it's a global variable just with limited visibility

This comment has been minimized.

Copy link
@mck1117

mck1117 Nov 28, 2022

Member

why is this a global, and not a member of the etb controller

This comment has been minimized.

Copy link
@rusefillc

rusefillc Nov 28, 2022

Contributor

Fair question 5ed7a7b

bool isInputError = !Sensor::get(SensorType::Tps1).Valid || isTps2Error() || isPedalError();
if (Sensor::getOrZero(SensorType::Rpm) == 0 && wasInputError != isInputError) {
wasInputError = isInputError;
etbInputErrorCounter++;
}
return output;
}
}
Expand Down

0 comments on commit 9e3b7fa

Please sign in to comment.