kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Connect to a device without updating any change #119
rodzic
63e2532569
commit
c87d0adc61
|
@ -583,6 +583,8 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
try {
|
||||
// Pull down our real node ID - This must be done AFTER reading the nodedb because we need the DB to find our nodeinof object
|
||||
model.nodeDB.myId.value = service.myId
|
||||
val ourNodeInfo = model.nodeDB.ourNodeInfo
|
||||
model.ownerName.value = ourNodeInfo?.user?.longName
|
||||
} catch (ex: Exception) {
|
||||
warn("Ignoring failure to get myId, service is probably just uninited... ${ex.message}")
|
||||
}
|
||||
|
@ -595,9 +597,6 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
debug("connchange ${model.isConnected.value}")
|
||||
if (connected == MeshService.ConnectionState.CONNECTED) {
|
||||
|
||||
// everytime the radio reconnects, we slam in our current owner data, the radio is smart enough to only broadcast if needed
|
||||
model.setOwner()
|
||||
|
||||
model.meshService?.let { service ->
|
||||
debug("Getting latest radioconfig from service")
|
||||
model.radioConfig.value =
|
||||
|
|
|
@ -349,7 +349,7 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
|
|||
}
|
||||
|
||||
service.onDisconnect(false) // assume we will fail
|
||||
delay(1000) // Give some nasty time for buggy BLE stacks to shutdown (500ms was not enough)
|
||||
delay(1500) // Give some nasty time for buggy BLE stacks to shutdown (500ms was not enough)
|
||||
reconnectJob = null // Any new reconnect requests after this will be allowed to run
|
||||
warn("Attempting reconnect")
|
||||
if (safe != null) // check again, because we just slept for 1sec, and someone might have closed our interface
|
||||
|
|
|
@ -542,6 +542,8 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
// Only let user edit their name or set software update while connected to a radio
|
||||
model.isConnected.observe(viewLifecycleOwner, Observer { connected ->
|
||||
usernameView.isEnabled = connected == MeshService.ConnectionState.CONNECTED
|
||||
if(connected == MeshService.ConnectionState.DISCONNECTED)
|
||||
model.ownerName.value = ""
|
||||
initNodeInfo()
|
||||
})
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue