mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
OSD spec prearm screen if defined USE_SPEC_PREARM_SCREEN (#13210)
* OSD spec prearm screen if defined USE_SPEC_PREARM_SCREEN * osd spec prearm PR suggestions * OSD_SPEC karatebrot logic suggestion * Update src/main/osd/osd.c Co-authored-by: Jan Post <Rm2k-Freak@web.de> --------- Co-authored-by: Jan Post <Rm2k-Freak@web.de>
This commit is contained in:
parent
a92d87ebca
commit
31c5beaf78
7 changed files with 83 additions and 4 deletions
|
@ -1381,6 +1381,9 @@ const clivalue_t valueTable[] = {
|
||||||
#ifdef USE_QUICK_OSD_MENU
|
#ifdef USE_QUICK_OSD_MENU
|
||||||
{ "osd_use_quick_menu", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, osd_use_quick_menu) },
|
{ "osd_use_quick_menu", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, osd_use_quick_menu) },
|
||||||
#endif // USE_QUICK_OSD_MENU
|
#endif // USE_QUICK_OSD_MENU
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
{ "osd_show_spec_prearm", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, osd_show_spec_prearm) },
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
{ "osd_tim1", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, INT16_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, timers[OSD_TIMER_1]) },
|
{ "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]) },
|
{ "osd_tim2", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, INT16_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, timers[OSD_TIMER_2]) },
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,11 @@ bool isMotorProtocolDshot(void)
|
||||||
return motorProtocolDshot;
|
return motorProtocolDshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isMotorProtocolBidirDshot(void)
|
||||||
|
{
|
||||||
|
return isMotorProtocolDshot() && motorConfig()->dev.useDshotTelemetry;
|
||||||
|
}
|
||||||
|
|
||||||
void motorDevInit(const motorDevConfig_t *motorDevConfig, uint16_t idlePulse, uint8_t motorCount)
|
void motorDevInit(const motorDevConfig_t *motorDevConfig, uint16_t idlePulse, uint8_t motorCount)
|
||||||
{
|
{
|
||||||
memset(motors, 0, sizeof(motors));
|
memset(motors, 0, sizeof(motors));
|
||||||
|
|
|
@ -89,6 +89,7 @@ unsigned motorDeviceCount(void);
|
||||||
motorVTable_t *motorGetVTable(void);
|
motorVTable_t *motorGetVTable(void);
|
||||||
bool checkMotorProtocolEnabled(const motorDevConfig_t *motorConfig, bool *protocolIsDshot);
|
bool checkMotorProtocolEnabled(const motorDevConfig_t *motorConfig, bool *protocolIsDshot);
|
||||||
bool isMotorProtocolDshot(void);
|
bool isMotorProtocolDshot(void);
|
||||||
|
bool isMotorProtocolBidirDshot(void);
|
||||||
bool isMotorProtocolEnabled(void);
|
bool isMotorProtocolEnabled(void);
|
||||||
|
|
||||||
void motorDisable(void);
|
void motorDisable(void);
|
||||||
|
|
|
@ -427,6 +427,9 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
|
||||||
#ifdef USE_QUICK_OSD_MENU
|
#ifdef USE_QUICK_OSD_MENU
|
||||||
osdConfig->osd_use_quick_menu = true;
|
osdConfig->osd_use_quick_menu = true;
|
||||||
#endif // USE_QUICK_OSD_MENU
|
#endif // USE_QUICK_OSD_MENU
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
osdConfig->osd_show_spec_prearm = true;
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgResetFn_osdElementConfig(osdElementConfig_t *osdElementConfig)
|
void pgResetFn_osdElementConfig(osdElementConfig_t *osdElementConfig)
|
||||||
|
@ -1577,6 +1580,9 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
// There are more elements to draw
|
// There are more elements to draw
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
osdDrawSpec(osdDisplayPort);
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
|
||||||
osdElementGroup = 0;
|
osdElementGroup = 0;
|
||||||
|
|
||||||
|
|
|
@ -340,17 +340,20 @@ typedef struct osdConfig_s {
|
||||||
uint16_t framerate_hz;
|
uint16_t framerate_hz;
|
||||||
uint8_t cms_background_type; // For supporting devices, determines whether the CMS background is transparent or opaque
|
uint8_t cms_background_type; // For supporting devices, determines whether the CMS background is transparent or opaque
|
||||||
uint8_t stat_show_cell_value;
|
uint8_t stat_show_cell_value;
|
||||||
#ifdef USE_CRAFTNAME_MSGS
|
#ifdef USE_CRAFTNAME_MSGS
|
||||||
uint8_t osd_craftname_msgs; // Insert LQ/RSSI-dBm and warnings into CraftName
|
uint8_t osd_craftname_msgs; // Insert LQ/RSSI-dBm and warnings into CraftName
|
||||||
#endif //USE_CRAFTNAME_MSGS
|
#endif //USE_CRAFTNAME_MSGS
|
||||||
uint8_t aux_channel;
|
uint8_t aux_channel;
|
||||||
uint16_t aux_scale;
|
uint16_t aux_scale;
|
||||||
uint8_t aux_symbol;
|
uint8_t aux_symbol;
|
||||||
uint8_t canvas_cols; // Canvas dimensions for HD display
|
uint8_t canvas_cols; // Canvas dimensions for HD display
|
||||||
uint8_t canvas_rows;
|
uint8_t canvas_rows;
|
||||||
#ifdef USE_QUICK_OSD_MENU
|
#ifdef USE_QUICK_OSD_MENU
|
||||||
uint8_t osd_use_quick_menu; // use QUICK menu YES/NO
|
uint8_t osd_use_quick_menu; // use QUICK menu YES/NO
|
||||||
#endif // USE_QUICK_OSD_MENU
|
#endif // USE_QUICK_OSD_MENU
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
uint8_t osd_show_spec_prearm;
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
} osdConfig_t;
|
} osdConfig_t;
|
||||||
|
|
||||||
PG_DECLARE(osdConfig_t, osdConfig);
|
PG_DECLARE(osdConfig_t, osdConfig);
|
||||||
|
|
|
@ -119,6 +119,8 @@
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "build/debug.h"
|
#include "build/debug.h"
|
||||||
|
|
||||||
|
#include "cli/settings.h"
|
||||||
|
|
||||||
#include "common/axis.h"
|
#include "common/axis.h"
|
||||||
#include "common/maths.h"
|
#include "common/maths.h"
|
||||||
#include "common/printf.h"
|
#include "common/printf.h"
|
||||||
|
@ -2107,6 +2109,62 @@ bool osdDrawNextActiveElement(displayPort_t *osdDisplayPort, timeUs_t currentTim
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
void osdDrawSpec(displayPort_t *osdDisplayPort)
|
||||||
|
{
|
||||||
|
if (!ARMING_FLAG(ARMED) && osdConfig()->osd_show_spec_prearm) {
|
||||||
|
const uint8_t midRow = osdDisplayPort->rows / 2;
|
||||||
|
const uint8_t midCol = osdDisplayPort->cols / 2;
|
||||||
|
|
||||||
|
char buff[OSD_ELEMENT_BUFFER_LENGTH] = "";
|
||||||
|
|
||||||
|
memset(buff,0,strlen(buff));
|
||||||
|
int len = 0;
|
||||||
|
int currentRow = midRow - 3;
|
||||||
|
|
||||||
|
#ifdef USE_RPM_LIMIT
|
||||||
|
const bool rpmLimitActive = mixerConfig()->rpm_limit > 0 && isMotorProtocolBidirDshot();
|
||||||
|
if (rpmLimitActive) {
|
||||||
|
len = tfp_sprintf(buff, "RPM LIMIT ON %d", mixerConfig()->rpm_limit_value);
|
||||||
|
} else {
|
||||||
|
len = tfp_sprintf(buff, "%s", "RPM LIMIT OFF");
|
||||||
|
}
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
|
||||||
|
if (rpmLimitActive) {
|
||||||
|
memset(buff,0,strlen(buff));
|
||||||
|
len = tfp_sprintf(buff, "KV %d POLES %d", motorConfig()->kv, motorConfig()->motorPoleCount);
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
|
||||||
|
memset(buff,0,strlen(buff));
|
||||||
|
len = tfp_sprintf(buff, "%d %d %d", mixerConfig()->rpm_limit_p, mixerConfig()->rpm_limit_i, mixerConfig()->rpm_limit_d);
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
} else
|
||||||
|
#endif // #USE_RPM_LIMIT
|
||||||
|
{
|
||||||
|
memset(buff,0,strlen(buff));
|
||||||
|
len = tfp_sprintf(buff, "THR LIMIT %s", lookupTableThrottleLimitType[currentControlRateProfile->throttle_limit_type]);
|
||||||
|
if (currentControlRateProfile->throttle_limit_type != THROTTLE_LIMIT_TYPE_OFF) {
|
||||||
|
len = tfp_sprintf(buff, "%s %d", buff, currentControlRateProfile->throttle_limit_percent);
|
||||||
|
}
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(buff,0,strlen(buff));
|
||||||
|
len = tfp_sprintf(buff, "MOTOR LIMIT %d", currentPidProfile->motor_output_limit);
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
|
||||||
|
memset(buff,0,strlen(buff));
|
||||||
|
const float batteryVoltage = getBatteryVoltage() / 100.0f;
|
||||||
|
len = osdPrintFloat(buff, osdGetBatterySymbol(getBatteryAverageCellVoltage()), batteryVoltage, "", 2, true, SYM_VOLT);
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
|
||||||
|
len = strlen(FC_VERSION_STRING);
|
||||||
|
displayWrite(osdDisplayPort, midCol - len/2, currentRow++, DISPLAYPORT_SEVERITY_NORMAL, FC_VERSION_STRING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
|
||||||
void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort)
|
void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort)
|
||||||
{
|
{
|
||||||
if (backgroundLayerSupported) {
|
if (backgroundLayerSupported) {
|
||||||
|
|
|
@ -64,3 +64,6 @@ void osdSyncBlink();
|
||||||
void osdResetAlarms(void);
|
void osdResetAlarms(void);
|
||||||
void osdUpdateAlarms(void);
|
void osdUpdateAlarms(void);
|
||||||
bool osdElementsNeedAccelerometer(void);
|
bool osdElementsNeedAccelerometer(void);
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
void osdDrawSpec(displayPort_t *osdDisplayPort);
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue