mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Use coloured fonts if supported (#13005)
This commit is contained in:
parent
5d29a0be06
commit
fb9587b2ec
3 changed files with 27 additions and 7 deletions
|
@ -1498,13 +1498,18 @@ static void osdElementRtcTime(osdElementParms_t *element)
|
||||||
static void osdElementRssiDbm(osdElementParms_t *element)
|
static void osdElementRssiDbm(osdElementParms_t *element)
|
||||||
{
|
{
|
||||||
const int8_t antenna = getActiveAntenna();
|
const int8_t antenna = getActiveAntenna();
|
||||||
|
const int16_t osdRssiDbm = getRssiDbm();
|
||||||
static bool diversity = false;
|
static bool diversity = false;
|
||||||
|
|
||||||
|
if (osdRssiDbm < osdConfig()->rssi_dbm_alarm) {
|
||||||
|
element->attr = DISPLAYPORT_SEVERITY_CRITICAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (antenna || diversity) {
|
if (antenna || diversity) {
|
||||||
diversity = true;
|
diversity = true;
|
||||||
tfp_sprintf(element->buff, "%c%3d:%d", SYM_RSSI, getRssiDbm(), antenna + 1);
|
tfp_sprintf(element->buff, "%c%3d:%d", SYM_RSSI, osdRssiDbm, antenna + 1);
|
||||||
} else {
|
} else {
|
||||||
tfp_sprintf(element->buff, "%c%3d", SYM_RSSI, getRssiDbm());
|
tfp_sprintf(element->buff, "%c%3d", SYM_RSSI, osdRssiDbm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // USE_RX_RSSI_DBM
|
#endif // USE_RX_RSSI_DBM
|
||||||
|
@ -2144,6 +2149,14 @@ void osdUpdateAlarms(void)
|
||||||
CLR_BLINK(OSD_RSSI_VALUE);
|
CLR_BLINK(OSD_RSSI_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_RX_RSSI_DBM
|
||||||
|
if (getRssiDbm() < osdConfig()->rssi_dbm_alarm) {
|
||||||
|
SET_BLINK(OSD_RSSI_DBM_VALUE);
|
||||||
|
} else {
|
||||||
|
CLR_BLINK(OSD_RSSI_DBM_VALUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RX_LINK_QUALITY_INFO
|
#ifdef USE_RX_LINK_QUALITY_INFO
|
||||||
if (rxGetLinkQualityPercent() < osdConfig()->link_quality_alarm) {
|
if (rxGetLinkQualityPercent() < osdConfig()->link_quality_alarm) {
|
||||||
SET_BLINK(OSD_LINK_QUALITY);
|
SET_BLINK(OSD_LINK_QUALITY);
|
||||||
|
|
|
@ -173,7 +173,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
// RSSI
|
// RSSI
|
||||||
if (osdWarnGetState(OSD_WARNING_RSSI) && (getRssiPercent() < osdConfig()->rssi_alarm)) {
|
if (osdWarnGetState(OSD_WARNING_RSSI) && (getRssiPercent() < osdConfig()->rssi_alarm)) {
|
||||||
tfp_sprintf(warningText, "RSSI LOW");
|
tfp_sprintf(warningText, "RSSI LOW");
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
*displayAttr = DISPLAYPORT_SEVERITY_CRITICAL;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
// rssi dbm
|
// rssi dbm
|
||||||
if (osdWarnGetState(OSD_WARNING_RSSI_DBM) && (getRssiDbm() < osdConfig()->rssi_dbm_alarm)) {
|
if (osdWarnGetState(OSD_WARNING_RSSI_DBM) && (getRssiDbm() < osdConfig()->rssi_dbm_alarm)) {
|
||||||
tfp_sprintf(warningText, "RSSI DBM");
|
tfp_sprintf(warningText, "RSSI DBM");
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
*displayAttr = DISPLAYPORT_SEVERITY_CRITICAL;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
// rsnr
|
// rsnr
|
||||||
if (osdWarnGetState(OSD_WARNING_RSNR) && (getRsnr() < osdConfig()->rsnr_alarm)) {
|
if (osdWarnGetState(OSD_WARNING_RSNR) && (getRsnr() < osdConfig()->rsnr_alarm)) {
|
||||||
tfp_sprintf(warningText, "RSNR LOW");
|
tfp_sprintf(warningText, "RSNR LOW");
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
*displayAttr = DISPLAYPORT_SEVERITY_CRITICAL;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
// Link Quality
|
// Link Quality
|
||||||
if (osdWarnGetState(OSD_WARNING_LINK_QUALITY) && (rxGetLinkQualityPercent() < osdConfig()->link_quality_alarm)) {
|
if (osdWarnGetState(OSD_WARNING_LINK_QUALITY) && (rxGetLinkQualityPercent() < osdConfig()->link_quality_alarm)) {
|
||||||
tfp_sprintf(warningText, "LINK QUALITY");
|
tfp_sprintf(warningText, "LINK QUALITY");
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
*displayAttr = DISPLAYPORT_SEVERITY_CRITICAL;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,14 @@
|
||||||
|
|
||||||
#if defined(USE_MSP_DISPLAYPORT)
|
#if defined(USE_MSP_DISPLAYPORT)
|
||||||
|
|
||||||
PG_REGISTER(displayPortProfile_t, displayPortProfileMsp, PG_DISPLAY_PORT_MSP_CONFIG, 1);
|
PG_REGISTER_WITH_RESET_FN(displayPortProfile_t, displayPortProfileMsp, PG_DISPLAY_PORT_MSP_CONFIG, 1);
|
||||||
|
|
||||||
|
void pgResetFn_displayPortProfileMsp(displayPortProfile_t *displayPortProfile)
|
||||||
|
{
|
||||||
|
for (uint8_t font = 0; font < DISPLAYPORT_SEVERITY_COUNT; font++) {
|
||||||
|
displayPortProfile->fontSelection[font] = font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue