Skip to content

Fix DFU flash: ensure cleanup callback runs on USB error#2432

Merged
sensei-hacker merged 1 commit intoiNavFlight:masterfrom
sensei-hacker:fix-dfu-cleanup-callback
Nov 27, 2025
Merged

Fix DFU flash: ensure cleanup callback runs on USB error#2432
sensei-hacker merged 1 commit intoiNavFlight:masterfrom
sensei-hacker:fix-dfu-cleanup-callback

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Nov 25, 2025

User description

Problem

After DFU flashing completes successfully, users cannot reconnect to the flight controller without restarting the configurator.

Root Cause

In stm32usbdfu.js, when the final USB controlTransfer fails (expected when device reboots after successful flash), the error handler logs the error but doesn't call the callback. This leaves GUI.connect_lock = true, preventing reconnection.

Solution

Call the callback with an error code even when USB transfer fails, ensuring cleanup() runs and GUI.connect_lock gets cleared.

Testing

  • Flashed firmware via DFU successfully
  • Verified reconnection works immediately after flash without restarting configurator
  • No regressions in DFU flashing behavior

Files Changed

  • js/protocols/stm32usbdfu.js (+2 lines)

PR Type

Enhancement, Bug fix, Tests, Documentation

@sensei-hacker sensei-hacker force-pushed the fix-dfu-cleanup-callback branch from 2f534cb to d4fa1e1 Compare November 25, 2025 00:55
@iNavFlight iNavFlight deleted a comment from qodo-code-review bot Nov 25, 2025
@iNavFlight iNavFlight deleted a comment from qodo-code-review bot Nov 25, 2025
@sensei-hacker sensei-hacker merged commit d1d3b06 into iNavFlight:master Nov 27, 2025
6 checks passed
@sensei-hacker sensei-hacker added this to the 9.0 milestone Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant