From 74449be999d7f1448f54f67d4dc903a1ec7616f0 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 24 May 2020 10:46:27 -0700 Subject: [PATCH] don't spam with autobugs if we just fail because the device is off --- .../mesh/service/RadioInterfaceService.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt b/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt index dd9da9553..720eddde4 100644 --- a/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt @@ -260,21 +260,25 @@ class RadioInterfaceService : Service(), Logging { /// Send a packet/command out the radio link private fun handleSendToRadio(p: ByteArray) { - // Do this in the IO thread because it might take a while + // Do this in the IO thread because it might take a while (and we don't care about the result code) serviceScope.handledLaunch { - debug("sending to radio") - doWrite( - BTM_TORADIO_CHARACTER, - p - ) // Do a synchronous write, so that we can then do our reads if needed - if (logSends) { - sentPacketsLog.write(p) - sentPacketsLog.flush() - } + try { + debug("sending to radio") + doWrite( + BTM_TORADIO_CHARACTER, + p + ) // Do a synchronous write, so that we can then do our reads if needed + if (logSends) { + sentPacketsLog.write(p) + sentPacketsLog.flush() + } - if (isFirstSend) { - isFirstSend = false - doReadFromRadio(false) + if (isFirstSend) { + isFirstSend = false + doReadFromRadio(false) + } + } catch (ex: Exception) { + errormsg("Ignoring sendToRadio exception: $ex") } } }