feat(firmware): Implement USB DFU updates for supported devices (#3901)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-12-06 06:36:54 -06:00 committed by GitHub
parent f322eb31a0
commit 499ed58311
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 860 additions and 483 deletions

View file

@ -1459,6 +1459,7 @@ class MeshService : Service() {
private fun onConnectionChanged(c: ConnectionState) {
if (connectionStateHolder.connectionState.value == c && c !is ConnectionState.Connected) return
Timber.d("onConnectionChanged: ${connectionStateHolder.connectionState.value} -> $c")
serviceRepository.setConnectionTransport(currentTransport())
// Cancel any existing timeouts
sleepTimeout?.cancel()
@ -2604,6 +2605,10 @@ class MeshService : Service() {
)
}
override fun rebootToDfu() {
packetHandler.sendToRadio(newMeshPacketTo(myNodeNum).buildAdminPacket { enterDfuModeRequest = true })
}
override fun requestFactoryReset(requestId: Int, destNum: Int) = toRemoteExceptions {
packetHandler.sendToRadio(
newMeshPacketTo(destNum).buildAdminPacket(id = requestId) { factoryResetDevice = 1 },