From 6916554ebadc15a7764c7c36bc4822b1fed41cdf Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Fri, 25 Sep 2026 21:07:26 -0600 Subject: [PATCH] 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 --- src/drivers/dshot/DShot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/dshot/DShot.cpp b/src/drivers/dshot/DShot.cpp index f4e297d4993..306d67b31db 100644 --- a/src/drivers/dshot/DShot.cpp +++ b/src/drivers/dshot/DShot.cpp @@ -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;