mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
update for proto changes
This commit is contained in:
parent
5c586526da
commit
5382fdae49
10 changed files with 78 additions and 60 deletions
|
|
@ -43,15 +43,15 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
|||
model.localConfig.asLiveData().observe(viewLifecycleOwner) {
|
||||
binding.positionBroadcastPeriodEditText.setText(model.config.position.positionBroadcastSecs.toString())
|
||||
binding.lsSleepEditText.setText(model.config.power.lsSecs.toString())
|
||||
binding.positionBroadcastPeriodView.isEnabled = !model.config.position.gpsDisabled
|
||||
binding.positionBroadcastSwitch.isChecked = !model.config.position.gpsDisabled
|
||||
binding.positionBroadcastPeriodView.isEnabled = model.config.position.gpsEnabled
|
||||
binding.positionBroadcastSwitch.isChecked = model.config.position.gpsEnabled
|
||||
binding.lsSleepView.isEnabled = model.config.power.isPowerSaving && model.isESP32()
|
||||
binding.lsSleepSwitch.isChecked = model.config.power.isPowerSaving && model.isESP32()
|
||||
}
|
||||
|
||||
model.connectionState.observe(viewLifecycleOwner) { connectionState ->
|
||||
val connected = connectionState == MeshService.ConnectionState.CONNECTED
|
||||
binding.positionBroadcastPeriodView.isEnabled = connected && !model.config.position.gpsDisabled
|
||||
binding.positionBroadcastPeriodView.isEnabled = connected && model.config.position.gpsEnabled
|
||||
binding.lsSleepView.isEnabled = connected && model.config.power.isPowerSaving
|
||||
binding.positionBroadcastSwitch.isEnabled = connected
|
||||
binding.lsSleepSwitch.isEnabled = connected && model.isESP32()
|
||||
|
|
@ -87,7 +87,7 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
|||
|
||||
binding.positionBroadcastSwitch.setOnCheckedChangeListener { btn, isChecked ->
|
||||
if (btn.isPressed) {
|
||||
model.updatePositionConfig { it.copy { gpsDisabled = !isChecked } }
|
||||
model.updatePositionConfig { it.copy { gpsEnabled = isChecked } }
|
||||
debug("User changed locationShare to $isChecked")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,10 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
debug("Switching back to default channel")
|
||||
installSettings(
|
||||
Channel.default.settings,
|
||||
Channel.default.loraConfig.copy { region = model.region }
|
||||
Channel.default.loraConfig.copy {
|
||||
region = model.region
|
||||
txEnabled = model.txEnabled
|
||||
}
|
||||
)
|
||||
}
|
||||
.show()
|
||||
|
|
@ -312,6 +315,8 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
// No matter what apply the speed selection from the user
|
||||
val newLoRaConfig = loRaConfig {
|
||||
region = model.region
|
||||
txEnabled = model.txEnabled
|
||||
usePreset = true
|
||||
modemPreset = newModemPreset
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
if (connected == MeshService.ConnectionState.DISCONNECTED)
|
||||
model.setOwner("")
|
||||
|
||||
if (model.config.position.gpsDisabled) {
|
||||
if (model.config.position.gpsEnabled) {
|
||||
binding.provideLocationCheckbox.isEnabled = true
|
||||
} else {
|
||||
binding.provideLocationCheckbox.isChecked = false
|
||||
binding.provideLocationCheckbox.isEnabled = false
|
||||
} else {
|
||||
binding.provideLocationCheckbox.isEnabled = true
|
||||
}
|
||||
|
||||
// update the region selection from the device
|
||||
val region = model.region
|
||||
val spinner = binding.regionSpinner
|
||||
val unsetIndex = regions.indexOf(ConfigProtos.Config.LoRaConfig.RegionCode.Unset.name)
|
||||
val unsetIndex = regions.indexOf(ConfigProtos.Config.LoRaConfig.RegionCode.UNSET.name)
|
||||
spinner.onItemSelectedListener = null
|
||||
|
||||
debug("current region is $region")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue