except for dynamic device probing USB serial works pretty good now #38

pull/40/head
geeksville 2020-06-09 09:53:32 -07:00
rodzic 1cd0e1692d
commit 005ab16283
3 zmienionych plików z 59 dodań i 55 usunięć

Wyświetl plik

@ -1118,7 +1118,8 @@ class MeshService : Service(), Logging {
// Important to never throw exceptions out of onReceive
override fun onReceive(context: Context, intent: Intent) = exceptionReporter {
serviceScope.handledLaunch {
// NOTE: Do not call handledLaunch here, because it can cause out of order message processing - because each routine is scheduled independently
// serviceScope.handledLaunch {
debug("Received broadcast ${intent.action}")
when (intent.action) {
RadioInterfaceService.RADIO_CONNECTED_ACTION -> {
@ -1169,7 +1170,6 @@ class MeshService : Service(), Logging {
}
}
}
}
/// A provisional MyNodeInfo that we will install if all of our node config downloads go okay
private var newMyNodeInfo: MyNodeInfo? = null
@ -1295,6 +1295,7 @@ class MeshService : Service(), Logging {
configNonce += 1
newNodes.clear()
newMyNodeInfo = null
debug("Starting config nonce=$configNonce")
sendToRadio(ToRadio.newBuilder().apply {
this.wantConfigId = configNonce

Wyświetl plik

@ -154,6 +154,8 @@ class RadioInterfaceService : Service(), Logging {
receivedPacketsLog.flush()
}
// ignoreException { debug("FromRadio: ${MeshProtos.FromRadio.parseFrom(p)}") }
broadcastReceivedFromRadio(
this,
p

Wyświetl plik

@ -88,14 +88,15 @@ class SerialInterface(private val service: RadioInterfaceService, val address: S
override fun handleSendToRadio(p: ByteArray) {
// This method is called from a continuation and it might show up late, so check for uart being null
uart?.apply {
val header = ByteArray(4)
header[0] = START1
header[1] = START2
header[2] = (p.size shr 8).toByte()
header[3] = (p.size and 0xff).toByte()
write(header, 0) // FIXME - combine these into one write (for fewer USB transactions)
write(p, 0)
ioManager?.apply {
writeAsync(header)
writeAsync(p)
}
}