mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-12 08:42:01 -04:00
feat: prevent QR imports from overriding local TX power (#3845)
This commit is contained in:
@@ -95,7 +95,16 @@ fun ScannedQrCodeDialog(
|
||||
val channelSet =
|
||||
remember(shouldReplace) {
|
||||
if (shouldReplace) {
|
||||
incoming.copy { loraConfig = loraConfig.copy { configOkToMqtt = channels.loraConfig.configOkToMqtt } }
|
||||
// When replacing, apply the incoming LoRa configuration but preserve certain
|
||||
// locally safe fields such as MQTT flags and TX power. This prevents QR codes
|
||||
// from unintentionally overriding device-specific power limits (e.g. E22 caps).
|
||||
incoming.copy {
|
||||
loraConfig =
|
||||
loraConfig.copy {
|
||||
configOkToMqtt = channels.loraConfig.configOkToMqtt
|
||||
txPower = channels.loraConfig.txPower
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channels.copy {
|
||||
// To guarantee consistent ordering, using a LinkedHashSet which iterates through
|
||||
@@ -158,9 +167,6 @@ fun ScannedQrCodeDialog(
|
||||
if (current.txEnabled != new.txEnabled) {
|
||||
changes.add("Transmit Enabled: ${current.txEnabled} -> ${new.txEnabled}")
|
||||
}
|
||||
if (current.txPower != new.txPower) {
|
||||
changes.add("Transmit Power: ${current.txPower}dBm -> ${new.txPower}dBm")
|
||||
}
|
||||
if (current.channelNum != new.channelNum) {
|
||||
changes.add("Channel Number: ${current.channelNum} -> ${new.channelNum}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user