mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 09:42:35 +00:00
Don't need to check all channels if not using default frequency slot
This commit is contained in:
parent
b45a912409
commit
cb7407e06b
@ -257,8 +257,8 @@ const char *Channels::getName(size_t chIndex)
|
||||
|
||||
bool Channels::hasDefaultChannel()
|
||||
{
|
||||
// If we don't use a preset or we override the frequency, we don't have a default channel
|
||||
if (!config.lora.use_preset || config.lora.override_frequency)
|
||||
// If we don't use a preset or the default frequency slot, or we override the frequency, we don't have a default channel
|
||||
if (!config.lora.use_preset || !RadioInterface::uses_default_frequency_slot || config.lora.override_frequency)
|
||||
return false;
|
||||
// Check if any of the channels are using the default name and PSK
|
||||
for (size_t i = 0; i < getNumChannels(); i++) {
|
||||
@ -266,8 +266,8 @@ bool Channels::hasDefaultChannel()
|
||||
if (ch.settings.psk.size == 1 && ch.settings.psk.bytes[0] == 1) {
|
||||
const char *name = getName(i);
|
||||
const char *presetName = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, false);
|
||||
// Check if the name is the default derived from the modem preset and we use the default frequency slot
|
||||
if (strcmp(name, presetName) == 0 && RadioInterface::uses_default_frequency_slot)
|
||||
// Check if the name is the default derived from the modem preset
|
||||
if (strcmp(name, presetName) == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user