don't spam autobugs if we get an exception reading fromnum when the device is leaving

pull/133/head
geeksville 2020-08-15 11:19:23 -07:00
rodzic 8233f063ed
commit 92621e07aa
1 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -176,7 +176,9 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
/// Our BLE device /// Our BLE device
val device get() = safe?.gatt ?: throw RadioNotConnectedException("No GATT") val device
get() = (safe ?: throw RadioNotConnectedException("No SafeBluetooth")).gatt
?: throw RadioNotConnectedException("No GATT")
/// Our service - note - it is possible to get back a null response for getService if the device services haven't yet been found /// Our service - note - it is possible to get back a null response for getService if the device services haven't yet been found
val bservice val bservice
@ -314,11 +316,16 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
fromNumChanged = true fromNumChanged = true
debug("fromNum changed") debug("fromNum changed")
service.serviceScope.handledLaunch { service.serviceScope.handledLaunch {
try {
if (fromNumChanged) { if (fromNumChanged) {
fromNumChanged = false fromNumChanged = false
debug("fromNum changed, so we are reading new messages") debug("fromNum changed, so we are reading new messages")
doReadFromRadio(false) doReadFromRadio(false)
} }
} catch (e: RadioNotConnectedException) {
// Don't report autobugs for this, getting an exception here is expected behavior
errormsg("Ending FromNum read, radio not connected", e)
}
} }
} }
} }