diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index 23954c411a..466de655f3 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -1773,6 +1773,11 @@ const clivalue_t valueTable[] = { { "extra_low_battery_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraLowBatteryWarning) }, { "extra_armed_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraArmedWarning) }, { "extra_land_now_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraLandNowWarning) }, + + + { "extra_prearm_1", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraPrearm1) }, + { "extra_prearm_2", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraPrearm2) }, + { "extra_prearm_3", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraPrearm3) }, #endif // PG_POSITION diff --git a/src/main/config/config.c b/src/main/config/config.c index e1edf0b594..a178b28be0 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -120,6 +120,9 @@ PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig, .extraLowBatteryWarning = "AINT LEAVING", .extraArmedWarning = "LETS GO", .extraLandNowWarning = ">> LAND NOW <<", + .extraPrearm1 = "SCULLY", + .extraPrearm2 = "ONE", + .extraPrearm3 = "LOVE", ); PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 3); @@ -226,6 +229,10 @@ void makeStringsUpperCase(void) toUpperCase(pilotConfigMutable()->extraTurtleModeWarning, pilotConfig()->extraTurtleModeWarning, MAX_NAME_LENGTH); toUpperCase(pilotConfigMutable()->extraLowBatteryWarning, pilotConfig()->extraLowBatteryWarning, MAX_NAME_LENGTH); toUpperCase(pilotConfigMutable()->extraArmedWarning, pilotConfig()->extraArmedWarning, MAX_NAME_LENGTH); + + toUpperCase(pilotConfigMutable()->extraPrearm1, pilotConfig()->extraPrearm1, MAX_NAME_LENGTH); + toUpperCase(pilotConfigMutable()->extraPrearm2, pilotConfig()->extraPrearm2, MAX_NAME_LENGTH); + toUpperCase(pilotConfigMutable()->extraPrearm3, pilotConfig()->extraPrearm3, MAX_NAME_LENGTH); } static void validateAndFixConfig(void) diff --git a/src/main/config/config.h b/src/main/config/config.h index 0d550e2f3f..1d4af0819e 100644 --- a/src/main/config/config.h +++ b/src/main/config/config.h @@ -41,6 +41,10 @@ typedef struct pilotConfig_s { char extraLowBatteryWarning[MAX_NAME_LENGTH + 1]; char extraArmedWarning[MAX_NAME_LENGTH + 1]; char extraLandNowWarning[MAX_NAME_LENGTH + 1]; + + char extraPrearm1[MAX_NAME_LENGTH + 1]; + char extraPrearm2[MAX_NAME_LENGTH + 1]; + char extraPrearm3[MAX_NAME_LENGTH + 1]; } pilotConfig_t; PG_DECLARE(pilotConfig_t, pilotConfig); diff --git a/src/main/osd/osd_elements.c b/src/main/osd/osd_elements.c index 073b801101..984321daa2 100644 --- a/src/main/osd/osd_elements.c +++ b/src/main/osd/osd_elements.c @@ -2250,7 +2250,8 @@ bool osdDrawNextActiveElement(displayPort_t *osdDisplayPort) } #ifdef USE_SPEC_PREARM_SCREEN -bool osdDrawSpec(displayPort_t *osdDisplayPort) + +bool osdDrawSpecReal(displayPort_t *osdDisplayPort) { static enum {RPM, POLES, MIXER, THR, MOTOR, BAT, VER} specState = RPM; static int currentRow; @@ -2337,6 +2338,53 @@ bool osdDrawSpec(displayPort_t *osdDisplayPort) return false; } + +bool osdDrawPrearmStrings(displayPort_t *osdDisplayPort) +{ + const uint8_t midRow = osdDisplayPort->rows / 2; + const uint8_t midCol = osdDisplayPort->cols / 2; + + char buff[OSD_ELEMENT_BUFFER_LENGTH] = ""; + + int len = 0; + + static int currentRow; + static int state = 0; + + switch (state) { + default: + case 0: + state++; + currentRow = midRow - 2; + len = tfp_sprintf(buff, "%s", pilotConfig()->extraPrearm1); + displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff); + break; + case 1: + state++; + len = tfp_sprintf(buff, "%s", pilotConfig()->extraPrearm1); + displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff); + break; + case 2: + state = 0; + len = tfp_sprintf(buff, "%s", pilotConfig()->extraPrearm1); + displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff); + return true; + } + + return false; +} + +bool osdDrawSpec(displayPort_t *osdDisplayPort) +{ + const uint8_t throttleValue = calculateThrottlePercent(); + if (throttleValue > 80) { + return osdDrawPrearmStrings(osdDisplayPort); + } else { + return osdDrawSpecReal(osdDisplayPort); + } + +} + #endif // USE_SPEC_PREARM_SCREEN void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort)