mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(LoRaConfig): add hasPaFan validation
This commit is contained in:
parent
98d11115c6
commit
21c1c1cbd6
3 changed files with 21 additions and 8 deletions
|
|
@ -102,6 +102,15 @@ class RadioConfigViewModel @Inject constructor(
|
|||
val myNodeNum get() = myNodeInfo.value?.myNodeNum
|
||||
val maxChannels get() = myNodeInfo.value?.maxChannels ?: 8
|
||||
|
||||
val hasPaFan: Boolean
|
||||
get() = destNode.value?.user?.hwModel in setOf(
|
||||
null,
|
||||
MeshProtos.HardwareModel.UNSET,
|
||||
MeshProtos.HardwareModel.BETAFPV_2400_TX,
|
||||
MeshProtos.HardwareModel.RADIOMASTER_900_BANDIT_NANO,
|
||||
MeshProtos.HardwareModel.RADIOMASTER_900_BANDIT,
|
||||
)
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
debug("RadioConfigViewModel cleared")
|
||||
|
|
|
|||
|
|
@ -471,7 +471,8 @@ fun RadioConfigNavHost(
|
|||
onSaveClicked = { loraInput ->
|
||||
val config = config { lora = loraInput }
|
||||
viewModel.setRemoteConfig(destNum, config)
|
||||
}
|
||||
},
|
||||
hasPaFan = viewModel.hasPaFan,
|
||||
)
|
||||
}
|
||||
composable(ConfigRoute.BLUETOOTH.name) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ fun LoRaConfigItemList(
|
|||
primarySettings: ChannelSettings,
|
||||
enabled: Boolean,
|
||||
onSaveClicked: (LoRaConfig) -> Unit,
|
||||
hasPaFan: Boolean = false,
|
||||
) {
|
||||
val focusManager = LocalFocusManager.current
|
||||
var loraInput by rememberSaveable { mutableStateOf(loraConfig) }
|
||||
|
|
@ -184,14 +185,16 @@ fun LoRaConfigItemList(
|
|||
onValueChanged = { loraInput = loraInput.copy { overrideFrequency = it } })
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "PA fan disabled",
|
||||
checked = loraInput.paFanDisabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { paFanDisabled = it } })
|
||||
if (hasPaFan) {
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "PA fan disabled",
|
||||
checked = loraInput.paFanDisabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { paFanDisabled = it } })
|
||||
}
|
||||
item { Divider() }
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Ignore MQTT",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue