Skip to content

Commit

Permalink
ESC check: Avoid unsigned timestamp underflow in telemtry timeout (#2…
Browse files Browse the repository at this point in the history
…4069)

* Avoid unsigned integer underflow

* ESC check: add brackets to timeout for readability

---------

Co-authored-by: Matthias Grob <[email protected]>
  • Loading branch information
Perrrewi and MaEtUgR authored Dec 3, 2024
1 parent 8626019 commit dfa48f9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void EscChecks::checkAndReport(const Context &context, Report &reporter)

esc_status_s esc_status;

if (_esc_status_sub.copy(&esc_status) && now - esc_status.timestamp < esc_telemetry_timeout) {
if (_esc_status_sub.copy(&esc_status) && (now < esc_status.timestamp + esc_telemetry_timeout)) {

checkEscStatus(context, reporter, esc_status);
reporter.setIsPresent(health_component_t::motors_escs);
Expand Down

0 comments on commit dfa48f9

Please sign in to comment.