add max esc temp and rpm to osd
This commit is contained in:
parent
2d68e9c387
commit
ef17d7fc31
|
@ -1044,6 +1044,8 @@ const clivalue_t valueTable[] = {
|
|||
{ "osd_stat_bbox", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = OSD_STAT_BLACKBOX, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats)},
|
||||
{ "osd_stat_bb_no", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = OSD_STAT_BLACKBOX_NUMBER, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats)},
|
||||
{ "osd_stat_max_g_force", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = OSD_STAT_MAX_G_FORCE, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats)},
|
||||
{ "osd_stat_max_esc_temp", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = OSD_STAT_MAX_ESC_TEMP, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats)},
|
||||
{ "osd_stat_max_esc_rpm", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = OSD_STAT_MAX_ESC_RPM, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats)},
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -139,6 +139,8 @@ typedef struct statistic_s {
|
|||
int32_t max_altitude;
|
||||
int16_t max_distance;
|
||||
float max_g_force;
|
||||
int16_t max_esc_temp;
|
||||
int32_t max_esc_rpm;
|
||||
} statistic_t;
|
||||
|
||||
static statistic_t stats;
|
||||
|
@ -1293,6 +1295,8 @@ static void osdResetStats(void)
|
|||
stats.max_distance = 0;
|
||||
stats.armed_time = 0;
|
||||
stats.max_g_force = 0;
|
||||
stats.max_esc_temp = 0;
|
||||
stats.max_esc_rpm = 0;
|
||||
}
|
||||
|
||||
static void osdUpdateStats(void)
|
||||
|
@ -1345,6 +1349,18 @@ static void osdUpdateStats(void)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_ESC_SENSOR
|
||||
if (featureIsEnabled(FEATURE_ESC_SENSOR)) {
|
||||
value = (escDataCombined->temperature * 10) / 10;
|
||||
if (stats.max_esc_temp < value) {
|
||||
stats.max_esc_temp = value;
|
||||
}
|
||||
value = calcEscRpm(escDataCombined->rpm);
|
||||
if (stats.max_esc_rpm < value) {
|
||||
stats.max_esc_rpm = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_BLACKBOX
|
||||
|
@ -1446,6 +1462,16 @@ static void osdShowStats(uint16_t endBatteryVoltage)
|
|||
osdDisplayStatisticLabel(top++, "MAX SPEED", buff);
|
||||
}
|
||||
|
||||
if (osdStatGetState(OSD_STAT_MAX_ESC_TEMP)) {
|
||||
tfp_sprintf(buff, "%3d%c", osdConvertTemperatureToSelectedUnit(stats.max_esc_temp * 10) / 10, osdGetTemperatureSymbolForSelectedUnit());
|
||||
osdDisplayStatisticLabel(top++, "MAX ESC TEMP", buff);
|
||||
}
|
||||
|
||||
if (osdStatGetState(OSD_STAT_MAX_ESC_RPM)) {
|
||||
itoa(stats.max_esc_rpm, buff, 10);
|
||||
osdDisplayStatisticLabel(top++, "MAX ESC RPM", buff);
|
||||
}
|
||||
|
||||
if (osdStatGetState(OSD_STAT_MAX_DISTANCE)) {
|
||||
tfp_sprintf(buff, "%d%c", osdGetMetersToSelectedUnit(stats.max_distance), osdGetMetersToSelectedUnitSymbol());
|
||||
osdDisplayStatisticLabel(top++, "MAX DISTANCE", buff);
|
||||
|
|
|
@ -126,6 +126,8 @@ typedef enum {
|
|||
OSD_STAT_BLACKBOX,
|
||||
OSD_STAT_BLACKBOX_NUMBER,
|
||||
OSD_STAT_MAX_G_FORCE,
|
||||
OSD_STAT_MAX_ESC_TEMP,
|
||||
OSD_STAT_MAX_ESC_RPM,
|
||||
OSD_STAT_COUNT // MUST BE LAST
|
||||
} osd_stats_e;
|
||||
|
||||
|
|
|
@ -305,6 +305,8 @@ TEST(OsdTest, TestStatsImperial)
|
|||
osdStatSetState(OSD_STAT_MAX_DISTANCE, true);
|
||||
osdStatSetState(OSD_STAT_BLACKBOX_NUMBER, false);
|
||||
osdStatSetState(OSD_STAT_MAX_G_FORCE, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ESC_TEMP, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ESC_RPM, false);
|
||||
|
||||
// and
|
||||
// using imperial unit system
|
||||
|
|
Loading…
Reference in New Issue