From db6252ee79db37b9807ff4c5f58f4d7c2e4fe703 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 27 Mar 2019 13:44:40 +0100 Subject: [PATCH] isPowerAvailable prototype --- radio/src/gui/128x64/model_module_options.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/128x64/model_module_options.cpp b/radio/src/gui/128x64/model_module_options.cpp index 3c95fed8b..4efaf71cc 100644 --- a/radio/src/gui/128x64/model_module_options.cpp +++ b/radio/src/gui/128x64/model_module_options.cpp @@ -89,11 +89,24 @@ void drawPower(coord_t x, coord_t y, int8_t dBm) } } -void menuModelModuleOptions(event_t event) +bool isPowerAvailable(int value) { uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID; uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant; + return (value == 10 /* 10 mW */ || + value == 14 /* 25 mW */ || + value == 20 /* 100 mW */ || + value == 23 /* 200 mW */ || + value == 27 /* 500 mW */ || + value == 30 /* 1000 mW */); +} + +void menuModelModuleOptions(event_t event) +{ + uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID; + // uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant; + SUBMENU_NOTITLE(ITEM_MODULE_SETTINGS_COUNT, { IF_MODULE_OPTIONS(0, 0), IF_MODULE_OPTIONS(1, 0), @@ -187,7 +200,7 @@ void menuModelModuleOptions(event_t event) drawPower(lcdNextPos, y, reusableBuffer.hardwareAndSettings.moduleSettings.txPower); lcdDrawText(lcdNextPos, y, ")"); if (attr) { - reusableBuffer.hardwareAndSettings.moduleSettings.txPower = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, 0, 30); + reusableBuffer.hardwareAndSettings.moduleSettings.txPower = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, 0, 30, 0, &isPowerAvailable); if (checkIncDec_Ret) { reusableBuffer.hardwareAndSettings.moduleSettings.dirty = true; }