Add MEDIUM_TURBO modem preset (#10988)
* Protobufs * Wire up MEDIUM_TURBO modem preset MEDIUM_TURBO (500 kHz, SF9, CR 4/5) already existed in the protobuf enum but was never wired into firmware, so selecting it silently fell through to the LONG_FAST default and rendered an "Invalid" display name. Add its bw/sf/cr mapping (modemPresetToParams), display name (MediumTurbo/MedT), PRESETS_STD membership (standard regions only — 500 kHz does not fit EU868's 250 kHz band, so it stays out of PRESETS_EU_868 and is rejected/clamped there), and the MEDIUM SNR-grading bucket. Includes positive coverage in test_radio, EU868-reject + US-accept coverage in test_admin_radio and test_mesh_beacon, the STD preset count 9->10, an extended fuzz range, and the client-spec doc. * Address review feedback on MEDIUM_TURBO tests - test_mesh_beacon: assert has_mesh_beacon before checking the invalid preset was cleared, so the EU868-cleared test can't pass on a dropped message (matches the existing SHORT_TURBO test). - test_fuzz_packets: draw modem presets from _ModemPreset_ARRAYSIZE instead of a hard-coded 17 so the fuzz range tracks future enum additions automatically.
This commit is contained in:
@@ -251,6 +251,44 @@ static void test_adminValidation_turboPresetOnUS_isAccepted(void)
|
||||
TEST_ASSERT_EQUAL(meshtastic_Config_LoRaConfig_ModemPreset_SHORT_TURBO, moduleConfig.mesh_beacon.broadcast_on_preset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify MEDIUM_TURBO is also cleared for EU_868. Like SHORT_TURBO/LONG_TURBO it is a 500 kHz preset
|
||||
* that does not fit EU_868's 250 kHz band, so it must not survive admin validation there.
|
||||
*/
|
||||
static void test_adminValidation_mediumTurboPresetOnEU868_isCleared(void)
|
||||
{
|
||||
resetConfig();
|
||||
|
||||
meshtastic_ModuleConfig_MeshBeaconConfig bcfg = meshtastic_ModuleConfig_MeshBeaconConfig_init_zero;
|
||||
bcfg.has_broadcast_on_preset = true;
|
||||
bcfg.broadcast_on_preset = meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_TURBO;
|
||||
|
||||
testAdmin->handleSetModuleConfig(makeBeaconModuleConfig(bcfg));
|
||||
|
||||
TEST_ASSERT_TRUE(moduleConfig.has_mesh_beacon);
|
||||
TEST_ASSERT_FALSE(moduleConfig.mesh_beacon.has_broadcast_on_preset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify MEDIUM_TURBO passes validation for US (PROFILE_STD allows the full turbo family).
|
||||
* The same 500 kHz preset that is illegal in EU_868 must be preserved in permissive regions.
|
||||
*/
|
||||
static void test_adminValidation_mediumTurboPresetOnUS_isAccepted(void)
|
||||
{
|
||||
resetConfig();
|
||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_US;
|
||||
initRegion();
|
||||
|
||||
meshtastic_ModuleConfig_MeshBeaconConfig bcfg = meshtastic_ModuleConfig_MeshBeaconConfig_init_zero;
|
||||
bcfg.has_broadcast_on_preset = true;
|
||||
bcfg.broadcast_on_preset = meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_TURBO;
|
||||
|
||||
testAdmin->handleSetModuleConfig(makeBeaconModuleConfig(bcfg));
|
||||
|
||||
TEST_ASSERT_TRUE(moduleConfig.mesh_beacon.has_broadcast_on_preset);
|
||||
TEST_ASSERT_EQUAL(meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_TURBO, moduleConfig.mesh_beacon.broadcast_on_preset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify an out-of-range region code (255) is sanitised to UNSET rather than stored verbatim.
|
||||
* Important to prevent invalid proto enum values from reaching the broadcaster and being broadcast
|
||||
@@ -1360,6 +1398,8 @@ BEACON_TEST_ENTRY void setup()
|
||||
RUN_TEST(test_adminValidation_turboPresetOnEU868_isCleared);
|
||||
RUN_TEST(test_adminValidation_longTurboPresetOnEU868_isCleared);
|
||||
RUN_TEST(test_adminValidation_turboPresetOnUS_isAccepted);
|
||||
RUN_TEST(test_adminValidation_mediumTurboPresetOnEU868_isCleared);
|
||||
RUN_TEST(test_adminValidation_mediumTurboPresetOnUS_isAccepted);
|
||||
RUN_TEST(test_adminValidation_unknownOfferRegion_isCleared);
|
||||
RUN_TEST(test_adminValidation_validOfferRegion_isPreserved);
|
||||
RUN_TEST(test_adminValidation_targetUnknownRegion_isCleared);
|
||||
|
||||
Reference in New Issue
Block a user