Skip to content

Commit

Permalink
batteryCheck: fix enabling circuit breaker still causing battery fail…
Browse files Browse the repository at this point in the history
…safes

Failing checks caused failsafe flags to stay true when enabling the circuit breaker but not rebooting.
Resetting the failsafe flags state when the circuit breaker is set resolves this issue.
  • Loading branch information
MaEtUgR committed Nov 19, 2024
1 parent b492947 commit 86f5c0e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ static constexpr const char *battery_fault_reason_str(battery_fault_reason_t bat
void BatteryChecks::checkAndReport(const Context &context, Report &reporter)
{
if (circuit_breaker_enabled_by_val(_param_cbrk_supply_chk.get(), CBRK_SUPPLY_CHK_KEY)) {
// Reset related failsafe flags otherwise failures from before disabling the check cause failsafes without reported reason
reporter.failsafeFlags().battery_unhealthy = false;
reporter.failsafeFlags().battery_low_remaining_time = false;
reporter.failsafeFlags().battery_warning = battery_status_s::BATTERY_WARNING_NONE;
return;
}

Expand Down

0 comments on commit 86f5c0e

Please sign in to comment.