diff --git a/README.md b/README.md index 206d6848c..e0a5fd85a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is a tool for using Android with open-source mesh radios. For more information see our webpage: [meshtastic.org](https://www.meshtastic.org). If you are looking for the the device side code, see [here](https://github.com/meshtastic/Meshtastic-esp32). -This project is currently early-alpha, if you have questions or feedback please [Join our discussion forum](https://meshtastic.discourse.group/). We would love to hear from you. +This project is currently beta testing, if you have questions or feedback please [Join our discussion forum](https://meshtastic.discourse.group/). We would love to hear from you. The production version of our application is here: 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/MainActivity.kt b/app/src/main/java/com/geeksville/mesh/MainActivity.kt index e50440f9e..4481f7680 100644 --- a/app/src/main/java/com/geeksville/mesh/MainActivity.kt +++ b/app/src/main/java/com/geeksville/mesh/MainActivity.kt @@ -929,12 +929,9 @@ class MainActivity : AppCompatActivity(), Logging, val handler: Handler by lazy { Handler(mainLooper) } - // Keeps track of pings status so we update the menu properly. - var pingRunning: Boolean = false override fun onPrepareOptionsMenu(menu: Menu): Boolean { - menu.findItem(R.id.start_ping).setVisible(!pingRunning) - menu.findItem(R.id.stop_ping).setVisible(pingRunning) + menu.findItem(R.id.stress_test).isVisible = BuildConfig.DEBUG // only show stress test for debug builds (for now) return super.onPrepareOptionsMenu(menu) } @@ -960,11 +957,11 @@ class MainActivity : AppCompatActivity(), Logging, fragmentTransaction.commit() return true } - R.id.start_ping -> { + R.id.stress_test -> { fun postPing() { // Send ping message and arrange delayed recursion. debug("Sending ping") - val str = "Ping " + DateFormat.getTimeInstance(DateFormat.SHORT) + val str = "Ping " + DateFormat.getTimeInstance(DateFormat.MEDIUM) .format(Date(System.currentTimeMillis())) model.messagesState.sendMessage(str) handler.postDelayed( @@ -974,15 +971,11 @@ class MainActivity : AppCompatActivity(), Logging, 30000 ) } - postPing() - pingRunning = true - invalidateOptionsMenu() - return true - } - R.id.stop_ping -> { - handler.removeCallbacksAndMessages(null) - pingRunning = false - invalidateOptionsMenu() + item.isChecked = !item.isChecked // toggle ping test + if(item.isChecked) + postPing() + else + handler.removeCallbacksAndMessages(null) return true } else -> super.onOptionsItemSelected(item) 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 45b311f8a..817fdd95e 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -734,7 +734,8 @@ 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 - // debug("SENDING TO RADIO: $packet") + if (BuildConfig.DEBUG) + debug("Sending to radio: $packet") // IMPORTANT: we only log this info for debug builds, because it might leak PII sendToRadio(packet) } @@ -1306,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) @@ -1399,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 { @@ -1447,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/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt index decfa6fed..a582d3c5c 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt @@ -745,8 +745,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { val hasBonded = RadioInterfaceService.getBondedDeviceAddress(requireContext()) != null - // get rid of the warning text once at least one device is paired - binding.warningNotPaired.visibility = if (hasBonded) View.GONE else View.VISIBLE + // get rid of the warning text once at least one device is paired. + // If we are running on an emulator, always leave this message showing so we can test the worst case layout + binding.warningNotPaired.visibility = if (hasBonded && !RadioInterfaceService.isMockInterfaceAvailable(requireContext())) View.GONE else View.VISIBLE } /// Setup the GUI to do a classic (pre SDK 26 BLE scan) 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 diff --git a/app/src/main/res/layout/settings_fragment.xml b/app/src/main/res/layout/settings_fragment.xml index 7f6e135f2..45a7b535c 100644 --- a/app/src/main/res/layout/settings_fragment.xml +++ b/app/src/main/res/layout/settings_fragment.xml @@ -1,192 +1,199 @@ - + android:layout_height="match_parent" + android:fillViewport="true" + tools:context=".MainActivity"> - + - - - - - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:autoLink="web" + android:ems="10" + android:gravity="start|top" + android:text="@string/warning_not_paired" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup" /> - - - - - - - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:hint="@string/your_name" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + + + + - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="8dp" + android:text="@string/looking_for_meshtastic_devices" + app:layout_constraintEnd_toStartOf="@+id/updateFirmwareButton" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/usernameView" /> - - -