kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
fix new hwmodel based on testing with the simulator
rodzic
483bd878ab
commit
fa17c4efe1
|
@ -375,10 +375,10 @@ class MeshService : Service(), Logging {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun installNewNodeDB(newMyNodeInfo: MyNodeInfo, nodes: Array<NodeInfo>) {
|
private fun installNewNodeDB(ni: MyNodeInfo, nodes: Array<NodeInfo>) {
|
||||||
discardNodeDB() // Get rid of any old state
|
discardNodeDB() // Get rid of any old state
|
||||||
|
|
||||||
myNodeInfo = newMyNodeInfo
|
myNodeInfo = ni
|
||||||
|
|
||||||
// put our node array into our two different map representations
|
// put our node array into our two different map representations
|
||||||
nodeDBbyNodeNum.putAll(nodes.map { Pair(it.num, it) })
|
nodeDBbyNodeNum.putAll(nodes.map { Pair(it.num, it) })
|
||||||
|
@ -1228,15 +1228,13 @@ class MeshService : Service(), Logging {
|
||||||
val isBluetoothInterface = a != null && a.startsWith("x")
|
val isBluetoothInterface = a != null && a.startsWith("x")
|
||||||
|
|
||||||
var hwModelStr = myInfo.hwModelDeprecated
|
var hwModelStr = myInfo.hwModelDeprecated
|
||||||
if(hwModelStr.isEmpty()) {
|
if (hwModelStr.isEmpty()) {
|
||||||
try {
|
val nodeNum =
|
||||||
val ni = toNodeInfo(myNodeNum)
|
myInfo.myNodeNum // Note: can't use the normal property because myNodeInfo not yet setup
|
||||||
val asStr = ni.user?.hwModelString
|
val ni = nodeDBbyNodeNum[nodeNum] // can't use toNodeInfo because too early
|
||||||
if (asStr != null)
|
val asStr = ni?.user?.hwModelString
|
||||||
hwModelStr = asStr
|
if (asStr != null)
|
||||||
} catch(_: NodeNumNotFoundException) {
|
hwModelStr = asStr
|
||||||
warn("Can't find local node to get hardware model")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
val mi = with(myInfo) {
|
val mi = with(myInfo) {
|
||||||
MyNodeInfo(
|
MyNodeInfo(
|
||||||
|
@ -1397,7 +1395,7 @@ class MeshService : Service(), Logging {
|
||||||
else {
|
else {
|
||||||
discardNodeDB()
|
discardNodeDB()
|
||||||
debug("Installing new node DB")
|
debug("Installing new node DB")
|
||||||
myNodeInfo = newMyNodeInfo
|
myNodeInfo = newMyNodeInfo// Install myNodeInfo as current
|
||||||
|
|
||||||
newNodes.forEach(::installNodeInfo)
|
newNodes.forEach(::installNodeInfo)
|
||||||
newNodes.clear() // Just to save RAM ;-)
|
newNodes.clear() // Just to save RAM ;-)
|
||||||
|
@ -1405,6 +1403,8 @@ class MeshService : Service(), Logging {
|
||||||
haveNodeDB = true // we now have nodes from real hardware
|
haveNodeDB = true // we now have nodes from real hardware
|
||||||
|
|
||||||
regenMyNodeInfo() // we have a node db now, so can possibly find a better hwmodel
|
regenMyNodeInfo() // we have a node db now, so can possibly find a better hwmodel
|
||||||
|
myNodeInfo = newMyNodeInfo // we might have just updated myNodeInfo
|
||||||
|
|
||||||
sendAnalytics()
|
sendAnalytics()
|
||||||
|
|
||||||
requestRadioConfig()
|
requestRadioConfig()
|
||||||
|
|
|
@ -162,7 +162,7 @@ class MockInterface(private val service: RadioInterfaceService) : Logging, IRadi
|
||||||
myInfo = MeshProtos.MyNodeInfo.newBuilder().apply {
|
myInfo = MeshProtos.MyNodeInfo.newBuilder().apply {
|
||||||
myNodeNum = MY_NODE
|
myNodeNum = MY_NODE
|
||||||
messageTimeoutMsec = 5 * 60 * 1000
|
messageTimeoutMsec = 5 * 60 * 1000
|
||||||
firmwareVersion = service.getString(R.string.cur_firmware_version)
|
firmwareVersion = "1.2.8" // Pretend to be running an older 1.2 version
|
||||||
numBands = 13
|
numBands = 13
|
||||||
maxChannels = 8
|
maxChannels = 8
|
||||||
}.build()
|
}.build()
|
||||||
|
|
|
@ -610,7 +610,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
statusText.text = getString(R.string.must_set_region)
|
statusText.text = getString(R.string.must_set_region)
|
||||||
|
|
||||||
connected == MeshService.ConnectionState.CONNECTED -> {
|
connected == MeshService.ConnectionState.CONNECTED -> {
|
||||||
val fwStr = info?.firmwareString ?: ""
|
val fwStr = info?.firmwareString ?: "unknown"
|
||||||
statusText.text = getString(R.string.connected_to).format(fwStr)
|
statusText.text = getString(R.string.connected_to).format(fwStr)
|
||||||
}
|
}
|
||||||
connected == MeshService.ConnectionState.DISCONNECTED ->
|
connected == MeshService.ConnectionState.DISCONNECTED ->
|
||||||
|
|
Ładowanie…
Reference in New Issue