Skip to content

Commit

Permalink
DJI OSD patch add warnings/LQ/RSSI-Dbm
Browse files Browse the repository at this point in the history
  • Loading branch information
howels committed Nov 20, 2021
1 parent 6ecd0d2 commit a872c15
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/osd/osd_elements.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ static void osdElementLinkQuality(osdElementParms_t *element)
if (linkQualitySource == LQ_SOURCE_RX_PROTOCOL_CRSF) { // 0-99
osdLinkQuality = rxGetLinkQuality();
const uint8_t osdRfMode = rxGetRfMode();
tfp_sprintf(element->buff, "%c%1d:%2d", SYM_LINK_QUALITY, osdRfMode, osdLinkQuality);
tfp_sprintf(element->buff, "LQ %1d:%03d %3d", osdRfMode, osdLinkQuality, getRssiDbm());
} else if (linkQualitySource == LQ_SOURCE_RX_PROTOCOL_GHST) { // 0-100
osdLinkQuality = rxGetLinkQuality();
tfp_sprintf(element->buff, "%c%2d", SYM_LINK_QUALITY, osdLinkQuality);
Expand All @@ -1131,7 +1131,7 @@ static void osdElementLinkQuality(osdElementParms_t *element)
if (osdLinkQuality >= 10) {
osdLinkQuality = 9;
}
tfp_sprintf(element->buff, "%c%1d", SYM_LINK_QUALITY, osdLinkQuality);
tfp_sprintf(element->buff, "LQ %1d", osdLinkQuality);
}
}
#endif // USE_RX_LINK_QUALITY_INFO
Expand Down Expand Up @@ -1474,6 +1474,18 @@ static void osdElementWarnings(osdElementParms_t *element)
}
}

static void osdElementWarnings2(osdElementParms_t *element)
{
osdElementWarnings(element);

if (strlen(element->buff) == 0) {
osdElementLinkQuality(element);
}

strncpy(pilotConfigMutable()->name, element->buff, 12);
return;
}

// Define the order in which the elements are drawn.
// Elements positioned later in the list will overlay the earlier
// ones if their character positions overlap
Expand Down Expand Up @@ -1590,7 +1602,7 @@ const osdElementDrawFn osdElementDrawFunction[OSD_ITEM_COUNT] = {
[OSD_YAW_PIDS] = osdElementPidsYaw,
[OSD_POWER] = osdElementPower,
[OSD_PIDRATE_PROFILE] = osdElementPidRateProfile,
[OSD_WARNINGS] = osdElementWarnings,
[OSD_WARNINGS] = osdElementWarnings2,
[OSD_AVG_CELL_VOLTAGE] = osdElementAverageCellVoltage,
#ifdef USE_GPS
[OSD_GPS_LON] = osdElementGpsCoordinate,
Expand Down

0 comments on commit a872c15

Please sign in to comment.