fix channel setting

1.2-legacy
Kevin Hester 2021-03-05 14:14:17 +08:00
rodzic d15ff7ed36
commit 390413bd8a
3 zmienionych plików z 14 dodań i 3 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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
*/

Wyświetl plik

@ -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()
})