fix: RX stat labelling dependent on telemetry protocol (#3523)
* RX stat (formerly known as "RSSI") labeling dependent on protocol (RSSI/dbm, Rqly/%, Sgnl/-) used for range check, multi rf tuning and low/critical warning settings pages * chore: Bump libopenui * removed define that was supposed to be for testing only function getRxStatLabels(): wasting flash as inline, no need to be inlined * removed inline on getRxStatLabels() - step 2
This commit is contained in:
@@ -1796,7 +1796,8 @@ void menuModelSetup(event_t event)
|
|||||||
if (!title) break;
|
if (!title) break;
|
||||||
lcdDrawText(INDENT_WIDTH, y, title);
|
lcdDrawText(INDENT_WIDTH, y, title);
|
||||||
if (title == STR_MULTI_RFTUNE) {
|
if (title == STR_MULTI_RFTUNE) {
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT);
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, getRxStatLabels()->label, LEFT);
|
||||||
|
lcdDrawText(lcdLastRightPos, y, "(", LEFT);
|
||||||
lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT);
|
lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT);
|
||||||
lcdDrawText(lcdLastRightPos, y, ")", LEFT);
|
lcdDrawText(lcdLastRightPos, y, ")", LEFT);
|
||||||
}
|
}
|
||||||
@@ -2137,7 +2138,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
#if defined(PXX)
|
#if defined(PXX)
|
||||||
if (isModuleInRangeCheckMode()) {
|
if (isModuleInRangeCheckMode()) {
|
||||||
showMessageBox("RSSI: ");
|
showMessageBox(getRxStatLabels()->label);
|
||||||
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD);
|
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void menuModelTelemetry(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||||
lcdDrawTextAlignedLeft(y, getRssiLabel());
|
lcdDrawTextAlignedLeft(y, getRxStatLabels()->label);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
||||||
|
|||||||
@@ -1555,7 +1555,8 @@ void menuModelSetup(event_t event)
|
|||||||
if (!title) break;
|
if (!title) break;
|
||||||
lcdDrawText(INDENT_WIDTH, y, title);
|
lcdDrawText(INDENT_WIDTH, y, title);
|
||||||
if (title == STR_MULTI_RFTUNE) {
|
if (title == STR_MULTI_RFTUNE) {
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT);
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, getRxStatLabels()->label, LEFT);
|
||||||
|
lcdDrawText(lcdLastRightPos, y, "(", LEFT);
|
||||||
lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT);
|
lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT);
|
||||||
lcdDrawText(lcdLastRightPos, y, ")", LEFT);
|
lcdDrawText(lcdLastRightPos, y, ")", LEFT);
|
||||||
}
|
}
|
||||||
@@ -1850,7 +1851,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
#if defined(PXX)
|
#if defined(PXX)
|
||||||
if (isModuleInRangeCheckMode()) {
|
if (isModuleInRangeCheckMode()) {
|
||||||
showMessageBox("RSSI: ");
|
showMessageBox(getRxStatLabels()->label);
|
||||||
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD | LEFT);
|
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD | LEFT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void menuModelTelemetry(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||||
lcdDrawTextAlignedLeft(y, getRssiLabel());
|
lcdDrawTextAlignedLeft(y, getRxStatLabels()->label);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
||||||
|
|||||||
@@ -897,8 +897,8 @@ void ModelTelemetryPage::build(FormWindow * window)
|
|||||||
new StaticText(line, rect_t{}, STR_IGNORE_INSTANCE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_IGNORE_INSTANCE, 0, COLOR_THEME_PRIMARY1);
|
||||||
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_model.ignoreSensorIds));
|
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_model.ignoreSensorIds));
|
||||||
|
|
||||||
// RSSI
|
// RX stat
|
||||||
new Subtitle(window, rect_t{}, getRssiLabel(), 0, COLOR_THEME_PRIMARY1);
|
new Subtitle(window, rect_t{}, getRxStatLabels()->label, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
line = window->newLine(&grid);
|
line = window->newLine(&grid);
|
||||||
line->padLeft(10);
|
line->padLeft(10);
|
||||||
|
|||||||
@@ -527,23 +527,14 @@ void ModuleWindow::updateFailsafe()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBNV14)
|
|
||||||
#define SIGNAL_POSTFIX
|
|
||||||
#define SIGNAL_MESSAGE "SGNL"
|
|
||||||
#else
|
|
||||||
#define SIGNAL_POSTFIX " db"
|
|
||||||
#define SIGNAL_MESSAGE "RSSI"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ModuleWindow::startRSSIDialog(std::function<void()> closeHandler)
|
void ModuleWindow::startRSSIDialog(std::function<void()> closeHandler)
|
||||||
{
|
{
|
||||||
auto rssiDialog = new DynamicMessageDialog(
|
auto rssiDialog = new DynamicMessageDialog(
|
||||||
parent, STR_RANGE_TEST,
|
parent, STR_RANGE_TEST,
|
||||||
[=]() {
|
[=]() {
|
||||||
return std::to_string((int)TELEMETRY_RSSI()) +
|
return std::to_string((int)TELEMETRY_RSSI()) + getRxStatLabels()->unit;
|
||||||
std::string(SIGNAL_POSTFIX);
|
|
||||||
},
|
},
|
||||||
SIGNAL_MESSAGE, 50,
|
getRxStatLabels()->label, 50,
|
||||||
COLOR_THEME_SECONDARY1 | CENTERED | FONT(BOLD) | FONT(XL));
|
COLOR_THEME_SECONDARY1 | CENTERED | FONT(BOLD) | FONT(XL));
|
||||||
|
|
||||||
rssiDialog->setCloseHandler([this, closeHandler]() {
|
rssiDialog->setCloseHandler([this, closeHandler]() {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ MPMProtoOption::MPMProtoOption(FormGroup* form, FlexGridLayout *layout) :
|
|||||||
edit = new NumberEdit(box, rect_t{}, 0, 0, nullptr);
|
edit = new NumberEdit(box, rect_t{}, 0, 0, nullptr);
|
||||||
cb = new CheckBox(box, rect_t{}, nullptr, nullptr);
|
cb = new CheckBox(box, rect_t{}, nullptr, nullptr);
|
||||||
rssi = new DynamicNumber<uint16_t>(
|
rssi = new DynamicNumber<uint16_t>(
|
||||||
box, rect_t{}, [] { return (uint16_t)TELEMETRY_RSSI(); }, 0, "RSSI: ", " db");
|
box, rect_t{}, [] { return (uint16_t)TELEMETRY_RSSI(); }, 0, getRxStatLabels()->label, getRxStatLabels()->unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MPMProtoOption::update(const MultiRfProtocols::RfProto* rfProto, ModuleData* md)
|
void MPMProtoOption::update(const MultiRfProtocols::RfProto* rfProto, ModuleData* md)
|
||||||
@@ -137,8 +137,11 @@ void MPMProtoOption::update(const MultiRfProtocols::RfProto* rfProto, ModuleData
|
|||||||
edit->setSetValueHandler(SET_DEFAULT(md->multi.optionValue));
|
edit->setSetValueHandler(SET_DEFAULT(md->multi.optionValue));
|
||||||
lv_obj_clear_flag(edit->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(edit->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
edit->update();
|
edit->update();
|
||||||
if (title == STR_MULTI_RFTUNE)
|
if (title == STR_MULTI_RFTUNE) {
|
||||||
|
rssi->setPrefix(getRxStatLabels()->label);
|
||||||
|
rssi->setSuffix(getRxStatLabels()->unit);
|
||||||
lv_obj_clear_flag(rssi->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(rssi->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ static uint8_t intTelemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
|||||||
static uint8_t intTelemetryRxBufferCount;
|
static uint8_t intTelemetryRxBufferCount;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static rxStatStruct rxStat;
|
||||||
|
|
||||||
uint8_t * getTelemetryRxBuffer(uint8_t moduleIdx)
|
uint8_t * getTelemetryRxBuffer(uint8_t moduleIdx)
|
||||||
{
|
{
|
||||||
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
|
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
|
||||||
@@ -90,6 +92,60 @@ uint8_t &getTelemetryRxBufferCount(uint8_t moduleIdx)
|
|||||||
return telemetryRxBufferCount;
|
return telemetryRxBufferCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rxStatStruct *getRxStatLabels() {
|
||||||
|
// default to RSSI/db notation
|
||||||
|
rxStat.label = STR_RXSTAT_LABEL_RSSI;
|
||||||
|
rxStat.unit = STR_RXSTAT_UNIT_DBM;
|
||||||
|
|
||||||
|
// Currently we can only display a single rx stat in settings/telemetry.
|
||||||
|
// If both modules are used we choose the internal one
|
||||||
|
// TODO: have to rx stat sections in settings/telemetry
|
||||||
|
uint8_t moduleToUse = INTERNAL_MODULE;
|
||||||
|
|
||||||
|
if(g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_NONE &&
|
||||||
|
g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE) {
|
||||||
|
moduleToUse = EXTERNAL_MODULE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t moduleType = g_model.moduleData[moduleToUse].type;
|
||||||
|
|
||||||
|
switch(moduleType) {
|
||||||
|
case MODULE_TYPE_MULTIMODULE: {
|
||||||
|
uint8_t multiProtocol = g_model.moduleData[moduleToUse].multi.rfProtocol;
|
||||||
|
|
||||||
|
if (multiProtocol == MODULE_SUBTYPE_MULTI_FS_AFHDS2A ||
|
||||||
|
multiProtocol == MODULE_SUBTYPE_MULTI_HOTT ||
|
||||||
|
multiProtocol == MODULE_SUBTYPE_MULTI_MLINK) {
|
||||||
|
rxStat.label = STR_RXSTAT_LABEL_RQLY;
|
||||||
|
rxStat.unit = STR_RXSTAT_UNIT_PERCENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODULE_TYPE_CROSSFIRE:
|
||||||
|
case MODULE_TYPE_GHOST:
|
||||||
|
rxStat.label = STR_RXSTAT_LABEL_RQLY;
|
||||||
|
rxStat.unit = STR_RXSTAT_UNIT_PERCENT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODULE_TYPE_FLYSKY:
|
||||||
|
#if defined (PCBNV14)
|
||||||
|
extern uint32_t NV14internalModuleFwVersion;
|
||||||
|
|
||||||
|
if(moduleToUse == INTERNAL_MODULE) {
|
||||||
|
if(g_model.moduleData[INTERNAL_MODULE].subType == FLYSKY_SUBTYPE_AFHDS2A &&
|
||||||
|
NV14internalModuleFwVersion >= 0x1000E) {
|
||||||
|
rxStat.label = STR_RXSTAT_LABEL_SIGNAL;
|
||||||
|
rxStat.unit = STR_RXSTAT_UNIT_NOUNIT ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &rxStat;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: move to module port driver
|
// TODO: move to module port driver
|
||||||
//
|
//
|
||||||
// static int (*_telemetryGetByte)(void*, uint8_t*) = nullptr;
|
// static int (*_telemetryGetByte)(void*, uint8_t*) = nullptr;
|
||||||
|
|||||||
@@ -126,10 +126,12 @@ void frskyDSetDefault(int index, uint16_t id);
|
|||||||
#define IS_DISTANCE_UNIT(unit) ((unit) == UNIT_METERS || (unit) == UNIT_FEET)
|
#define IS_DISTANCE_UNIT(unit) ((unit) == UNIT_METERS || (unit) == UNIT_FEET)
|
||||||
#define IS_SPEED_UNIT(unit) ((unit) >= UNIT_KTS && (unit) <= UNIT_MPH)
|
#define IS_SPEED_UNIT(unit) ((unit) >= UNIT_KTS && (unit) <= UNIT_MPH)
|
||||||
|
|
||||||
inline const char* getRssiLabel()
|
typedef struct {
|
||||||
{
|
const char *label;
|
||||||
return "Rx-Stats";
|
const char *unit;
|
||||||
}
|
} rxStatStruct;
|
||||||
|
|
||||||
|
rxStatStruct *getRxStatLabels();
|
||||||
|
|
||||||
// TODO: this should handle only the external S.PORT line
|
// TODO: this should handle only the external S.PORT line
|
||||||
// - and go away in the end: one proto per module, not global!
|
// - and go away in the end: one proto per module, not global!
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 9ade7c39af...f828307f12
@@ -322,6 +322,15 @@
|
|||||||
#define STR_SENSOR_SERVO_STATUS "SrvS"
|
#define STR_SENSOR_SERVO_STATUS "SrvS"
|
||||||
#define STR_SENSOR_SPECIAL "Spcl"
|
#define STR_SENSOR_SPECIAL "Spcl"
|
||||||
|
|
||||||
|
// RX stat labeling for settings/telemetry, range
|
||||||
|
// check and internal/external module setup screens
|
||||||
|
#define STR_RXSTAT_LABEL_RSSI "RSSI "
|
||||||
|
#define STR_RXSTAT_LABEL_RQLY "Rqly "
|
||||||
|
#define STR_RXSTAT_LABEL_SIGNAL "Sgnl "
|
||||||
|
#define STR_RXSTAT_UNIT_PERCENT " %"
|
||||||
|
#define STR_RXSTAT_UNIT_DBM " db"
|
||||||
|
#define STR_RXSTAT_UNIT_NOUNIT ""
|
||||||
|
|
||||||
#define STR_CHAR_RIGHT "\302\200"
|
#define STR_CHAR_RIGHT "\302\200"
|
||||||
#define STR_CHAR_LEFT "\302\201"
|
#define STR_CHAR_LEFT "\302\201"
|
||||||
#define STR_CHAR_UP "\302\202"
|
#define STR_CHAR_UP "\302\202"
|
||||||
|
|||||||
Reference in New Issue
Block a user