sforkowany z mirror/meshtastic-android
fix channel setting
rodzic
d15ff7ed36
commit
390413bd8a
|
@ -667,6 +667,9 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
model.radioConfig.value =
|
||||
RadioConfigProtos.RadioConfig.parseFrom(service.radioConfig)
|
||||
|
||||
model.channels.value =
|
||||
ChannelSet(AppOnlyProtos.ChannelSet.parseFrom(service.channels))
|
||||
|
||||
updateNodesFromDevice()
|
||||
|
||||
// we have a connection to our device now, do the channel change
|
||||
|
|
|
@ -542,7 +542,10 @@ class MeshService : Service(), Logging {
|
|||
}.build()
|
||||
}
|
||||
|
||||
TODO("Need to send channels to device")
|
||||
debug("Sending channels to device")
|
||||
asChannels.forEach {
|
||||
setChannel(it)
|
||||
}
|
||||
|
||||
channels = asChannels.toTypedArray()
|
||||
}
|
||||
|
@ -1387,6 +1390,12 @@ class MeshService : Service(), Logging {
|
|||
})
|
||||
}
|
||||
|
||||
private fun setChannel(channel: ChannelProtos.Channel) {
|
||||
sendToRadio(newMeshPacketTo(myNodeNum).buildAdminPacket(wantResponse = true) {
|
||||
setChannel = channel
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the modern (REV2) API configuration flow
|
||||
*/
|
||||
|
|
|
@ -78,7 +78,6 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
|
||||
/// Pull the latest data from the model (discarding any user edits)
|
||||
private fun setGUIfromModel() {
|
||||
val radioConfig = model.radioConfig.value
|
||||
val channels = model.channels.value
|
||||
|
||||
binding.editableCheckbox.isChecked = false // start locked
|
||||
|
@ -231,7 +230,7 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
shareChannel()
|
||||
}
|
||||
|
||||
model.radioConfig.observe(viewLifecycleOwner, {
|
||||
model.channels.observe(viewLifecycleOwner, {
|
||||
setGUIfromModel()
|
||||
})
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue