Skip to content

feat(dfu): boot the app after 6 minutes of DFU inactivity - #88

Merged
jamesarich merged 1 commit into
masterfrom
feat/dfu-inactivity-timeout
Oct 26, 2026
Merged

jamesarich merged 1 commit into
masterfrom
feat/dfu-inactivity-timeout

Conversation

@jamesarich

@jamesarich jamesarich commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Checklist

  • PR title specifically describes the change
  • tools/build_all.py (or CI's board matrix) passes

Description of Change

A board with a working app that lands in DFU and then sees nothing, such as a buttonless BLE OTA the phone never starts or --enter-dfu with no file copied, waits forever. Now a DFU session that stays idle for 6 minutes with a valid app ends through the existing DFU_TIMEOUT path and boots the app. A BLE connect, any DFU control or packet event, MSC read or write, USB mount and serial DFU traffic restart the count; with no valid app the board keeps waiting as in 2.6. Same idea as Adafruit's efe383d, wired into bootloader_dfu_start as a 1 s tick instead of their single-bank erase loop. An idle BLE link with no DFU writes does not count as activity.

Tested on the Wio Tracker L1 (S140 7.3.0) with a 30 s test build: BLE wait booted the app at 30.4-30.7 s 3 of 3 and once on battery, the UF2 drive left at 31.9 s 2 of 2, a connect restarted the count 3 of 3, two 250 s BLE OTAs and a 66 s throttled UF2 copy completed, MSC writes with 20 s gaps kept the drive up, and with no valid app it stayed in BLE wait and on the drive past 150 s. The production build booted the app from BLE wait at 361 s; on the drive it left at 423 s twice, a host access about a minute after mount restarting the count.

Summary by CodeRabbit

  • New Features
    • Devices with a valid application now boot it after six minutes of inactivity in DFU mode. BLE connections, DFU traffic, USB activity, and UF2 drive reads or writes restart the timer. Devices without a valid application remain in DFU mode.
  • Documentation
    • Updated troubleshooting guidance and the OTAFIX 2.6 changelog to describe the timeout behavior.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 19c781a7-0421-4318-acd1-1977b162c0e4
Commits

Reviewing files that changed from the base of the PR and between 42a4d66 and 531345f.

Files selected for processing: 8
  • README.md
  • changelog.md
  • lib/sdk11/components/libraries/bootloader_dfu/bootloader.c
  • lib/sdk11/components/libraries/bootloader_dfu/bootloader.h
  • lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c
  • lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c
  • src/usb/msc_uf2.c
  • src/usb/usb.c

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The bootloader now tracks DFU inactivity and submits a timeout event after six minutes when an update is ongoing and a valid application exists. BLE, serial, and USB activity signals reset the idle count. Documentation describes the behavior.

Changes: DFU inactivity timeout

Layer / File(s) Summary
Timer and timeout behavior
lib/sdk11/components/libraries/bootloader_dfu/bootloader.h, lib/sdk11/components/libraries/bootloader_dfu/bootloader.c, README.md, changelog.md
Adds the dfu_activity() API and a one-second timer that tracks idle time. At six minutes, the timer submits DFU_TIMEOUT only if an update is ongoing and a valid application exists. The documentation describes the timeout and continued DFU behavior when no valid application exists.
Activity event sources
lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c, lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c, src/usb/msc_uf2.c, src/usb/usb.c
BLE connection and DFU events, serial DFU packets, UF2 reads and writes, and USB mounting call dfu_activity().

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant BLE as BLE transport
  participant Serial as Serial transport
  participant USB as USB callbacks
  participant Activity as dfu_activity()
  participant Timer as Inactivity timer
  participant Bootloader as Bootloader
  BLE->>Activity: Report connection or DFU event
  Serial->>Activity: Report DFU packet
  USB->>Activity: Report mount or UF2 request
  Activity->>Timer: Mark activity
  Timer->>Timer: Reset idle count on next tick
  Timer->>Bootloader: Submit DFU_TIMEOUT after six idle minutes if update and application conditions hold
Loading

Suggested reviewers: rcarteraz, oltaco

Merge Risk: Minimal · up to 53134

No actionable timeout issue remains. The change is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 6 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: booting a valid application after six minutes of DFU inactivity.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 6 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit watches seconds hop,
While BLE and USB mark each stop.
Serial packets join the queue,
The idle count starts fresh anew.
Six quiet minutes, then boots the app,
If one is valid—no DFU nap.

Comment @coderabbitai help to get the list of available commands.

@jamesarich
jamesarich added this pull request to the merge queue Oct 26, 2026
Merged via the queue into master with commit 496603f Oct 26, 2026
23 checks passed
@jamesarich
jamesarich deleted the feat/dfu-inactivity-timeout branch October 26, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant