Skip to content

Commit

Permalink
Add configurable duration to show the OSD logo on arming
Browse files Browse the repository at this point in the history
Adds `osd_logo_on_arming_duration` which is configured in 0.1s intervals ranging from 5 to 50 (0.5s to 5.0s). The default is 5 (0.5s) to be consistent with the previous "ARMED" splash screen.
  • Loading branch information
etracer65 committed Nov 29, 2019
1 parent 05c8538 commit 6b1f848
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/cli/settings.c
Expand Up @@ -1252,6 +1252,7 @@ const clivalue_t valueTable[] = {
{ "osd_ah_max_rol", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 90 }, PG_OSD_CONFIG, offsetof(osdConfig_t, ahMaxRoll) },
{ "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_tim1", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, INT16_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, timers[OSD_TIMER_1]) },
{ "osd_tim2", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, INT16_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, timers[OSD_TIMER_2]) },
Expand Down
11 changes: 8 additions & 3 deletions src/main/osd/osd.c
Expand Up @@ -339,6 +339,7 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)

osdConfig->distance_alarm = 0;
osdConfig->logo_on_arming = OSD_LOGO_ARMING_OFF;
osdConfig->logo_on_arming_duration = 5; // 0.5 seconds
}

static void osdDrawLogo(int x, int y)
Expand Down Expand Up @@ -813,16 +814,21 @@ static void osdRefreshStats(void)
osdShowStats(osdStatsRowCount);
}

static void osdShowArmed(void)
static timeDelta_t osdShowArmed(void)
{
static bool everArmed = false;
timeDelta_t ret;

displayClearScreen(osdDisplayPort);
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !everArmed)) {
osdDrawLogo(3, 1);
ret = osdConfig()->logo_on_arming_duration * 1e5;
} else {
ret = (REFRESH_1S / 2);
}
displayWrite(osdDisplayPort, 12, 7, DISPLAYPORT_ATTR_NONE, "ARMED");
everArmed = true;
return ret;
}

STATIC_UNIT_TESTED void osdRefresh(timeUs_t currentTimeUs)
Expand All @@ -838,8 +844,7 @@ STATIC_UNIT_TESTED void osdRefresh(timeUs_t currentTimeUs)
osdStatsEnabled = false;
osdStatsVisible = false;
osdResetStats();
osdShowArmed();
resumeRefreshAt = currentTimeUs + (REFRESH_1S / 2);
resumeRefreshAt = osdShowArmed() + currentTimeUs;
} else if (isSomeStatEnabled()
&& !suppressStatsDisplay
&& (!(getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))
Expand Down
1 change: 1 addition & 0 deletions src/main/osd/osd.h
Expand Up @@ -272,6 +272,7 @@ typedef struct osdConfig_s {
uint8_t displayPortDevice; // osdDisplayPortDevice_e
uint16_t distance_alarm;
uint8_t logo_on_arming; // show the logo on arming
uint8_t logo_on_arming_duration; // display duration in 0.1s units
} osdConfig_t;

PG_DECLARE(osdConfig_t, osdConfig);
Expand Down

0 comments on commit 6b1f848

Please sign in to comment.