mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Center ARMED message and stats (#12086)
This commit is contained in:
parent
c38bf42059
commit
962a7d0cae
3 changed files with 53 additions and 48 deletions
|
@ -455,15 +455,15 @@ static void osdCompleteInitialization(void)
|
||||||
displayBeginTransaction(osdDisplayPort, DISPLAY_TRANSACTION_OPT_RESET_DRAWING);
|
displayBeginTransaction(osdDisplayPort, DISPLAY_TRANSACTION_OPT_RESET_DRAWING);
|
||||||
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
|
|
||||||
osdDrawLogo(midCol - (OSD_LOGO_COLS) / 2, midRow - 7);
|
osdDrawLogo(midCol - (OSD_LOGO_COLS) / 2, midRow - 5);
|
||||||
|
|
||||||
char string_buffer[30];
|
char string_buffer[30];
|
||||||
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
|
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
|
||||||
displayWrite(osdDisplayPort, midCol + 5, midRow - 2, DISPLAYPORT_ATTR_NORMAL, string_buffer);
|
displayWrite(osdDisplayPort, midCol + 5, midRow, DISPLAYPORT_ATTR_NORMAL, string_buffer);
|
||||||
#ifdef USE_CMS
|
#ifdef USE_CMS
|
||||||
displayWrite(osdDisplayPort, midCol - 8, midRow, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT1);
|
displayWrite(osdDisplayPort, midCol - 8, midRow + 2, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT1);
|
||||||
displayWrite(osdDisplayPort, midCol - 4, midRow + 1, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT2);
|
displayWrite(osdDisplayPort, midCol - 4, midRow + 3, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT2);
|
||||||
displayWrite(osdDisplayPort, midCol - 4, midRow + 2, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT3);
|
displayWrite(osdDisplayPort, midCol - 4, midRow + 4, DISPLAYPORT_ATTR_NORMAL, CMS_STARTUP_HELP_TEXT3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RTC_TIME
|
#ifdef USE_RTC_TIME
|
||||||
|
@ -683,11 +683,11 @@ static void osdGetBlackboxStatusString(char * buff)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void osdDisplayStatisticLabel(uint8_t y, const char * text, const char * value)
|
static void osdDisplayStatisticLabel(uint8_t x, uint8_t y, const char * text, const char * value)
|
||||||
{
|
{
|
||||||
displayWrite(osdDisplayPort, 2, y, DISPLAYPORT_ATTR_NORMAL, text);
|
displayWrite(osdDisplayPort, x - 13, y, DISPLAYPORT_ATTR_NORMAL, text);
|
||||||
displayWrite(osdDisplayPort, 20, y, DISPLAYPORT_ATTR_NORMAL, ":");
|
displayWrite(osdDisplayPort, x + 5, y, DISPLAYPORT_ATTR_NORMAL, ":");
|
||||||
displayWrite(osdDisplayPort, 22, y, DISPLAYPORT_ATTR_NORMAL, value);
|
displayWrite(osdDisplayPort, x + 7, y, DISPLAYPORT_ATTR_NORMAL, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -707,6 +707,7 @@ static bool isSomeStatEnabled(void)
|
||||||
|
|
||||||
static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
{
|
{
|
||||||
|
uint8_t midCol = osdDisplayPort->cols / 2;
|
||||||
char buff[OSD_ELEMENT_BUFFER_LENGTH];
|
char buff[OSD_ELEMENT_BUFFER_LENGTH];
|
||||||
|
|
||||||
switch (statistic) {
|
switch (statistic) {
|
||||||
|
@ -719,23 +720,23 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
tfp_sprintf(buff, "NO RTC");
|
tfp_sprintf(buff, "NO RTC");
|
||||||
}
|
}
|
||||||
|
|
||||||
displayWrite(osdDisplayPort, 2, displayRow, DISPLAYPORT_ATTR_NORMAL, buff);
|
displayWrite(osdDisplayPort, midCol - 13, displayRow, DISPLAYPORT_ATTR_NORMAL, buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OSD_STAT_TIMER_1:
|
case OSD_STAT_TIMER_1:
|
||||||
osdFormatTimer(buff, false, (OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_1]) == OSD_TIMER_SRC_ON ? false : true), OSD_TIMER_1);
|
osdFormatTimer(buff, false, (OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_1]) == OSD_TIMER_SRC_ON ? false : true), OSD_TIMER_1);
|
||||||
osdDisplayStatisticLabel(displayRow, osdTimerSourceNames[OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_1])], buff);
|
osdDisplayStatisticLabel(midCol, displayRow, osdTimerSourceNames[OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_1])], buff);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_STAT_TIMER_2:
|
case OSD_STAT_TIMER_2:
|
||||||
osdFormatTimer(buff, false, (OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2]) == OSD_TIMER_SRC_ON ? false : true), OSD_TIMER_2);
|
osdFormatTimer(buff, false, (OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2]) == OSD_TIMER_SRC_ON ? false : true), OSD_TIMER_2);
|
||||||
osdDisplayStatisticLabel(displayRow, osdTimerSourceNames[OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2])], buff);
|
osdDisplayStatisticLabel(midCol, displayRow, osdTimerSourceNames[OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2])], buff);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_STAT_MAX_ALTITUDE: {
|
case OSD_STAT_MAX_ALTITUDE: {
|
||||||
osdPrintFloat(buff, SYM_NONE, osdGetMetersToSelectedUnit(stats.max_altitude) / 100.0f, "", 1, true, osdGetMetersToSelectedUnitSymbol());
|
osdPrintFloat(buff, SYM_NONE, osdGetMetersToSelectedUnit(stats.max_altitude) / 100.0f, "", 1, true, osdGetMetersToSelectedUnitSymbol());
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX ALTITUDE", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX ALTITUDE", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,7 +744,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_MAX_SPEED:
|
case OSD_STAT_MAX_SPEED:
|
||||||
if (featureIsEnabled(FEATURE_GPS)) {
|
if (featureIsEnabled(FEATURE_GPS)) {
|
||||||
tfp_sprintf(buff, "%d%c", osdGetSpeedToSelectedUnit(stats.max_speed), osdGetSpeedToSelectedUnitSymbol());
|
tfp_sprintf(buff, "%d%c", osdGetSpeedToSelectedUnit(stats.max_speed), osdGetSpeedToSelectedUnitSymbol());
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX SPEED", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX SPEED", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -751,7 +752,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_MAX_DISTANCE:
|
case OSD_STAT_MAX_DISTANCE:
|
||||||
if (featureIsEnabled(FEATURE_GPS)) {
|
if (featureIsEnabled(FEATURE_GPS)) {
|
||||||
osdFormatDistanceString(buff, stats.max_distance, SYM_NONE);
|
osdFormatDistanceString(buff, stats.max_distance, SYM_NONE);
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX DISTANCE", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX DISTANCE", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -760,7 +761,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
if (featureIsEnabled(FEATURE_GPS)) {
|
if (featureIsEnabled(FEATURE_GPS)) {
|
||||||
const int distanceFlown = GPS_distanceFlownInCm / 100;
|
const int distanceFlown = GPS_distanceFlownInCm / 100;
|
||||||
osdFormatDistanceString(buff, distanceFlown, SYM_NONE);
|
osdFormatDistanceString(buff, distanceFlown, SYM_NONE);
|
||||||
osdDisplayStatisticLabel(displayRow, "FLIGHT DISTANCE", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "FLIGHT DISTANCE", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -768,19 +769,19 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
|
|
||||||
case OSD_STAT_MIN_BATTERY:
|
case OSD_STAT_MIN_BATTERY:
|
||||||
osdPrintFloat(buff, SYM_NONE, stats.min_voltage / 100.0f, "", 2, true, SYM_VOLT);
|
osdPrintFloat(buff, SYM_NONE, stats.min_voltage / 100.0f, "", 2, true, SYM_VOLT);
|
||||||
osdDisplayStatisticLabel(displayRow, osdConfig()->stat_show_cell_value? "MIN AVG CELL" : "MIN BATTERY", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, osdConfig()->stat_show_cell_value? "MIN AVG CELL" : "MIN BATTERY", buff);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_STAT_END_BATTERY:
|
case OSD_STAT_END_BATTERY:
|
||||||
osdPrintFloat(buff, SYM_NONE, stats.end_voltage / 100.0f, "", 2, true, SYM_VOLT);
|
osdPrintFloat(buff, SYM_NONE, stats.end_voltage / 100.0f, "", 2, true, SYM_VOLT);
|
||||||
osdDisplayStatisticLabel(displayRow, osdConfig()->stat_show_cell_value ? "END AVG CELL" : "END BATTERY", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, osdConfig()->stat_show_cell_value ? "END AVG CELL" : "END BATTERY", buff);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_STAT_BATTERY:
|
case OSD_STAT_BATTERY:
|
||||||
{
|
{
|
||||||
const uint16_t statsVoltage = getStatsVoltage();
|
const uint16_t statsVoltage = getStatsVoltage();
|
||||||
osdPrintFloat(buff, SYM_NONE, statsVoltage / 100.0f, "", 2, true, SYM_VOLT);
|
osdPrintFloat(buff, SYM_NONE, statsVoltage / 100.0f, "", 2, true, SYM_VOLT);
|
||||||
osdDisplayStatisticLabel(displayRow, osdConfig()->stat_show_cell_value ? "AVG BATT CELL" : "BATTERY", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, osdConfig()->stat_show_cell_value ? "AVG BATT CELL" : "BATTERY", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -788,13 +789,13 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_MIN_RSSI:
|
case OSD_STAT_MIN_RSSI:
|
||||||
itoa(stats.min_rssi, buff, 10);
|
itoa(stats.min_rssi, buff, 10);
|
||||||
strcat(buff, "%");
|
strcat(buff, "%");
|
||||||
osdDisplayStatisticLabel(displayRow, "MIN RSSI", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MIN RSSI", buff);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_STAT_MAX_CURRENT:
|
case OSD_STAT_MAX_CURRENT:
|
||||||
if (batteryConfig()->currentMeterSource != CURRENT_METER_NONE) {
|
if (batteryConfig()->currentMeterSource != CURRENT_METER_NONE) {
|
||||||
tfp_sprintf(buff, "%d%c", stats.max_current, SYM_AMP);
|
tfp_sprintf(buff, "%d%c", stats.max_current, SYM_AMP);
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX CURRENT", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX CURRENT", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -802,7 +803,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_USED_MAH:
|
case OSD_STAT_USED_MAH:
|
||||||
if (batteryConfig()->currentMeterSource != CURRENT_METER_NONE) {
|
if (batteryConfig()->currentMeterSource != CURRENT_METER_NONE) {
|
||||||
tfp_sprintf(buff, "%d%c", getMAhDrawn(), SYM_MAH);
|
tfp_sprintf(buff, "%d%c", getMAhDrawn(), SYM_MAH);
|
||||||
osdDisplayStatisticLabel(displayRow, "USED MAH", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "USED MAH", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -810,7 +811,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_WATT_HOURS_DRAWN:
|
case OSD_STAT_WATT_HOURS_DRAWN:
|
||||||
if (batteryConfig()->currentMeterSource != CURRENT_METER_NONE) {
|
if (batteryConfig()->currentMeterSource != CURRENT_METER_NONE) {
|
||||||
osdPrintFloat(buff, SYM_NONE, getWhDrawn(), "", 2, true, SYM_NONE);
|
osdPrintFloat(buff, SYM_NONE, getWhDrawn(), "", 2, true, SYM_NONE);
|
||||||
osdDisplayStatisticLabel(displayRow, "USED WATT HOURS", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "USED WATT HOURS", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -819,7 +820,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_BLACKBOX:
|
case OSD_STAT_BLACKBOX:
|
||||||
if (blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) {
|
if (blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) {
|
||||||
osdGetBlackboxStatusString(buff);
|
osdGetBlackboxStatusString(buff);
|
||||||
osdDisplayStatisticLabel(displayRow, "BLACKBOX", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "BLACKBOX", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -829,7 +830,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
int32_t logNumber = blackboxGetLogNumber();
|
int32_t logNumber = blackboxGetLogNumber();
|
||||||
if (logNumber >= 0) {
|
if (logNumber >= 0) {
|
||||||
itoa(logNumber, buff, 10);
|
itoa(logNumber, buff, 10);
|
||||||
osdDisplayStatisticLabel(displayRow, "BB LOG NUM", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "BB LOG NUM", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -840,7 +841,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_MAX_G_FORCE:
|
case OSD_STAT_MAX_G_FORCE:
|
||||||
if (sensors(SENSOR_ACC)) {
|
if (sensors(SENSOR_ACC)) {
|
||||||
osdPrintFloat(buff, SYM_NONE, stats.max_g_force, "", 1, true, 'G');
|
osdPrintFloat(buff, SYM_NONE, stats.max_g_force, "", 1, true, 'G');
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX G-FORCE", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX G-FORCE", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -854,7 +855,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
ix = tfp_sprintf(buff, "%d ", stats.max_esc_temp_ix);
|
ix = tfp_sprintf(buff, "%d ", stats.max_esc_temp_ix);
|
||||||
}
|
}
|
||||||
tfp_sprintf(buff + ix, "%d%c", osdConvertTemperatureToSelectedUnit(stats.max_esc_temp), osdGetTemperatureSymbolForSelectedUnit());
|
tfp_sprintf(buff + ix, "%d%c", osdConvertTemperatureToSelectedUnit(stats.max_esc_temp), osdGetTemperatureSymbolForSelectedUnit());
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX ESC TEMP", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX ESC TEMP", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -862,7 +863,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
#if defined(USE_ESC_SENSOR) || defined(USE_DSHOT_TELEMETRY)
|
#if defined(USE_ESC_SENSOR) || defined(USE_DSHOT_TELEMETRY)
|
||||||
case OSD_STAT_MAX_ESC_RPM:
|
case OSD_STAT_MAX_ESC_RPM:
|
||||||
itoa(stats.max_esc_rpm, buff, 10);
|
itoa(stats.max_esc_rpm, buff, 10);
|
||||||
osdDisplayStatisticLabel(displayRow, "MAX ESC RPM", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MAX ESC RPM", buff);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -870,7 +871,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
case OSD_STAT_MIN_LINK_QUALITY:
|
case OSD_STAT_MIN_LINK_QUALITY:
|
||||||
tfp_sprintf(buff, "%d", stats.min_link_quality);
|
tfp_sprintf(buff, "%d", stats.min_link_quality);
|
||||||
strcat(buff, "%");
|
strcat(buff, "%");
|
||||||
osdDisplayStatisticLabel(displayRow, "MIN LINK", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MIN LINK", buff);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -880,9 +881,9 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
int value = getMaxFFT();
|
int value = getMaxFFT();
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
tfp_sprintf(buff, "%dHZ", value);
|
tfp_sprintf(buff, "%dHZ", value);
|
||||||
osdDisplayStatisticLabel(displayRow, "PEAK FFT", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "PEAK FFT", buff);
|
||||||
} else {
|
} else {
|
||||||
osdDisplayStatisticLabel(displayRow, "PEAK FFT", "THRT<20%");
|
osdDisplayStatisticLabel(midCol, displayRow, "PEAK FFT", "THRT<20%");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -892,27 +893,27 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
#ifdef USE_RX_RSSI_DBM
|
#ifdef USE_RX_RSSI_DBM
|
||||||
case OSD_STAT_MIN_RSSI_DBM:
|
case OSD_STAT_MIN_RSSI_DBM:
|
||||||
tfp_sprintf(buff, "%3d", stats.min_rssi_dbm);
|
tfp_sprintf(buff, "%3d", stats.min_rssi_dbm);
|
||||||
osdDisplayStatisticLabel(displayRow, "MIN RSSI DBM", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MIN RSSI DBM", buff);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RX_RSNR
|
#ifdef USE_RX_RSNR
|
||||||
case OSD_STAT_MIN_RSNR:
|
case OSD_STAT_MIN_RSNR:
|
||||||
tfp_sprintf(buff, "%3d", stats.min_rsnr);
|
tfp_sprintf(buff, "%3d", stats.min_rsnr);
|
||||||
osdDisplayStatisticLabel(displayRow, "MIN RSNR", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "MIN RSNR", buff);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_PERSISTENT_STATS
|
#ifdef USE_PERSISTENT_STATS
|
||||||
case OSD_STAT_TOTAL_FLIGHTS:
|
case OSD_STAT_TOTAL_FLIGHTS:
|
||||||
itoa(statsConfig()->stats_total_flights, buff, 10);
|
itoa(statsConfig()->stats_total_flights, buff, 10);
|
||||||
osdDisplayStatisticLabel(displayRow, "TOTAL FLIGHTS", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "TOTAL FLIGHTS", buff);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_STAT_TOTAL_TIME: {
|
case OSD_STAT_TOTAL_TIME: {
|
||||||
int minutes = statsConfig()->stats_total_time_s / 60;
|
int minutes = statsConfig()->stats_total_time_s / 60;
|
||||||
tfp_sprintf(buff, "%d:%02dH", minutes / 60, minutes % 60);
|
tfp_sprintf(buff, "%d:%02dH", minutes / 60, minutes % 60);
|
||||||
osdDisplayStatisticLabel(displayRow, "TOTAL FLIGHT TIME", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "TOTAL FLIGHT TIME", buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,7 +925,7 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
||||||
} else {
|
} else {
|
||||||
tfp_sprintf(buff, "%d%c", statsConfig()->stats_total_dist_m / METERS_PER_KILOMETER, SYM_KM);
|
tfp_sprintf(buff, "%d%c", statsConfig()->stats_total_dist_m / METERS_PER_KILOMETER, SYM_KM);
|
||||||
}
|
}
|
||||||
osdDisplayStatisticLabel(displayRow, "TOTAL DISTANCE", buff);
|
osdDisplayStatisticLabel(midCol, displayRow, "TOTAL DISTANCE", buff);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -955,6 +956,8 @@ static void osdRenderStatsBegin(void)
|
||||||
// call repeatedly until it returns true which indicates that all stats have been rendered.
|
// call repeatedly until it returns true which indicates that all stats have been rendered.
|
||||||
static bool osdRenderStatsContinue(void)
|
static bool osdRenderStatsContinue(void)
|
||||||
{
|
{
|
||||||
|
uint8_t midCol = osdDisplayPort->cols / 2;
|
||||||
|
|
||||||
if (osdStatsRenderingState.row == 0) {
|
if (osdStatsRenderingState.row == 0) {
|
||||||
|
|
||||||
bool displayLabel = false;
|
bool displayLabel = false;
|
||||||
|
@ -971,7 +974,7 @@ static bool osdRenderStatsContinue(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayLabel) {
|
if (displayLabel) {
|
||||||
displayWrite(osdDisplayPort, 2, osdStatsRenderingState.row++, DISPLAYPORT_ATTR_NORMAL, " --- STATS ---");
|
displayWrite(osdDisplayPort, midCol - (strlen("--- STATS ---") / 2), osdStatsRenderingState.row++, DISPLAYPORT_ATTR_NORMAL, "--- STATS ---");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1064,6 +1067,8 @@ static bool osdRefreshStats(void)
|
||||||
|
|
||||||
static timeDelta_t osdShowArmed(void)
|
static timeDelta_t osdShowArmed(void)
|
||||||
{
|
{
|
||||||
|
uint8_t midRow = osdDisplayPort->rows / 2;
|
||||||
|
uint8_t midCol = osdDisplayPort->cols / 2;
|
||||||
timeDelta_t ret;
|
timeDelta_t ret;
|
||||||
|
|
||||||
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
|
@ -1076,10 +1081,10 @@ static timeDelta_t osdShowArmed(void)
|
||||||
} else {
|
} else {
|
||||||
ret = (REFRESH_1S / 2);
|
ret = (REFRESH_1S / 2);
|
||||||
}
|
}
|
||||||
displayWrite(osdDisplayPort, 12, 7, DISPLAYPORT_ATTR_NORMAL, "ARMED");
|
displayWrite(osdDisplayPort, midCol - (strlen("ARMED") / 2), midRow, DISPLAYPORT_ATTR_NORMAL, "ARMED");
|
||||||
|
|
||||||
if (isFlipOverAfterCrashActive()) {
|
if (isFlipOverAfterCrashActive()) {
|
||||||
displayWrite(osdDisplayPort, 8, 8, DISPLAYPORT_ATTR_NORMAL, CRASH_FLIP_WARNING);
|
displayWrite(osdDisplayPort, midCol - (strlen(CRASH_FLIP_WARNING) / 2), midRow + 1, DISPLAYPORT_ATTR_NORMAL, CRASH_FLIP_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -137,7 +137,7 @@ void doTestArm(bool testEmpty = true)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// arming alert displayed
|
// arming alert displayed
|
||||||
displayPortTestBufferSubstring(12, 7, "ARMED");
|
displayPortTestBufferSubstring(13, 8, "ARMED");
|
||||||
|
|
||||||
// given
|
// given
|
||||||
// armed alert times out (0.5 seconds)
|
// armed alert times out (0.5 seconds)
|
||||||
|
@ -221,9 +221,9 @@ TEST(LQTest, TestInit)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// display buffer should contain splash screen
|
// display buffer should contain splash screen
|
||||||
displayPortTestBufferSubstring(7, 8, "MENU:THR MID");
|
displayPortTestBufferSubstring(7, 10, "MENU:THR MID");
|
||||||
displayPortTestBufferSubstring(11, 9, "+ YAW LEFT");
|
displayPortTestBufferSubstring(11, 11, "+ YAW LEFT");
|
||||||
displayPortTestBufferSubstring(11, 10, "+ PITCH UP");
|
displayPortTestBufferSubstring(11, 12, "+ PITCH UP");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
// splash screen timeout has elapsed
|
// splash screen timeout has elapsed
|
||||||
|
|
|
@ -168,7 +168,7 @@ void doTestArm(bool testEmpty = true)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// arming alert displayed
|
// arming alert displayed
|
||||||
displayPortTestBufferSubstring(12, 7, "ARMED");
|
displayPortTestBufferSubstring(13, 8, "ARMED");
|
||||||
|
|
||||||
// given
|
// given
|
||||||
// armed alert times out (0.5 seconds)
|
// armed alert times out (0.5 seconds)
|
||||||
|
@ -220,7 +220,7 @@ void doTestDisarm()
|
||||||
enabledStats >>= 1;
|
enabledStats >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayPortTestBufferSubstring(2, 7 - count / 2, " --- STATS ---");
|
displayPortTestBufferSubstring(9, 7 - count / 2, "--- STATS ---");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,9 +363,9 @@ TEST_F(OsdTest, TestInit)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// display buffer should contain splash screen
|
// display buffer should contain splash screen
|
||||||
displayPortTestBufferSubstring(7, 8, "MENU:THR MID");
|
displayPortTestBufferSubstring(7, 10, "MENU:THR MID");
|
||||||
displayPortTestBufferSubstring(11, 9, "+ YAW LEFT");
|
displayPortTestBufferSubstring(11, 11, "+ YAW LEFT");
|
||||||
displayPortTestBufferSubstring(11, 10, "+ PITCH UP");
|
displayPortTestBufferSubstring(11, 12, "+ PITCH UP");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
// splash screen timeout has elapsed
|
// splash screen timeout has elapsed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue