mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix bugs found via simulator
This commit is contained in:
parent
aa79ee4335
commit
81e76bfc51
6 changed files with 38 additions and 31 deletions
|
|
@ -765,6 +765,7 @@ class MeshService : Service(), Logging {
|
|||
if (fromNodeNum == myNodeNum) {
|
||||
when (a.variantCase) {
|
||||
AdminProtos.AdminMessage.VariantCase.GET_RADIO_RESPONSE -> {
|
||||
debug("Admin: received radioConfig")
|
||||
radioConfig = a.getRadioResponse
|
||||
requestChannel(0) // Now start reading channels
|
||||
}
|
||||
|
|
@ -774,19 +775,18 @@ class MeshService : Service(), Logging {
|
|||
if (mi != null) {
|
||||
val ch = a.getChannelResponse
|
||||
channels[ch.index] = ch
|
||||
debug("Received channel ${ch.index}")
|
||||
debug("Admin: Received channel ${ch.index}")
|
||||
if (ch.index + 1 < mi.maxChannels) {
|
||||
if(ch.hasSettings()) {
|
||||
// Not done yet, request next channel
|
||||
requestChannel(ch.index + 1)
|
||||
}
|
||||
/* if(ch.index == 0) {
|
||||
// We allow the app to start as soon as we've received the primary channel, we'll keep fetching other channels in the background
|
||||
else {
|
||||
debug("We've received the primary channel, allowing rest of app to start...")
|
||||
onHasSettings()
|
||||
} */
|
||||
}
|
||||
} else {
|
||||
debug("Received all channels")
|
||||
debug("Received max channels, starting app")
|
||||
onHasSettings()
|
||||
}
|
||||
}
|
||||
|
|
@ -1629,9 +1629,7 @@ class MeshService : Service(), Logging {
|
|||
doFirmwareUpdate()
|
||||
}
|
||||
|
||||
override fun getMyNodeInfo(): MyNodeInfo = toRemoteExceptions {
|
||||
this@MeshService.myNodeInfo ?: throw RadioNotConnectedException("No MyNodeInfo")
|
||||
}
|
||||
override fun getMyNodeInfo(): MyNodeInfo? = this@MeshService.myNodeInfo
|
||||
|
||||
override fun getMyId() = toRemoteExceptions { myNodeID }
|
||||
|
||||
|
|
|
|||
|
|
@ -156,24 +156,11 @@ class MockInterface(private val service: RadioInterfaceService) : Logging, IRadi
|
|||
hwModel = "Sim"
|
||||
messageTimeoutMsec = 5 * 60 * 1000
|
||||
firmwareVersion = service.getString(R.string.cur_firmware_version)
|
||||
numBands = 13
|
||||
maxChannels = 8
|
||||
}.build()
|
||||
},
|
||||
|
||||
// RadioConfig
|
||||
/* MeshProtos.FromRadio.newBuilder().apply {
|
||||
radio = RadioConfigProtos.RadioConfig.newBuilder().apply {
|
||||
|
||||
preferences = RadioConfigProtos.RadioConfig.UserPreferences.newBuilder().apply {
|
||||
region = RadioConfigProtos.RegionCode.TW
|
||||
// FIXME set critical times?
|
||||
}.build()
|
||||
|
||||
/* channel = ChannelProtos.ChannelSettings.newBuilder().apply {
|
||||
// we just have an empty listing so that the default channel works
|
||||
}.build() */
|
||||
}.build()
|
||||
}, */
|
||||
|
||||
// Fake NodeDB
|
||||
makeNodeInfo(MY_NODE, 32.776665, -96.796989), // dallas
|
||||
makeNodeInfo(MY_NODE + 1, 32.960758, -96.733521), // richardson
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue