fix channel settings

master
andrekir 2022-09-18 20:23:34 -03:00
rodzic 5382fdae49
commit 99dc509b6f
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -42,8 +42,8 @@ data class Channel(
else when (loraConfig.modemPreset) {
ModemPreset.SHORT_FAST -> "ShortFast"
ModemPreset.SHORT_SLOW -> "ShortSlow"
ModemPreset.MEDIUM_FAST -> "MidFast"
ModemPreset.MEDIUM_SLOW -> "MidSlow"
ModemPreset.MEDIUM_FAST -> "MediumFast"
ModemPreset.MEDIUM_SLOW -> "MediumSlow"
ModemPreset.LONG_FAST -> "LongFast"
ModemPreset.LONG_SLOW -> "LongSlow"
ModemPreset.VERY_LONG_SLOW -> "VLongSlow"

Wyświetl plik

@ -177,7 +177,7 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
) {
val newSet = ChannelSet(
channelSet {
settings[0] = newChannel
settings.add(newChannel)
loraConfig = newLoRaConfig
})
// Try to change the radio, if it fails, tell the user why and throw away their edits
@ -303,7 +303,7 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
val random = SecureRandom()
val bytes = ByteArray(32)
random.nextBytes(bytes)
newSettings.copy {
newSettings = newSettings.copy {
name = newName.take(11) // proto max_size:12
psk = ByteString.copyFrom(bytes)
}

Wyświetl plik

@ -8,10 +8,10 @@ class ChannelSetTest {
/** make sure we match the python and device code behavior */
@Test
fun matchPython() {
val url = Uri.parse("https://www.meshtastic.org/e/#CgUiAQEYAg")
val url = Uri.parse("https://www.meshtastic.org/e/#CgUYAiIBAQ")
val cs = ChannelSet(url)
Assert.assertEquals("LongFast", cs.primaryChannel!!.name)
Assert.assertEquals("#LongFast-I", cs.primaryChannel!!.humanName)
Assert.assertEquals("#LongFast-K", cs.primaryChannel!!.humanName)
Assert.assertEquals(url, cs.getChannelUrl(false))
}
}