Skip to content

Commit

Permalink
Display one of four logos on arming (betaflight#13057)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans authored May 11, 2024
1 parent 076049e commit e55918c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/cli/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,7 @@ const clivalue_t valueTable[] = {
{ "osd_ah_invert", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, ahInvert) },
{ "osd_logo_on_arming", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OSD_LOGO_ON_ARMING }, PG_OSD_CONFIG, offsetof(osdConfig_t, logo_on_arming) },
{ "osd_logo_on_arming_duration",VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 5, 50 }, PG_OSD_CONFIG, offsetof(osdConfig_t, logo_on_arming_duration) },
{ "osd_arming_logo", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, DISPLAYPORT_SEVERITY_COUNT - 1 }, PG_OSD_CONFIG, offsetof(osdConfig_t, arming_logo) },
#ifdef USE_OSD_QUICK_MENU
{ "osd_use_quick_menu", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, osd_use_quick_menu) },
#endif // USE_OSD_QUICK_MENU
Expand Down
9 changes: 5 additions & 4 deletions src/main/osd/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,14 @@ void pgResetFn_osdElementConfig(osdElementConfig_t *osdElementConfig)
osdElementConfig->item_pos[OSD_UP_DOWN_REFERENCE] = OSD_POS((midCol - 2), (midRow - 1));
}

static void osdDrawLogo(int x, int y)
static void osdDrawLogo(int x, int y, displayPortSeverity_e fontSel)
{
// display logo and help
int fontOffset = 160;
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_SEVERITY_NORMAL, fontOffset++);
displayWriteChar(osdDisplayPort, x + column, y + row, fontSel, fontOffset++);
}
}
}
Expand All @@ -491,7 +491,8 @@ static void osdCompleteInitialization(void)
displayBeginTransaction(osdDisplayPort, DISPLAY_TRANSACTION_OPT_RESET_DRAWING);
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);

osdDrawLogo(midCol - (OSD_LOGO_COLS) / 2, midRow - 5);
// Display betaflight logo
osdDrawLogo(midCol - (OSD_LOGO_COLS) / 2, midRow - 5, DISPLAYPORT_SEVERITY_NORMAL);

char string_buffer[30];
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
Expand Down Expand Up @@ -1194,7 +1195,7 @@ static timeDelta_t osdShowArmed(void)
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !ARMING_FLAG(WAS_EVER_ARMED))) {
uint8_t midRow = osdDisplayPort->rows / 2;
uint8_t midCol = osdDisplayPort->cols / 2;
osdDrawLogo(midCol - (OSD_LOGO_COLS) / 2, midRow - 5);
osdDrawLogo(midCol - (OSD_LOGO_COLS) / 2, midRow - 5, osdConfig()->arming_logo);
ret = osdConfig()->logo_on_arming_duration * 1e5;
} else {
ret = (REFRESH_1S / 2);
Expand Down
1 change: 1 addition & 0 deletions src/main/osd/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ typedef struct osdConfig_s {
#ifdef USE_SPEC_PREARM_SCREEN
uint8_t osd_show_spec_prearm;
#endif // USE_SPEC_PREARM_SCREEN
displayPortSeverity_e arming_logo; // font from which to display logo on arming
} osdConfig_t;

PG_DECLARE(osdConfig_t, osdConfig);
Expand Down

0 comments on commit e55918c

Please sign in to comment.