mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-02-02 20:02:26 -05:00
fix channel setting
This commit is contained in:
@@ -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()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user