Remove the need for restart before OTA on newer firmware (#1627)

This commit is contained in:
lucas lelievre authored and GitHub committed 2025-12-05 22:12:03 +01:00
1 parent d74b26fbda
commit 5f1167f0de
1 file changed
+28 -15
@@ -222,22 +222,35 @@ class FirmwareUpdateHandler(private val server: VRServer) :
LogManager.info("[FirmwareUpdateHandler] Device is already updating, skipping")
}
onStatusChange(
UpdateStatusEvent(
val udpDevice: UDPDevice? =
(server.deviceManager.devices.find { device -> device is UDPDevice && device.id == deviceId.id }) as UDPDevice?
if (udpDevice === null) {
error("invalid state - device does not exist")
}
if (udpDevice.protocolVersion <= 20) {
onStatusChange(
UpdateStatusEvent(
deviceId,
FirmwareUpdateStatus.NEED_MANUAL_REBOOT,
),
)
watchRestartQueue.add(
Pair(deviceId) {
mainScope.launch {
startFirmwareUpdateJob(
request,
deviceId,
)
}
},
)
} else {
startFirmwareUpdateJob(
request,
deviceId,
FirmwareUpdateStatus.NEED_MANUAL_REBOOT,
),
)
watchRestartQueue.add(
Pair(deviceId) {
mainScope.launch {
startFirmwareUpdateJob(
request,
deviceId,
)
}
},
)
)
}
} else {
if (updatingDevicesStatus[deviceId] != null) {
LogManager.info("[FirmwareUpdateHandler] Device is already updating, skipping")