diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index e4224b838a..c4578ffd30 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -390,7 +390,7 @@ static int cmsDrawMenuItemValue(displayPort_t *pDisplay, char *buff, uint8_t row #else colpos = smallScreen ? rightMenuColumn - maxSize : rightMenuColumn; #endif - cnt = cmsDisplayWrite(pDisplay, colpos, row, DISPLAYPORT_ATTR_NORMAL, buff); + cnt = cmsDisplayWrite(pDisplay, colpos, row, DISPLAYPORT_SEVERITY_NORMAL, buff); return cnt; } @@ -591,7 +591,7 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, const OSD_Entry *p, uint8_t case OME_Label: if (IS_PRINTVALUE(*flags) && p->data) { // A label with optional string, immediately following text - cnt = cmsDisplayWrite(pDisplay, leftMenuColumn + 1 + (uint8_t)strlen(p->text), row, DISPLAYPORT_ATTR_NORMAL, p->data); + cnt = cmsDisplayWrite(pDisplay, leftMenuColumn + 1 + (uint8_t)strlen(p->text), row, DISPLAYPORT_SEVERITY_NORMAL, p->data); CLR_PRINTVALUE(*flags); } break; @@ -607,9 +607,9 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, const OSD_Entry *p, uint8_t #ifdef CMS_MENU_DEBUG // Shouldn't happen. Notify creator of this menu content #ifdef CMS_OSD_RIGHT_ALIGNED_VALUES - cnt = cmsDisplayWrite(pDisplay, rightMenuColumn - 6, row, DISPLAYPORT_ATTR_NORMAL, "BADENT"); + cnt = cmsDisplayWrite(pDisplay, rightMenuColumn - 6, row, DISPLAYPORT_SEVERITY_NORMAL, "BADENT"); #else - cnt = cmsDisplayWrite(pDisplay, rightMenuColumn, row, DISPLAYPORT_ATTR_NORMAL, "BADENT"); + cnt = cmsDisplayWrite(pDisplay, rightMenuColumn, row, DISPLAYPORT_SEVERITY_NORMAL, "BADENT"); #endif #endif break; @@ -748,7 +748,7 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) #endif if (pDisplay->cursorRow >= 0 && currentCtx.cursorRow != pDisplay->cursorRow) { - room -= cmsDisplayWrite(pDisplay, leftMenuColumn, top + pDisplay->cursorRow * linesPerMenuItem, DISPLAYPORT_ATTR_NORMAL, " "); + room -= cmsDisplayWrite(pDisplay, leftMenuColumn, top + pDisplay->cursorRow * linesPerMenuItem, DISPLAYPORT_SEVERITY_NORMAL, " "); } if (room < 30) { @@ -756,7 +756,7 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) } if (pDisplay->cursorRow != currentCtx.cursorRow) { - room -= cmsDisplayWrite(pDisplay, leftMenuColumn, top + currentCtx.cursorRow * linesPerMenuItem, DISPLAYPORT_ATTR_NORMAL, ">"); + room -= cmsDisplayWrite(pDisplay, leftMenuColumn, top + currentCtx.cursorRow * linesPerMenuItem, DISPLAYPORT_SEVERITY_NORMAL, ">"); pDisplay->cursorRow = currentCtx.cursorRow; } @@ -778,7 +778,7 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) if (IS_PRINTLABEL(runtimeEntryFlags[i])) { uint8_t coloff = leftMenuColumn; coloff += ((p->flags & OSD_MENU_ELEMENT_MASK) == OME_Label) ? 0 : 1; - room -= cmsDisplayWrite(pDisplay, coloff, top + i * linesPerMenuItem, DISPLAYPORT_ATTR_NORMAL, p->text); + room -= cmsDisplayWrite(pDisplay, coloff, top + i * linesPerMenuItem, DISPLAYPORT_SEVERITY_NORMAL, p->text); CLR_PRINTLABEL(runtimeEntryFlags[i]); if (room < 30) { return; @@ -788,7 +788,7 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) // Highlight values overridden by sliders if (rowSliderOverride(p->flags)) { - displayWriteChar(pDisplay, leftMenuColumn - 1, top + i * linesPerMenuItem, DISPLAYPORT_ATTR_NORMAL, 'S'); + displayWriteChar(pDisplay, leftMenuColumn - 1, top + i * linesPerMenuItem, DISPLAYPORT_SEVERITY_NORMAL, 'S'); } // Print values @@ -812,11 +812,11 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs) if (displayWasCleared && leftMenuColumn > 0) { // make sure there's room to draw the symbol if (currentCtx.page > 0) { const uint8_t symbol = displaySupportsOsdSymbols(pDisplay) ? SYM_ARROW_SMALL_UP : '^'; - displayWriteChar(pDisplay, leftMenuColumn - 1, top, DISPLAYPORT_ATTR_NORMAL, symbol); + displayWriteChar(pDisplay, leftMenuColumn - 1, top, DISPLAYPORT_SEVERITY_NORMAL, symbol); } if (currentCtx.page < pageCount - 1) { const uint8_t symbol = displaySupportsOsdSymbols(pDisplay) ? SYM_ARROW_SMALL_DOWN : 'v'; - displayWriteChar(pDisplay, leftMenuColumn - 1, top + pageMaxRow, DISPLAYPORT_ATTR_NORMAL, symbol); + displayWriteChar(pDisplay, leftMenuColumn - 1, top + pageMaxRow, DISPLAYPORT_SEVERITY_NORMAL, symbol); } } @@ -1014,7 +1014,7 @@ const void *cmsMenuExit(displayPort_t *pDisplay, const void *ptr) if ((exitType == CMS_EXIT_SAVEREBOOT) || (exitType == CMS_POPUP_SAVEREBOOT) || (exitType == CMS_POPUP_EXITREBOOT)) { displayClearScreen(pDisplay, DISPLAY_CLEAR_WAIT); - cmsDisplayWrite(pDisplay, 5, 3, DISPLAYPORT_ATTR_NORMAL, "REBOOTING..."); + cmsDisplayWrite(pDisplay, 5, 3, DISPLAYPORT_SEVERITY_NORMAL, "REBOOTING..."); // Flush display displayRedraw(pDisplay); diff --git a/src/main/cms/cms_menu_blackbox.c b/src/main/cms/cms_menu_blackbox.c index 6548eca960..7f7e384679 100644 --- a/src/main/cms/cms_menu_blackbox.c +++ b/src/main/cms/cms_menu_blackbox.c @@ -170,7 +170,7 @@ static const void *cmsx_EraseFlash(displayPort_t *pDisplay, const void *ptr) } displayClearScreen(pDisplay, DISPLAY_CLEAR_WAIT); - displayWrite(pDisplay, 5, 3, DISPLAYPORT_ATTR_INFO, "ERASING FLASH..."); + displayWrite(pDisplay, 5, 3, DISPLAYPORT_SEVERITY_INFO, "ERASING FLASH..."); displayRedraw(pDisplay); flashfsEraseCompletely(); diff --git a/src/main/drivers/display.h b/src/main/drivers/display.h index 58b8354838..d20979fb43 100644 --- a/src/main/drivers/display.h +++ b/src/main/drivers/display.h @@ -35,14 +35,14 @@ typedef enum { } displayPortDeviceType_e; typedef enum { - DISPLAYPORT_ATTR_NORMAL = 0, - DISPLAYPORT_ATTR_INFO, - DISPLAYPORT_ATTR_WARNING, - DISPLAYPORT_ATTR_CRITICAL, - DISPLAYPORT_ATTR_COUNT, + DISPLAYPORT_SEVERITY_NORMAL = 0, + DISPLAYPORT_SEVERITY_INFO, + DISPLAYPORT_SEVERITY_WARNING, + DISPLAYPORT_SEVERITY_CRITICAL, + DISPLAYPORT_SEVERITY_COUNT, } displayPortSeverity_e; -#define DISPLAYPORT_ATTR_BLINK 0x80 // Device local blink bit or'ed into displayPortSeverity_e +#define DISPLAYPORT_BLINK 0x80 // Device local blink bit or'ed into displayPortSeverity_e // System elements rendered by VTX or Goggles typedef enum { diff --git a/src/main/io/displayport_hott.c b/src/main/io/displayport_hott.c index 829132d89e..8b163f537e 100644 --- a/src/main/io/displayport_hott.c +++ b/src/main/io/displayport_hott.c @@ -57,7 +57,7 @@ static int hottWriteString(displayPort_t *displayPort, uint8_t col, uint8_t row, UNUSED(attr); while (*s) { - hottWriteChar(displayPort, col++, row, DISPLAYPORT_ATTR_NORMAL, *(s++)); + hottWriteChar(displayPort, col++, row, DISPLAYPORT_SEVERITY_NORMAL, *(s++)); } return 0; } @@ -68,7 +68,7 @@ static int hottClearScreen(displayPort_t *displayPort, displayClearOption_e opti for (int row = 0; row < displayPort->rows; row++) { for (int col= 0; col < displayPort->cols; col++) { - hottWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NORMAL, ' '); + hottWriteChar(displayPort, col, row, DISPLAYPORT_SEVERITY_NORMAL, ' '); } } return 0; diff --git a/src/main/io/displayport_msp.c b/src/main/io/displayport_msp.c index 4f0ccebb06..52dff222f4 100644 --- a/src/main/io/displayport_msp.c +++ b/src/main/io/displayport_msp.c @@ -119,9 +119,9 @@ static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, uin buf[0] = MSP_DP_WRITE_STRING; buf[1] = row; buf[2] = col; - buf[3] = displayPortProfileMsp()->fontSelection[attr] & ~DISPLAYPORT_MSP_ATTR_BLINK & DISPLAYPORT_MSP_ATTR_MASK; + buf[3] = displayPortProfileMsp()->fontSelection[attr & (DISPLAYPORT_SEVERITY_COUNT - 1)] & DISPLAYPORT_MSP_ATTR_FONT; - if (attr & DISPLAYPORT_ATTR_BLINK) { + if (attr & DISPLAYPORT_BLINK) { buf[3] |= DISPLAYPORT_MSP_ATTR_BLINK; } diff --git a/src/main/io/displayport_msp.h b/src/main/io/displayport_msp.h index e60184382a..2d89616ad8 100644 --- a/src/main/io/displayport_msp.h +++ b/src/main/io/displayport_msp.h @@ -42,7 +42,7 @@ typedef enum { #define DISPLAYPORT_MSP_ATTR_VERSION BIT(7) // Format indicator; must be zero for V2 (and V1) #define DISPLAYPORT_MSP_ATTR_BLINK BIT(6) // Device local blink #define DISPLAYPORT_MSP_ATTR_FONT (BIT(0) | BIT(1)) // Select bank of 256 characters as per displayPortSeverity_e -#define DISPLAYPORT_MSP_ATTR_MASK (~(DISPLAYPORT_MSP_ATTR_VERSION | DISPLAYPORT_MSP_ATTR_BLINK | DISPLAYPORT_MSP_ATTR_FONT)) +#define DISPLAYPORT_MSP_ATTR_MASK (DISPLAYPORT_MSP_ATTR_VERSION | DISPLAYPORT_MSP_ATTR_BLINK | DISPLAYPORT_MSP_ATTR_FONT) struct displayPort_s *displayPortMspInit(void); void displayPortMspSetSerial(serialPortIdentifier_e serialPort); diff --git a/src/main/io/displayport_srxl.c b/src/main/io/displayport_srxl.c index 2e9d2e946e..d12767d479 100644 --- a/src/main/io/displayport_srxl.c +++ b/src/main/io/displayport_srxl.c @@ -71,15 +71,15 @@ static int srxlClearScreen(displayPort_t *displayPort, displayClearOption_e opti UNUSED(options); for (int row = 0; row < SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS; row++) { for (int col= 0; col < SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS; col++) { - srxlWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NORMAL, ' '); + srxlWriteChar(displayPort, col, row, DISPLAYPORT_SEVERITY_NORMAL, ' '); } } - srxlWriteString(displayPort, 1, 0, DISPLAYPORT_ATTR_NORMAL, "BETAFLIGHT"); + srxlWriteString(displayPort, 1, 0, DISPLAYPORT_SEVERITY_NORMAL, "BETAFLIGHT"); if (displayPort->grabCount == 0) { - srxlWriteString(displayPort, 0, 2, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT1); - srxlWriteString(displayPort, 2, 3, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT2); - srxlWriteString(displayPort, 2, 4, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT3); + srxlWriteString(displayPort, 0, 2, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT1); + srxlWriteString(displayPort, 2, 3, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT2); + srxlWriteString(displayPort, 2, 4, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT3); } return 0; } diff --git a/src/main/msp/msp.c b/src/main/msp/msp.c index c12cfe5676..de556d2d89 100644 --- a/src/main/msp/msp.c +++ b/src/main/msp/msp.c @@ -1318,7 +1318,7 @@ case MSP_NAME: const uint8_t warningsLen = strlen(warningsBuffer); if (isBlinking) { - displayAttr |= DISPLAYPORT_ATTR_BLINK; + displayAttr |= DISPLAYPORT_BLINK; } sbufWriteU8(dst, displayAttr); // see displayPortSeverity_e sbufWriteU8(dst, warningsLen); // length byte followed by the actual characters diff --git a/src/main/osd/osd.c b/src/main/osd/osd.c index 37b339468b..57c3ceeb2e 100644 --- a/src/main/osd/osd.c +++ b/src/main/osd/osd.c @@ -449,7 +449,7 @@ static void osdDrawLogo(int x, int y) for (int row = 0; row < OSD_LOGO_ROWS; row++) { for (int column = 0; column < OSD_LOGO_COLS; column++) { if (fontOffset <= SYM_END_OF_FONT) - displayWriteChar(osdDisplayPort, x + column, y + row, DISPLAYPORT_ATTR_NORMAL, fontOffset++); + displayWriteChar(osdDisplayPort, x + column, y + row, DISPLAYPORT_SEVERITY_NORMAL, fontOffset++); } } } @@ -473,17 +473,17 @@ static void osdCompleteInitialization(void) char string_buffer[30]; tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING); - displayWrite(osdDisplayPort, midCol + 5, midRow, DISPLAYPORT_ATTR_NORMAL, string_buffer); + displayWrite(osdDisplayPort, midCol + 5, midRow, DISPLAYPORT_SEVERITY_NORMAL, string_buffer); #ifdef USE_CMS - displayWrite(osdDisplayPort, midCol - 8, midRow + 2, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT1); - displayWrite(osdDisplayPort, midCol - 4, midRow + 3, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT2); - displayWrite(osdDisplayPort, midCol - 4, midRow + 4, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT3); + displayWrite(osdDisplayPort, midCol - 8, midRow + 2, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT1); + displayWrite(osdDisplayPort, midCol - 4, midRow + 3, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT2); + displayWrite(osdDisplayPort, midCol - 4, midRow + 4, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT3); #endif #ifdef USE_RTC_TIME char dateTimeBuffer[FORMATTED_DATE_TIME_BUFSIZE]; if (osdFormatRtcDateTime(&dateTimeBuffer[0])) { - displayWrite(osdDisplayPort, midCol - 10, midRow + 6, DISPLAYPORT_ATTR_NORMAL, dateTimeBuffer); + displayWrite(osdDisplayPort, midCol - 10, midRow + 6, DISPLAYPORT_SEVERITY_NORMAL, dateTimeBuffer); } #endif @@ -732,9 +732,9 @@ static void osdGetBlackboxStatusString(char * buff) static void osdDisplayStatisticLabel(uint8_t x, uint8_t y, const char * text, const char * value) { - displayWrite(osdDisplayPort, x - 13, y, DISPLAYPORT_ATTR_NORMAL, text); - displayWrite(osdDisplayPort, x + 5, y, DISPLAYPORT_ATTR_NORMAL, ":"); - displayWrite(osdDisplayPort, x + 7, y, DISPLAYPORT_ATTR_NORMAL, value); + displayWrite(osdDisplayPort, x - 13, y, DISPLAYPORT_SEVERITY_NORMAL, text); + displayWrite(osdDisplayPort, x + 5, y, DISPLAYPORT_SEVERITY_NORMAL, ":"); + displayWrite(osdDisplayPort, x + 7, y, DISPLAYPORT_SEVERITY_NORMAL, value); } /* @@ -767,7 +767,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow) tfp_sprintf(buff, "NO RTC"); } - displayWrite(osdDisplayPort, midCol - 13, displayRow, DISPLAYPORT_ATTR_NORMAL, buff); + displayWrite(osdDisplayPort, midCol - 13, displayRow, DISPLAYPORT_SEVERITY_NORMAL, buff); return true; } @@ -1021,7 +1021,7 @@ static bool osdRenderStatsContinue(void) } if (displayLabel) { - displayWrite(osdDisplayPort, midCol - (strlen("--- STATS ---") / 2), osdStatsRenderingState.row++, DISPLAYPORT_ATTR_NORMAL, "--- STATS ---"); + displayWrite(osdDisplayPort, midCol - (strlen("--- STATS ---") / 2), osdStatsRenderingState.row++, DISPLAYPORT_SEVERITY_NORMAL, "--- STATS ---"); return false; } } @@ -1128,10 +1128,10 @@ static timeDelta_t osdShowArmed(void) } else { ret = (REFRESH_1S / 2); } - displayWrite(osdDisplayPort, midCol - (strlen("ARMED") / 2), midRow, DISPLAYPORT_ATTR_NORMAL, "ARMED"); + displayWrite(osdDisplayPort, midCol - (strlen("ARMED") / 2), midRow, DISPLAYPORT_SEVERITY_NORMAL, "ARMED"); if (isFlipOverAfterCrashActive()) { - displayWrite(osdDisplayPort, midCol - (strlen(CRASH_FLIP_WARNING) / 2), midRow + 1, DISPLAYPORT_ATTR_NORMAL, CRASH_FLIP_WARNING); + displayWrite(osdDisplayPort, midCol - (strlen(CRASH_FLIP_WARNING) / 2), midRow + 1, DISPLAYPORT_SEVERITY_NORMAL, CRASH_FLIP_WARNING); } return ret; diff --git a/src/main/osd/osd_elements.c b/src/main/osd/osd_elements.c index 332941e047..e6c0d4ad53 100644 --- a/src/main/osd/osd_elements.c +++ b/src/main/osd/osd_elements.c @@ -239,7 +239,7 @@ enum {UP, DOWN}; static int osdDisplayWrite(osdElementParms_t *element, uint8_t x, uint8_t y, uint8_t attr, const char *s) { if (IS_BLINK(element->item)) { - attr |= DISPLAYPORT_ATTR_BLINK; + attr |= DISPLAYPORT_BLINK; } return displayWrite(element->osdDisplayPort, x, y, attr, s); @@ -287,7 +287,7 @@ static void renderOsdEscRpmOrFreq(getEscRpmOrFreqFnPtr escFnPtr, osdElementParms const int rpm = MIN((*escFnPtr)(i),99999); const int len = tfp_sprintf(rpmStr, "%d", rpm); rpmStr[len] = '\0'; - osdDisplayWrite(element, x, y + i, DISPLAYPORT_ATTR_NORMAL, rpmStr); + osdDisplayWrite(element, x, y + i, DISPLAYPORT_SEVERITY_NORMAL, rpmStr); } element->drawElement = false; } @@ -666,7 +666,7 @@ static void osdElementAltitude(osdElementParms_t *element) int32_t alt = osdGetMetersToSelectedUnit(getEstimatedAltitudeCm()) / 100; if ((alt >= osdConfig()->alt_alarm) && ARMING_FLAG(ARMED)) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } if (haveBaro || haveGps) { @@ -713,7 +713,7 @@ static void osdElementArtificialHorizon(osdElementParms_t *element) for (int x = -4; x <= 4; x++) { const int y = ((-rollAngle * x) / 64) - pitchAngle; if (y >= 0 && y <= 81) { - osdDisplayWriteChar(element, element->elemPosX + x, element->elemPosY + (y / AH_SYMBOL_COUNT), DISPLAYPORT_ATTR_NORMAL, (SYM_AH_BAR9_0 + (y % AH_SYMBOL_COUNT))); + osdDisplayWriteChar(element, element->elemPosX + x, element->elemPosY + (y / AH_SYMBOL_COUNT), DISPLAYPORT_SEVERITY_NORMAL, (SYM_AH_BAR9_0 + (y % AH_SYMBOL_COUNT))); } } @@ -743,7 +743,7 @@ static void osdElementUpDownReference(osdElementParms_t *element) int posX = element->elemPosX + lrintf(scaleRangef(psiB, -M_PIf / 4, M_PIf / 4, -14, 14)); int posY = element->elemPosY + lrintf(scaleRangef(thetaB, -M_PIf / 4, M_PIf / 4, -8, 8)); - osdDisplayWrite(element, posX, posY, DISPLAYPORT_ATTR_NORMAL, symbol[direction]); + osdDisplayWrite(element, posX, posY, DISPLAYPORT_SEVERITY_NORMAL, symbol[direction]); } element->drawElement = false; // element already drawn } @@ -756,10 +756,10 @@ static void osdElementAverageCellVoltage(osdElementParms_t *element) switch (batteryState) { case BATTERY_WARNING: - element->attr = DISPLAYPORT_ATTR_WARNING; + element->attr = DISPLAYPORT_SEVERITY_WARNING; break; case BATTERY_CRITICAL: - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; break; default: break; @@ -795,12 +795,12 @@ static void osdBackgroundCameraFrame(osdElementParms_t *element) element->buff[width - 1] = SYM_STICK_OVERLAY_CENTER; element->buff[width] = 0; // string terminator - osdDisplayWrite(element, xpos, ypos, DISPLAYPORT_ATTR_NORMAL, element->buff); + osdDisplayWrite(element, xpos, ypos, DISPLAYPORT_SEVERITY_NORMAL, element->buff); for (int i = 1; i < (height - 1); i++) { - osdDisplayWriteChar(element, xpos, ypos + i, DISPLAYPORT_ATTR_NORMAL, SYM_STICK_OVERLAY_VERTICAL); - osdDisplayWriteChar(element, xpos + width - 1, ypos + i, DISPLAYPORT_ATTR_NORMAL, SYM_STICK_OVERLAY_VERTICAL); + osdDisplayWriteChar(element, xpos, ypos + i, DISPLAYPORT_SEVERITY_NORMAL, SYM_STICK_OVERLAY_VERTICAL); + osdDisplayWriteChar(element, xpos + width - 1, ypos + i, DISPLAYPORT_SEVERITY_NORMAL, SYM_STICK_OVERLAY_VERTICAL); } - osdDisplayWrite(element, xpos, ypos + height - 1, DISPLAYPORT_ATTR_NORMAL, element->buff); + osdDisplayWrite(element, xpos, ypos + height - 1, DISPLAYPORT_SEVERITY_NORMAL, element->buff); element->drawElement = false; // element already drawn } @@ -1080,15 +1080,15 @@ static void osdElementGpsCoordinate(osdElementParms_t *element) static void osdElementGpsSats(osdElementParms_t *element) { if ((STATE(GPS_FIX) == 0) || (gpsSol.numSat < GPS_MIN_SAT_COUNT) ) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } #ifdef USE_GPS_RESCUE else if ((gpsSol.numSat < gpsRescueConfig()->minSats) && gpsRescueIsConfigured()) { - element->attr = DISPLAYPORT_ATTR_WARNING; + element->attr = DISPLAYPORT_SEVERITY_WARNING; } #endif else { - element->attr = DISPLAYPORT_ATTR_INFO; + element->attr = DISPLAYPORT_SEVERITY_INFO; } if (!gpsIsHealthy()) { @@ -1135,13 +1135,13 @@ static void osdBackgroundHorizonSidebars(osdElementParms_t *element) const int8_t hudwidth = AH_SIDEBAR_WIDTH_POS; const int8_t hudheight = AH_SIDEBAR_HEIGHT_POS; for (int y = -hudheight; y <= hudheight; y++) { - osdDisplayWriteChar(element, element->elemPosX - hudwidth, element->elemPosY + y, DISPLAYPORT_ATTR_NORMAL, SYM_AH_DECORATION); - osdDisplayWriteChar(element, element->elemPosX + hudwidth, element->elemPosY + y, DISPLAYPORT_ATTR_NORMAL, SYM_AH_DECORATION); + osdDisplayWriteChar(element, element->elemPosX - hudwidth, element->elemPosY + y, DISPLAYPORT_SEVERITY_NORMAL, SYM_AH_DECORATION); + osdDisplayWriteChar(element, element->elemPosX + hudwidth, element->elemPosY + y, DISPLAYPORT_SEVERITY_NORMAL, SYM_AH_DECORATION); } // AH level indicators - osdDisplayWriteChar(element, element->elemPosX - hudwidth + 1, element->elemPosY, DISPLAYPORT_ATTR_NORMAL, SYM_AH_LEFT); - osdDisplayWriteChar(element, element->elemPosX + hudwidth - 1, element->elemPosY, DISPLAYPORT_ATTR_NORMAL, SYM_AH_RIGHT); + osdDisplayWriteChar(element, element->elemPosX - hudwidth + 1, element->elemPosY, DISPLAYPORT_SEVERITY_NORMAL, SYM_AH_LEFT); + osdDisplayWriteChar(element, element->elemPosX + hudwidth - 1, element->elemPosY, DISPLAYPORT_SEVERITY_NORMAL, SYM_AH_RIGHT); element->drawElement = false; // element already drawn } @@ -1152,7 +1152,7 @@ static void osdElementLinkQuality(osdElementParms_t *element) uint16_t osdLinkQuality = 0; if (rxGetLinkQualityPercent() < osdConfig()->link_quality_alarm) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } if (linkQualitySource == LQ_SOURCE_RX_PROTOCOL_CRSF) { // 0-99 @@ -1209,7 +1209,7 @@ static void osdElementMahDrawn(osdElementParms_t *element) const int mAhDrawn = getMAhDrawn(); if (mAhDrawn >= osdConfig()->cap_alarm) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } tfp_sprintf(element->buff, "%4d%c", mAhDrawn, SYM_MAH); @@ -1221,7 +1221,7 @@ static void osdElementWattHoursDrawn(osdElementParms_t *element) const float wattHoursDrawn = getWhDrawn(); if (mAhDrawn >= osdConfig()->cap_alarm) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } if (wattHoursDrawn < 1.0f) { @@ -1243,7 +1243,7 @@ static void osdElementMainBatteryUsage(osdElementParms_t *element) int displayBasis = usedCapacity; if (mAhDrawn >= osdConfig()->cap_alarm) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } switch (element->type) { @@ -1298,10 +1298,10 @@ static void osdElementMainBatteryVoltage(osdElementParms_t *element) switch (batteryState) { case BATTERY_WARNING: - element->attr = DISPLAYPORT_ATTR_WARNING; + element->attr = DISPLAYPORT_SEVERITY_WARNING; break; case BATTERY_CRITICAL: - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; break; default: break; @@ -1402,7 +1402,7 @@ static void osdElementRcChannels(osdElementParms_t *element) // Decimal notation can be added when tfp_sprintf supports float among fancy options. char fmtbuf[6]; tfp_sprintf(fmtbuf, "%5d", data); - osdDisplayWrite(element, xpos, ypos + i, DISPLAYPORT_ATTR_NORMAL, fmtbuf); + osdDisplayWrite(element, xpos, ypos + i, DISPLAYPORT_SEVERITY_NORMAL, fmtbuf); } } @@ -1414,7 +1414,7 @@ static void osdElementRemainingTimeEstimate(osdElementParms_t *element) const int mAhDrawn = getMAhDrawn(); if (mAhDrawn >= osdConfig()->cap_alarm) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } if (mAhDrawn <= 0.1 * osdConfig()->cap_alarm) { // also handles the mAhDrawn == 0 condition @@ -1435,7 +1435,7 @@ static void osdElementRssi(osdElementParms_t *element) } if (getRssiPercent() < osdConfig()->rssi_alarm) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } tfp_sprintf(element->buff, "%c%2d", SYM_RSSI, osdRssi); @@ -1481,11 +1481,11 @@ static void osdBackgroundStickOverlay(osdElementParms_t *element) for (unsigned y = 0; y < OSD_STICK_OVERLAY_HEIGHT; y++) { // draw the axes, vertical and horizonal if ((x == ((OSD_STICK_OVERLAY_WIDTH - 1) / 2)) && (y == (OSD_STICK_OVERLAY_HEIGHT - 1) / 2)) { - osdDisplayWriteChar(element, xpos + x, ypos + y, DISPLAYPORT_ATTR_NORMAL, SYM_STICK_OVERLAY_CENTER); + osdDisplayWriteChar(element, xpos + x, ypos + y, DISPLAYPORT_SEVERITY_NORMAL, SYM_STICK_OVERLAY_CENTER); } else if (x == ((OSD_STICK_OVERLAY_WIDTH - 1) / 2)) { - osdDisplayWriteChar(element, xpos + x, ypos + y, DISPLAYPORT_ATTR_NORMAL, SYM_STICK_OVERLAY_VERTICAL); + osdDisplayWriteChar(element, xpos + x, ypos + y, DISPLAYPORT_SEVERITY_NORMAL, SYM_STICK_OVERLAY_VERTICAL); } else if (y == ((OSD_STICK_OVERLAY_HEIGHT - 1) / 2)) { - osdDisplayWriteChar(element, xpos + x, ypos + y, DISPLAYPORT_ATTR_NORMAL, SYM_STICK_OVERLAY_HORIZONTAL); + osdDisplayWriteChar(element, xpos + x, ypos + y, DISPLAYPORT_SEVERITY_NORMAL, SYM_STICK_OVERLAY_HORIZONTAL); } } } @@ -1513,7 +1513,7 @@ static void osdElementStickOverlay(osdElementParms_t *element) const uint8_t cursorY = OSD_STICK_OVERLAY_VERTICAL_POSITIONS - 1 - scaleRange(constrain(rcData[vertical_channel], PWM_RANGE_MIN, PWM_RANGE_MAX - 1), PWM_RANGE_MIN, PWM_RANGE_MAX, 0, OSD_STICK_OVERLAY_VERTICAL_POSITIONS); const char cursor = SYM_STICK_OVERLAY_SPRITE_HIGH + (cursorY % OSD_STICK_OVERLAY_SPRITE_HEIGHT); - osdDisplayWriteChar(element, xpos + cursorX, ypos + cursorY / OSD_STICK_OVERLAY_SPRITE_HEIGHT, DISPLAYPORT_ATTR_NORMAL, cursor); + osdDisplayWriteChar(element, xpos + cursorX, ypos + cursorY / OSD_STICK_OVERLAY_SPRITE_HEIGHT, DISPLAYPORT_SEVERITY_NORMAL, cursor); element->drawElement = false; // element already drawn } @@ -1531,7 +1531,7 @@ static void osdElementTimer(osdElementParms_t *element) const timeUs_t time = osdGetTimerValue(OSD_TIMER_SRC(timer)); const timeUs_t alarmTime = OSD_TIMER_ALARM(timer) * 60000000; // convert from minutes to us if (alarmTime != 0 && time >= alarmTime) { - element->attr = DISPLAYPORT_ATTR_CRITICAL; + element->attr = DISPLAYPORT_SEVERITY_CRITICAL; } } @@ -1959,7 +1959,7 @@ static void osdDrawSingleElement(displayPort_t *osdDisplayPort, uint8_t item) element.buff = (char *)&buff; element.osdDisplayPort = osdDisplayPort; element.drawElement = true; - element.attr = DISPLAYPORT_ATTR_NORMAL; + element.attr = DISPLAYPORT_SEVERITY_NORMAL; // Call the element drawing function if ((item >= OSD_SYS_GOGGLE_VOLTAGE) && (item < OSD_ITEM_COUNT)) { @@ -1995,7 +1995,7 @@ static void osdDrawSingleElementBackground(displayPort_t *osdDisplayPort, uint8_ // Call the element background drawing function osdElementBackgroundFunction[item](&element); if (element.drawElement) { - osdDisplayWrite(&element, elemPosX, elemPosY, DISPLAYPORT_ATTR_NORMAL, buff); + osdDisplayWrite(&element, elemPosX, elemPosY, DISPLAYPORT_SEVERITY_NORMAL, buff); } } diff --git a/src/main/osd/osd_warnings.c b/src/main/osd/osd_warnings.c index 031df5a967..a1dbcce2b9 100644 --- a/src/main/osd/osd_warnings.c +++ b/src/main/osd/osd_warnings.c @@ -75,7 +75,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) static unsigned armingDisabledDisplayIndex; warningText[0] = '\0'; - *displayAttr = DISPLAYPORT_ATTR_NORMAL; + *displayAttr = DISPLAYPORT_SEVERITY_NORMAL; *blinking = false; // Cycle through the arming disabled reasons @@ -105,7 +105,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) } tfp_sprintf(warningText, "%s", armingDisableFlagNames[armingDisabledDisplayIndex]); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; return; } else { armingDisabledUpdateTimeUs = 0; @@ -123,13 +123,13 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) } else { tfp_sprintf(warningText, "ARM IN %d.%d", armingDelayTime / 10, armingDelayTime % 10); } - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; return; } #endif // USE_DSHOT if (osdWarnGetState(OSD_WARNING_FAIL_SAFE) && failsafeIsActive()) { tfp_sprintf(warningText, "FAIL SAFE"); - *displayAttr = DISPLAYPORT_ATTR_CRITICAL; + *displayAttr = DISPLAYPORT_SEVERITY_CRITICAL; *blinking = true; return; } @@ -138,11 +138,11 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) if (osdWarnGetState(OSD_WARNING_CRASH_FLIP) && IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH)) { if (isFlipOverAfterCrashActive()) { // if was armed in crash flip mode tfp_sprintf(warningText, CRASH_FLIP_WARNING); - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; return; } else if (!ARMING_FLAG(ARMED)) { // if disarmed, but crash flip mode is activated tfp_sprintf(warningText, "CRASH FLIP SWITCH"); - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; return; } } @@ -165,7 +165,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) *blinking = true; } - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; return; } #endif // USE_LAUNCH_CONTROL @@ -173,7 +173,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // RSSI if (osdWarnGetState(OSD_WARNING_RSSI) && (getRssiPercent() < osdConfig()->rssi_alarm)) { tfp_sprintf(warningText, "RSSI LOW"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -181,7 +181,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // rssi dbm if (osdWarnGetState(OSD_WARNING_RSSI_DBM) && (getRssiDbm() < osdConfig()->rssi_dbm_alarm)) { tfp_sprintf(warningText, "RSSI DBM"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -190,7 +190,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // rsnr if (osdWarnGetState(OSD_WARNING_RSNR) && (getRsnr() < osdConfig()->rsnr_alarm)) { tfp_sprintf(warningText, "RSNR LOW"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -200,7 +200,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // Link Quality if (osdWarnGetState(OSD_WARNING_LINK_QUALITY) && (rxGetLinkQualityPercent() < osdConfig()->link_quality_alarm)) { tfp_sprintf(warningText, "LINK QUALITY"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -208,7 +208,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) if (osdWarnGetState(OSD_WARNING_BATTERY_CRITICAL) && batteryState == BATTERY_CRITICAL) { tfp_sprintf(warningText, " LAND NOW"); - *displayAttr = DISPLAYPORT_ATTR_CRITICAL; + *displayAttr = DISPLAYPORT_SEVERITY_CRITICAL; *blinking = true; return; } @@ -220,7 +220,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) !gpsRescueIsDisabled() && !gpsRescueIsAvailable()) { tfp_sprintf(warningText, "RESCUE N/A"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -233,7 +233,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) statistic_t *stats = osdGetStats(); if (cmpTimeUs(stats->armed_time, OSD_GPS_RESCUE_DISABLED_WARNING_DURATION_US) < 0) { tfp_sprintf(warningText, "RESCUE OFF"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -244,7 +244,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // Show warning if in HEADFREE flight mode if (FLIGHT_MODE(HEADFREE_MODE)) { tfp_sprintf(warningText, "HEADFREE"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -253,7 +253,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) const int16_t coreTemperature = getCoreTemperatureCelsius(); if (osdWarnGetState(OSD_WARNING_CORE_TEMPERATURE) && coreTemperature >= osdConfig()->core_temp_alarm) { tfp_sprintf(warningText, "CORE %c: %3d%c", SYM_TEMPERATURE, osdConvertTemperatureToSelectedUnit(coreTemperature), osdGetTemperatureSymbolForSelectedUnit()); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -305,7 +305,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) if (escWarningCount > 0) { tfp_sprintf(warningText, "%s", escWarningMsg); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -361,7 +361,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // If warning exists then notify, otherwise clear warning message if (dshotEscErrorLength > 3) { warningText[dshotEscErrorLength] = 0; // End string - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } else { @@ -372,7 +372,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) if (osdWarnGetState(OSD_WARNING_BATTERY_WARNING) && batteryState == BATTERY_WARNING) { tfp_sprintf(warningText, "LOW BATTERY"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -381,7 +381,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // Show warning if rc smoothing hasn't initialized the filters if (osdWarnGetState(OSD_WARNING_RC_SMOOTHING) && ARMING_FLAG(ARMED) && !rcSmoothingInitializationComplete()) { tfp_sprintf(warningText, "RCSMOOTHING"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -390,7 +390,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // Show warning if mah consumed is over the configured limit if (osdWarnGetState(OSD_WARNING_OVER_CAP) && ARMING_FLAG(ARMED) && osdConfig()->cap_alarm > 0 && getMAhDrawn() >= osdConfig()->cap_alarm) { tfp_sprintf(warningText, "OVER CAP"); - *displayAttr = DISPLAYPORT_ATTR_WARNING; + *displayAttr = DISPLAYPORT_SEVERITY_WARNING; *blinking = true; return; } @@ -399,7 +399,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) // Show warning if battery is not fresh and battery continue is active if (hasUsedMAh()) { tfp_sprintf(warningText, "BATTERY CONTINUE"); - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; return; } #endif // USE_BATTERY_CONTINUE @@ -408,14 +408,14 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) if (osdWarnGetState(OSD_WARNING_BATTERY_NOT_FULL) && !(ARMING_FLAG(ARMED) || ARMING_FLAG(WAS_EVER_ARMED)) && (getBatteryState() == BATTERY_OK) && getBatteryAverageCellVoltage() < batteryConfig()->vbatfullcellvoltage) { tfp_sprintf(warningText, "BATT < FULL"); - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; return; } // Visual beeper if (osdWarnGetState(OSD_WARNING_VISUAL_BEEPER) && osdGetVisualBeeperState()) { tfp_sprintf(warningText, " * * * *"); - *displayAttr = DISPLAYPORT_ATTR_INFO; + *displayAttr = DISPLAYPORT_SEVERITY_INFO; osdSetVisualBeeperState(false); return; } diff --git a/src/main/pg/displayport_profiles.h b/src/main/pg/displayport_profiles.h index 585d6fc412..22a7968c00 100644 --- a/src/main/pg/displayport_profiles.h +++ b/src/main/pg/displayport_profiles.h @@ -32,7 +32,7 @@ typedef struct displayPortProfile_s { // For attribute-rich OSDs - uint8_t fontSelection[DISPLAYPORT_ATTR_COUNT]; + uint8_t fontSelection[DISPLAYPORT_SEVERITY_COUNT]; uint8_t useDeviceBlink; // Use device local blink capability } displayPortProfile_t;