ESC check: Avoid unsigned timestamp underflow in telemtry timeout (#24069)

* Avoid unsigned integer underflow

* ESC check: add brackets to timeout for readability

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
This commit is contained in:
Perre
2024-12-03 17:14:09 +01:00
committed by GitHub
parent 8626019ae0
commit dfa48f988d
@@ -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);