From 221738603b6e94da4cfbcb735ad150aa8a046ca2 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Fri, 12 Feb 2021 13:50:39 +0800 Subject: [PATCH] 1.1.46 --- app/build.gradle | 4 ++-- .../com/geeksville/mesh/service/MeshService.kt | 17 +++++++++++------ app/src/main/proto | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 695e2ad7d..1f703a316 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { applicationId "com.geeksville.mesh" minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works) targetSdkVersion 29 - versionCode 20144 // format is Mmmss (where M is 1+the numeric major number - versionName "1.1.44" + versionCode 20146 // format is Mmmss (where M is 1+the numeric major number + versionName "1.1.46" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // per https://developer.android.com/studio/write/vector-asset-studio diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index f0a27b574..817fdd95e 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -6,7 +6,6 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter -import android.os.Build import android.os.IBinder import android.os.RemoteException import android.widget.Toast @@ -735,7 +734,7 @@ class MeshService : Service(), Logging { val packet = toMeshPacket(p) p.status = MessageStatus.ENROUTE p.time = System.currentTimeMillis() // update time to the actual time we started sending - if(BuildConfig.DEBUG) + if (BuildConfig.DEBUG) debug("Sending to radio: $packet") // IMPORTANT: we only log this info for debug builds, because it might leak PII sendToRadio(packet) } @@ -1308,6 +1307,9 @@ class MeshService : Service(), Logging { it.wantResponse = wantResponse }.build() + // Assume our position packets are not critical + packet.priority = MeshProtos.MeshPacket.Priority.BACKGROUND + // Also update our own map for our nodenum, by handling the packet just like packets from other users handleReceivedPosition(myNodeInfo!!.myNodeNum, position) @@ -1401,7 +1403,7 @@ class MeshService : Service(), Logging { // We now always pick a random initial packet id (odds of collision with the device is insanely low with 32 bit ids) val random = Random(System.currentTimeMillis()) val devicePacketId = random.nextLong().absoluteValue - + // Not inited - pick a number on the opposite side of what the device is using currentPacketId = devicePacketId + numPacketIds / 2 } else { @@ -1449,13 +1451,16 @@ class MeshService : Service(), Logging { BluetoothInterface.safe ?: throw Exception("Can't update - no bluetooth connected") - if (updateJob?.isActive == true) + if (updateJob?.isActive == true) { + errormsg("A firmware update is already running") throw Exception("Firmware update already running") - else + } else { + debug("Creating firmware update coroutine") updateJob = serviceScope.handledLaunch { - info("Starting firmware update coroutine") + debug("Starting firmware update coroutine") SoftwareUpdateService.doUpdate(this@MeshService, safe, filename) } + } } /** diff --git a/app/src/main/proto b/app/src/main/proto index 8492e4030..b1aed0644 160000 --- a/app/src/main/proto +++ b/app/src/main/proto @@ -1 +1 @@ -Subproject commit 8492e4030ad928ee5fc97f8ead95325dba7f9492 +Subproject commit b1aed06442025624841b2288fac273d9bc41c438