mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Add core (MCU) temperature to OSD
This commit is contained in:
parent
d14cd23761
commit
f8e4d02c99
5 changed files with 47 additions and 1 deletions
|
@ -767,6 +767,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "osd_esc_rpm_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ESC_RPM]) },
|
{ "osd_esc_rpm_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ESC_RPM]) },
|
||||||
{ "osd_rtc_date_time_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_RTC_DATETIME]) },
|
{ "osd_rtc_date_time_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_RTC_DATETIME]) },
|
||||||
{ "osd_adjustment_range_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ADJUSTMENT_RANGE]) },
|
{ "osd_adjustment_range_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ADJUSTMENT_RANGE]) },
|
||||||
|
{ "osd_core_temp_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_CORE_TEMPERATURE]) },
|
||||||
|
|
||||||
{ "osd_stat_max_spd", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats[OSD_STAT_MAX_SPEED])},
|
{ "osd_stat_max_spd", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats[OSD_STAT_MAX_SPEED])},
|
||||||
{ "osd_stat_max_dist", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats[OSD_STAT_MAX_DISTANCE])},
|
{ "osd_stat_max_dist", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats[OSD_STAT_MAX_DISTANCE])},
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
|
|
||||||
#include "rx/rx.h"
|
#include "rx/rx.h"
|
||||||
|
|
||||||
|
#include "sensors/adcinternal.h"
|
||||||
#include "sensors/barometer.h"
|
#include "sensors/barometer.h"
|
||||||
#include "sensors/battery.h"
|
#include "sensors/battery.h"
|
||||||
#include "sensors/esc_sensor.h"
|
#include "sensors/esc_sensor.h"
|
||||||
|
@ -756,7 +757,12 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
#ifdef USE_OSD_ADJUSTMENTS
|
#ifdef USE_OSD_ADJUSTMENTS
|
||||||
case OSD_ADJUSTMENT_RANGE:
|
case OSD_ADJUSTMENT_RANGE:
|
||||||
tfp_sprintf(buff, "%s: %3d", adjustmentRangeName, adjustmentRangeValue);
|
tfp_sprintf(buff, "%s: %3d", adjustmentRangeName, adjustmentRangeValue);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_ADC_INTERNAL
|
||||||
|
case OSD_CORE_TEMPERATURE:
|
||||||
|
tfp_sprintf(buff, "%02dC", getCoreTemperatureCelsius());
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -835,6 +841,10 @@ static void osdDrawElements(void)
|
||||||
#ifdef USE_OSD_ADJUSTMENTS
|
#ifdef USE_OSD_ADJUSTMENTS
|
||||||
osdDrawSingleElement(OSD_ADJUSTMENT_RANGE);
|
osdDrawSingleElement(OSD_ADJUSTMENT_RANGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_ADC_INTERNAL
|
||||||
|
osdDrawSingleElement(OSD_CORE_TEMPERATURE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgResetFn_osdConfig(osdConfig_t *osdConfig)
|
void pgResetFn_osdConfig(osdConfig_t *osdConfig)
|
||||||
|
|
|
@ -85,6 +85,7 @@ typedef enum {
|
||||||
OSD_REMAINING_TIME_ESTIMATE,
|
OSD_REMAINING_TIME_ESTIMATE,
|
||||||
OSD_RTC_DATETIME,
|
OSD_RTC_DATETIME,
|
||||||
OSD_ADJUSTMENT_RANGE,
|
OSD_ADJUSTMENT_RANGE,
|
||||||
|
OSD_CORE_TEMPERATURE,
|
||||||
OSD_ITEM_COUNT // MUST BE LAST
|
OSD_ITEM_COUNT // MUST BE LAST
|
||||||
} osd_items_e;
|
} osd_items_e;
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,8 @@ osd_unittest_SRC := \
|
||||||
|
|
||||||
osd_unittest_DEFINES := \
|
osd_unittest_DEFINES := \
|
||||||
USE_OSD \
|
USE_OSD \
|
||||||
USE_RTC_TIME
|
USE_RTC_TIME \
|
||||||
|
USE_ADC_INTERNAL
|
||||||
|
|
||||||
|
|
||||||
pg_unittest_SRC := \
|
pg_unittest_SRC := \
|
||||||
|
|
|
@ -77,6 +77,7 @@ extern "C" {
|
||||||
uint32_t simulationMahDrawn;
|
uint32_t simulationMahDrawn;
|
||||||
int32_t simulationAltitude;
|
int32_t simulationAltitude;
|
||||||
int32_t simulationVerticalSpeed;
|
int32_t simulationVerticalSpeed;
|
||||||
|
uint16_t simulationCoreTemperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #define DEBUG_OSD */
|
/* #define DEBUG_OSD */
|
||||||
|
@ -96,6 +97,7 @@ void setDefualtSimulationState()
|
||||||
simulationMahDrawn = 0;
|
simulationMahDrawn = 0;
|
||||||
simulationAltitude = 0;
|
simulationAltitude = 0;
|
||||||
simulationVerticalSpeed = 0;
|
simulationVerticalSpeed = 0;
|
||||||
|
simulationCoreTemperature = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -743,6 +745,35 @@ TEST(OsdTest, TestElementAltitude)
|
||||||
displayPortTestBufferSubstring(23, 7, " -2.4%c", SYM_M);
|
displayPortTestBufferSubstring(23, 7, " -2.4%c", SYM_M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tests the core temperature OSD element.
|
||||||
|
*/
|
||||||
|
TEST(OsdTest, TestElementCoreTemperature)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
osdConfigMutable()->item_pos[OSD_CORE_TEMPERATURE] = OSD_POS(1, 8) | VISIBLE_FLAG;
|
||||||
|
|
||||||
|
// and
|
||||||
|
simulationCoreTemperature = 0;
|
||||||
|
|
||||||
|
// when
|
||||||
|
displayClearScreen(&testDisplayPort);
|
||||||
|
osdRefresh(simulationTime);
|
||||||
|
|
||||||
|
// then
|
||||||
|
displayPortTestBufferSubstring(1, 8, "00C");
|
||||||
|
|
||||||
|
// given
|
||||||
|
simulationCoreTemperature = 33;
|
||||||
|
|
||||||
|
// when
|
||||||
|
displayClearScreen(&testDisplayPort);
|
||||||
|
osdRefresh(simulationTime);
|
||||||
|
|
||||||
|
// then
|
||||||
|
displayPortTestBufferSubstring(1, 8, "33C");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tests the battery notifications shown on the warnings OSD element.
|
* Tests the battery notifications shown on the warnings OSD element.
|
||||||
*/
|
*/
|
||||||
|
@ -958,4 +989,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getRssi(void) { return rssi; }
|
uint16_t getRssi(void) { return rssi; }
|
||||||
|
|
||||||
|
uint16_t getCoreTemperatureCelsius(void) { return simulationCoreTemperature; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue