FirmwareMaintenanceLock

Marks a USB firmware-maintenance sequence as in flight, so the radio transport does not fight it for the device.

A factory erase leaves the device enumerating as a bare CDC port with no Meshtastic protocol on it. The serial transport will happily bind to that — its device lookup falls back to whatever probed device it can find, not just the saved address — and the environmental-recovery listeners re-enter transport startup whenever Bluetooth or the network flips. Both would claim the port the maintenance flow needs.

Lives in :core:common because the two parties sit in modules that cannot see each other: the flow that takes the lock is in :feature:firmware, and the code that must respect it is in :core:service.

The consequence of ignoring the lock is bounded rather than destructive — a transport that claims the port asserts DTR itself, which happens to unblock the erase — but it makes the flow's own signal unreliable, and a mesh handshake against erase firmware is noise nobody needs to debug.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

True while a maintenance sequence holds the lock.

Functions

Link copied to clipboard
fun acquire()

Takes the lock. Idempotent — re-taking an already-held lock is a no-op.

Link copied to clipboard
fun release()

Releases the lock. Must run even on failure, so callers use try/finally.