kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
make 1.2 firmware update work even for old 1.0 devices
rodzic
bfdf4a661a
commit
54bf0e85c1
|
@ -668,8 +668,7 @@ class MainActivity : AppCompatActivity(), Logging,
|
||||||
else {
|
else {
|
||||||
|
|
||||||
val curVer = DeviceVersion(info.firmwareVersion ?: "0.0.0")
|
val curVer = DeviceVersion(info.firmwareVersion ?: "0.0.0")
|
||||||
val minVer = DeviceVersion("1.2.0")
|
if (curVer < MeshService.minFirmwareVersion)
|
||||||
if (curVer < minVer)
|
|
||||||
showAlert(R.string.firmware_too_old, R.string.firmware_old)
|
showAlert(R.string.firmware_too_old, R.string.firmware_old)
|
||||||
else {
|
else {
|
||||||
// If our app is too old/new, we probably don't understand the new radioconfig messages, so we don't read them until here
|
// If our app is too old/new, we probably don't understand the new radioconfig messages, so we don't read them until here
|
||||||
|
|
|
@ -94,6 +94,10 @@ class MeshService : Service(), Logging {
|
||||||
"com.geeksville.mesh",
|
"com.geeksville.mesh",
|
||||||
"com.geeksville.mesh.service.MeshService"
|
"com.geeksville.mesh.service.MeshService"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** The minimmum firmware version we know how to talk to. We'll still be able to talk to 1.0 firmwares but only well enough to ask them to firmware update
|
||||||
|
*/
|
||||||
|
val minFirmwareVersion = DeviceVersion("1.2.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ConnectionState {
|
enum class ConnectionState {
|
||||||
|
@ -1174,18 +1178,6 @@ class MeshService : Service(), Logging {
|
||||||
/// Used to make sure we never get foold by old BLE packets
|
/// Used to make sure we never get foold by old BLE packets
|
||||||
private var configNonce = 1
|
private var configNonce = 1
|
||||||
|
|
||||||
|
|
||||||
private fun handleRadioConfig(radio: RadioConfigProtos.RadioConfig) {
|
|
||||||
val packetToSave = Packet(
|
|
||||||
UUID.randomUUID().toString(),
|
|
||||||
"RadioConfig",
|
|
||||||
System.currentTimeMillis(),
|
|
||||||
radio.toString()
|
|
||||||
)
|
|
||||||
insertPacket(packetToSave)
|
|
||||||
radioConfig = radio
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a protobuf NodeInfo into our model objects and update our node DB
|
* Convert a protobuf NodeInfo into our model objects and update our node DB
|
||||||
*/
|
*/
|
||||||
|
@ -1416,7 +1408,12 @@ class MeshService : Service(), Logging {
|
||||||
|
|
||||||
sendAnalytics()
|
sendAnalytics()
|
||||||
|
|
||||||
requestRadioConfig()
|
if(deviceVersion < minFirmwareVersion) {
|
||||||
|
info("Device firmware is too old, faking config so firmware update can occur")
|
||||||
|
onHasSettings()
|
||||||
|
}
|
||||||
|
else
|
||||||
|
requestRadioConfig()
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
warn("Ignoring stale config complete")
|
warn("Ignoring stale config complete")
|
||||||
|
|
Ładowanie…
Reference in New Issue