File tree Expand file tree Collapse file tree
firmware/src/main/kotlin/org/meshtastic/feature/firmware
settings/src/main/kotlin/org/meshtastic/feature/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,12 @@ constructor(
6363 fun dfuProgressFlow (): Flow <DfuInternalState > = nordicDfuHandler.progressFlow()
6464
6565 private fun getHandler (hardware : DeviceHardware ): FirmwareUpdateHandler = when {
66- radioPrefs.isSerial() -> usbUpdateHandler
66+ radioPrefs.isSerial() -> {
67+ if (isEsp32Architecture(hardware.architecture)) {
68+ error(" Serial/USB firmware update not supported for ESP32 devices from the app" )
69+ }
70+ usbUpdateHandler
71+ }
6772 radioPrefs.isBle() -> {
6873 if (isEsp32Architecture(hardware.architecture)) {
6974 esp32OtaUpdateHandler
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ constructor(
147147 checkForUpdates()
148148 }
149149
150+ @Suppress(" LongMethod" )
150151 fun checkForUpdates () {
151152 updateJob?.cancel()
152153 updateJob =
@@ -174,14 +175,18 @@ constructor(
174175 _selectedRelease .value = release
175176 val dismissed = bootloaderWarningDataSource.isDismissed(address)
176177 val firmwareUpdateMethod =
177- if (radioPrefs.isSerial()) {
178- FirmwareUpdateMethod .Usb
179- } else if (radioPrefs.isBle()) {
180- FirmwareUpdateMethod .Ble
181- } else if (radioPrefs.isTcp()) {
182- FirmwareUpdateMethod .Wifi
183- } else {
184- FirmwareUpdateMethod .Unknown
178+ when {
179+ radioPrefs.isSerial() -> {
180+ // ESP32 Serial updates are not supported from the app yet.
181+ if (deviceHardware.isEsp32Arc) {
182+ FirmwareUpdateMethod .Unknown
183+ } else {
184+ FirmwareUpdateMethod .Usb
185+ }
186+ }
187+ radioPrefs.isBle() -> FirmwareUpdateMethod .Ble
188+ radioPrefs.isTcp() -> FirmwareUpdateMethod .Wifi
189+ else -> FirmwareUpdateMethod .Unknown
185190 }
186191 _state .value =
187192 FirmwareUpdateState .Ready (
Original file line number Diff line number Diff line change @@ -128,14 +128,18 @@ constructor(
128128 } else if (radioPrefs.isBle() || radioPrefs.isSerial() || radioPrefs.isTcp()) {
129129 val hwModel = node.user.hwModel.number
130130 val hw = deviceHardwareRepository.getDeviceHardwareByModel(hwModel).getOrNull()
131- // Support both Nordic DFU (requiresDfu) and ESP32 Unified OTA (supportsUnifiedOta)
132131 val capabilities = Capabilities (node.metadata?.firmwareVersion)
132+ val isSerial = radioPrefs.isSerial()
133133
134134 // ESP32 Unified OTA is only supported via BLE or WiFi (TCP), not USB Serial.
135- val isEsp32OtaSupported =
136- hw?.isEsp32Arc == true && capabilities.supportsEsp32Ota && ! radioPrefs.isSerial()
135+ val isEsp32OtaSupported = hw?.isEsp32Arc == true && capabilities.supportsEsp32Ota && ! isSerial
137136
138- flow { emit(hw?.requiresDfu == true || isEsp32OtaSupported) }
137+ // Nordic DFU/USB update is supported for NRF52/RP2040.
138+ // For ESP32, we do NOT support Serial updates from the app yet, even if requiresDfu is true
139+ // (which might be set for S3 native USB, but is currently unused by our handlers).
140+ val isDfuSupported = hw?.requiresDfu == true && hw.isEsp32Arc != true
141+
142+ flow { emit(isDfuSupported || isEsp32OtaSupported) }
139143 } else {
140144 flowOf(false )
141145 }
You can’t perform that action at this time.
0 commit comments