mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
dBm / mW converstion and display
This commit is contained in:
parent
dce77f7c5b
commit
f48d6548c5
1 changed files with 8 additions and 2 deletions
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <opentx.h>
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN 80
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN 60
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
|
@ -62,6 +62,10 @@ const uint8_t moduleOptions[] = {
|
|||
|
||||
#define IF_MODULE_OPTIONS(option, count) uint8_t((moduleOptions[modelId] & (1 << option)) ? count : HIDDEN_ROW)
|
||||
|
||||
int16_t convertDBMtoMW(int8_t dBm) {
|
||||
return pow( 10.0, (dBm - 30.0) / 10.0) * 1000;
|
||||
}
|
||||
|
||||
void menuModelModuleOptions(event_t event)
|
||||
{
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
|
||||
|
@ -156,7 +160,9 @@ void menuModelModuleOptions(event_t event)
|
|||
case ITEM_MODULE_SETTINGS_POWER:
|
||||
lcdDrawText(0, y, "Power");
|
||||
lcdDrawNumber(RECEIVER_OPTIONS_2ND_COLUMN, y, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, attr);
|
||||
lcdDrawText(lcdNextPos, y, "dBm");
|
||||
lcdDrawText(lcdNextPos, y, "dBm(");
|
||||
lcdDrawNumber(lcdNextPos, y, convertDBMtoMW(reusableBuffer.hardwareAndSettings.moduleSettings.txPower), 0);
|
||||
lcdDrawText(lcdNextPos, y, "mW)");
|
||||
if (attr) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.txPower = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, -127, 127);
|
||||
if (checkIncDec_Ret) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue