SRV_Channel: prepare for reboot at the HAL rc output level

ensures that the 0s get to the hardware

significantly reduces the race conditions which might allow a thread to write after values are zeroed
This commit is contained in:
Peter Barker
2026-09-18 00:10:02 +10:00
committed by Peter Barker
parent 94800d5ae6
commit 94f7e038b0
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -603,6 +603,10 @@ public:
return _singleton;
}
// called once a reboot has been commanded: stop driving the
// outputs so the reset cannot truncate a pulse in flight
static void prepare_for_reboot();
static void zero_rc_outputs();
// initialize before any call to push
+6
View File
@@ -548,6 +548,12 @@ void SRV_Channels::push()
#endif // HAL_ENABLE_DRONECAN_DRIVERS
}
void SRV_Channels::prepare_for_reboot()
{
hal.rcout->prepare_for_reboot();
}
void SRV_Channels::zero_rc_outputs()
{
/* Send an invalid signal to the motors to prevent spinning due to