diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index 14519b84c..cfe9c7631 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -793,6 +793,32 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att) } } +void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att) +{ + float power_W_PREC1 = pow(10.0, (dBm - 30.0) / 10.0) * 10; + if (dBm >= 30) { + lcdDrawNumber(x, y, power_W_PREC1, PREC1 | att); + lcdDrawText(lcdNextPos, y, "W", att); + } + else if (dBm < 10) { + uint16_t power_MW_PREC1 = round(power_W_PREC1 * 1000); + lcdDrawNumber(x, y, power_MW_PREC1, PREC1 | att); + lcdDrawText(lcdNextPos, y, "mW", att); + } + else { + uint16_t power_MW = round(power_W_PREC1 * 100); + if (power_MW >= 50) { + power_MW = (power_MW / 5) * 5; + lcdDrawNumber(x, y, power_MW, att); + lcdDrawText(lcdNextPos, y, "mW", att); + } + else { + lcdDrawNumber(x, y, power_MW, att); + lcdDrawText(lcdNextPos, y, "mW", att); + } + } +} + void drawSwitch(coord_t x, coord_t y, swsrc_t idx, LcdFlags flags) { char s[8]; diff --git a/radio/src/gui/128x64/lcd.h b/radio/src/gui/128x64/lcd.h index b10b4481a..a10b916fa 100644 --- a/radio/src/gui/128x64/lcd.h +++ b/radio/src/gui/128x64/lcd.h @@ -134,6 +134,7 @@ void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val); void drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags att=0); void putsModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att); +void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att = 0); #if !defined(BOOT) // TODO not here ... void drawSwitch(coord_t x, coord_t y, swsrc_t swtch, LcdFlags att=0); void drawSource(coord_t x, coord_t y, mixsrc_t idx, LcdFlags att=0); diff --git a/radio/src/gui/128x64/model_module_options.cpp b/radio/src/gui/128x64/model_module_options.cpp index 48ad2e296..45fb3dda1 100644 --- a/radio/src/gui/128x64/model_module_options.cpp +++ b/radio/src/gui/128x64/model_module_options.cpp @@ -47,32 +47,6 @@ enum { #define IF_MODULE_OPTIONS(option, count) uint8_t(isModuleOptionAvailable(modelId, option) ? count : HIDDEN_ROW) -void drawPower(coord_t x, coord_t y, int8_t dBm) -{ - float power_W_PREC1 = pow(10.0, (dBm - 30.0) / 10.0) * 10; - if (dBm >= 30) { - lcdDrawNumber(x, y, power_W_PREC1, PREC1); - lcdDrawText(lcdNextPos, y, "W"); - } - else if (dBm < 10) { - uint16_t power_MW_PREC1 = round(power_W_PREC1 * 1000); - lcdDrawNumber(x, y, power_MW_PREC1, PREC1); - lcdDrawText(lcdNextPos, y, "mW"); - } - else { - uint16_t power_MW = round(power_W_PREC1 * 100); - if (power_MW >= 50) { - power_MW = (power_MW / 5) * 5; - lcdDrawNumber(x, y, power_MW); - lcdDrawText(lcdNextPos, y, "mW"); - } - else { - lcdDrawNumber(x, y, power_MW); - lcdDrawText(lcdNextPos, y, "mW"); - } - } -} - bool isPowerAvailable(int value) { uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID; diff --git a/radio/src/gui/common/stdlcd/radio_power_meter.cpp b/radio/src/gui/common/stdlcd/radio_power_meter.cpp index 7237f4531..948c73eee 100644 --- a/radio/src/gui/common/stdlcd/radio_power_meter.cpp +++ b/radio/src/gui/common/stdlcd/radio_power_meter.cpp @@ -63,9 +63,12 @@ void menuRadioPowerMeter(event_t event) } // The warning - char warning[20]; - strAppend(strAppendSigned(strAppend(warning, "Max "), -10 + 10 * reusableBuffer.powerMeter.attn), "dBm"); - lcdDrawCenteredText(FH + 3, warning, BOLD); + lcdDrawText(10, FH + 3, "Max : ", BOLD ); + lcdDrawNumber(lcdLastRightPos, FH + 3, -10 + 10 * reusableBuffer.powerMeter.attn, BOLD); + lcdDrawText(lcdLastRightPos, FH + 3, "dBm ", BOLD ); + lcdDrawText(lcdLastRightPos, FH + 3, "(",BOLD ); + drawPower(lcdLastRightPos, FH + 3, -10 + 10 * reusableBuffer.powerMeter.attn, BOLD); + lcdDrawText(lcdLastRightPos, FH + 3, ")", BOLD); for (uint8_t i=0; i 0 ? INVERS | BLINK : INVERS) : 0);