mirror of
https://github.com/meshtastic/firmware.git
synced 2026-06-08 08:45:59 -04:00
Fix for ITU 2/3 split
This commit is contained in:
@@ -177,12 +177,13 @@ void menuHandler::OnboardMessage()
|
||||
void menuHandler::LoraRegionPicker(uint32_t duration)
|
||||
{
|
||||
#ifdef HAS_HAM_2M_ONLY
|
||||
// Hardware is restricted to the amateur 2m band — offer only the two 2m regions
|
||||
// Hardware is restricted to the amateur 2m band — offer only the 2m regions
|
||||
// so the user cannot pick a sub-GHz region the RF path cannot emit or receive.
|
||||
static const LoraRegionOption regionOptions[] = {
|
||||
{"Back", OptionsAction::Back},
|
||||
{"ITU1_2M (144-146)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU1_2M},
|
||||
{"ITU23_2M (144-148)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU23_2M},
|
||||
{"ITU2_2M (144-148)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU2_2M},
|
||||
{"ITU3_2M (144-148)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU3_2M},
|
||||
};
|
||||
#else
|
||||
static const LoraRegionOption regionOptions[] = {
|
||||
@@ -215,7 +216,9 @@ void menuHandler::LoraRegionPicker(uint32_t duration)
|
||||
{"KZ_863", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_KZ_863},
|
||||
{"NP_865", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_NP_865},
|
||||
{"BR_902", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_BR_902},
|
||||
|
||||
{"ITU1_2M (144-146)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU1_2M},
|
||||
{"ITU2_2M (144-148)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU2_2M},
|
||||
{"ITU3_2M (144-148)", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ITU3_2M},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -783,6 +783,18 @@ void InkHUD::MenuApplet::execute(MenuItem item)
|
||||
case SET_REGION_NARROW_868:
|
||||
applyLoRaRegion(meshtastic_Config_LoRaConfig_RegionCode_EU_N_868);
|
||||
break;
|
||||
|
||||
case SET_REGION_ITU1_2M:
|
||||
applyLoRaRegion(meshtastic_Config_LoRaConfig_RegionCode_ITU1_2M);
|
||||
break;
|
||||
|
||||
case SET_REGION_ITU2_2M:
|
||||
applyLoRaRegion(meshtastic_Config_LoRaConfig_RegionCode_ITU2_2M);
|
||||
break;
|
||||
|
||||
case SET_REGION_ITU3_2M:
|
||||
applyLoRaRegion(meshtastic_Config_LoRaConfig_RegionCode_ITU3_2M);
|
||||
break;
|
||||
|
||||
// Roles
|
||||
case SET_ROLE_CLIENT:
|
||||
@@ -1469,6 +1481,9 @@ void InkHUD::MenuApplet::showPage(MenuPage page)
|
||||
items.push_back(MenuItem("KZ 863", MenuAction::SET_REGION_KZ_863, MenuPage::EXIT));
|
||||
items.push_back(MenuItem("NP 865", MenuAction::SET_REGION_NP_865, MenuPage::EXIT));
|
||||
items.push_back(MenuItem("BR 902", MenuAction::SET_REGION_BR_902, MenuPage::EXIT));
|
||||
items.push_back(MenuItem("ITU1_2M (144-146)", MenuAction::SET_REGION_ITU1_2M, MenuPage::EXIT));
|
||||
items.push_back(MenuItem("ITU2_2M (144-148)", MenuAction::SET_REGION_ITU2_2M, MenuPage::EXIT));
|
||||
items.push_back(MenuItem("ITU3_2M (144-148)", MenuAction::SET_REGION_ITU3_2M, MenuPage::EXIT));
|
||||
items.push_back(MenuItem("Exit", MenuPage::EXIT));
|
||||
break;
|
||||
|
||||
|
||||
@@ -234,10 +234,16 @@ const RegionInfo regions[] = {
|
||||
RDEF(ITU1_2M, 144.0f, 146.0f, 100, 30, false, false, PROFILE_HAM, PRESET(NARROW_FAST)),
|
||||
|
||||
/*
|
||||
ITU Region 2 (Americas) and Region 3 (Asia/Pacific) amateur 2m allocation: 144.000 - 148.000 MHz.
|
||||
ITU Region 2 (Americas) amateur 2m allocation: 144.000 - 148.000 MHz.
|
||||
Typical admin rules (e.g. US FCC Part 97) allow well above 30 dBm for licensed operators.
|
||||
*/
|
||||
RDEF(ITU23_2M, 144.0f, 148.0f, 100, 30, false, false, PROFILE_HAM, PRESET(NARROW_FAST)),
|
||||
RDEF(ITU2_2M, 144.0f, 148.0f, 100, 30, false, false, PROFILE_HAM, PRESET(NARROW_FAST)),
|
||||
|
||||
/*
|
||||
ITU Region 3 (Asia/Pacific) amateur 2m allocation: 144.000 - 148.000 MHz.
|
||||
Typical admin rules allow well above 30 dBm for licensed operators.
|
||||
*/
|
||||
RDEF(ITU3_2M, 144.0f, 148.0f, 100, 30, false, false, PROFILE_HAM, PRESET(NARROW_FAST)),
|
||||
|
||||
/*
|
||||
2.4 GHZ WLAN Band equivalent. Only for SX128x chips.
|
||||
@@ -554,7 +560,8 @@ std::unique_ptr<RadioInterface> initLoRa()
|
||||
// and boards without 2m support must not run one. In either mismatch, drop to UNSET so the
|
||||
// first-start picker runs and the user re-selects a legal region for the hardware.
|
||||
const bool is2mRegion = config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_ITU1_2M ||
|
||||
config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_ITU23_2M;
|
||||
config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_ITU2_2M ||
|
||||
config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_ITU3_2M;
|
||||
#ifdef HAS_HAM_2M_ONLY
|
||||
const bool mismatch = !is2mRegion && config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET;
|
||||
#else
|
||||
@@ -882,7 +889,8 @@ bool RadioInterface::validateConfigRegion(const meshtastic_Config_LoRaConfig &lo
|
||||
}
|
||||
|
||||
const bool is2mRegion = loraConfig.region == meshtastic_Config_LoRaConfig_RegionCode_ITU1_2M ||
|
||||
loraConfig.region == meshtastic_Config_LoRaConfig_RegionCode_ITU23_2M;
|
||||
loraConfig.region == meshtastic_Config_LoRaConfig_RegionCode_ITU2_2M ||
|
||||
loraConfig.region == meshtastic_Config_LoRaConfig_RegionCode_ITU3_2M;
|
||||
|
||||
#ifdef HAS_HAM_2M_ONLY
|
||||
// This hardware's front-end / band-pass filter only passes 144-148 MHz. Any other region
|
||||
@@ -897,7 +905,7 @@ bool RadioInterface::validateConfigRegion(const meshtastic_Config_LoRaConfig &lo
|
||||
}
|
||||
#else
|
||||
// Conversely, the 2m ham regions are illegal RF output for hardware not designed for that band
|
||||
// (e.g. selecting ITU23_2M on a 915 MHz node would transmit at ~3x the expected frequency with
|
||||
// (e.g. selecting ITU2_2M on a 915 MHz node would transmit at ~3x the expected frequency with
|
||||
// an untuned antenna and filter). Refuse the selection entirely.
|
||||
if (is2mRegion) {
|
||||
char err_string[160];
|
||||
|
||||
Reference in New Issue
Block a user