mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-10-06 09:02:52 +08:00
fix(dshot): keep programming active until the save is sent
The flag was cleared when the save command was queued, so it no longer guarded the save itself. Only the finished() gate in the vehicle command loop kept a CONFIGURE_ACTUATOR from replacing it. Clear the flag when the last save frame goes out so the guard covers the whole sequence. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
@@ -313,7 +313,6 @@ void DShot::select_next_command()
|
||||
// All settings have been written
|
||||
PX4_DEBUG("All settings written at time %.2fs", (double)hrt_absolute_time() / 1000000.);
|
||||
|
||||
_dshot_programming_active = false;
|
||||
_current_command.command = DSHOT_CMD_SAVE_SETTINGS;
|
||||
_current_command.num_repetitions = 6;
|
||||
_current_command.motor_mask = programming_motor_mask;
|
||||
@@ -424,8 +423,9 @@ void DShot::update_motor_commands(int num_outputs)
|
||||
if (command_sent) {
|
||||
--_current_command.num_repetitions;
|
||||
|
||||
if (!_dshot_programming_active && _current_command.finished()
|
||||
&& _current_command.command == DSHOT_CMD_SAVE_SETTINGS) {
|
||||
if (_current_command.finished() && _current_command.command == DSHOT_CMD_SAVE_SETTINGS) {
|
||||
// Programming ends with the save: anything sent in its place leaves the ESC on unsaved settings.
|
||||
_dshot_programming_active = false;
|
||||
_telemetry.invalidateSettings(_current_command.motor_mask);
|
||||
|
||||
_serial_telem_delay_until = hrt_absolute_time() + 500_ms;
|
||||
|
||||
Reference in New Issue
Block a user