1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 09:45:37 +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:
Ivan Efimov 2023-12-09 18:50:31 -06:00 committed by GitHub
parent a92d87ebca
commit 31c5beaf78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 4 deletions

View file

@ -119,6 +119,8 @@
#include "build/build_config.h"
#include "build/debug.h"
#include "cli/settings.h"
#include "common/axis.h"
#include "common/maths.h"
#include "common/printf.h"
@ -2107,6 +2109,62 @@ bool osdDrawNextActiveElement(displayPort_t *osdDisplayPort, timeUs_t currentTim
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)
{
if (backgroundLayerSupported) {