mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Render spec screen over normal OSD (#13460)
This commit is contained in:
parent
9dfa09a07e
commit
dc00d34bfd
2 changed files with 21 additions and 31 deletions
|
@ -1462,31 +1462,10 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
if (resumeRefreshAt) {
|
if (resumeRefreshAt) {
|
||||||
osdState = OSD_STATE_TRANSFER;
|
osdState = OSD_STATE_TRANSFER;
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_SPEC_PREARM_SCREEN
|
|
||||||
osdState = OSD_STATE_REFRESH_PREARM;
|
|
||||||
#else
|
|
||||||
osdState = OSD_STATE_UPDATE_CANVAS;
|
osdState = OSD_STATE_UPDATE_CANVAS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OSD_STATE_REFRESH_PREARM:
|
|
||||||
{
|
|
||||||
#ifdef USE_SPEC_PREARM_SCREEN
|
|
||||||
if (!ARMING_FLAG(ARMED) && osdConfig()->osd_show_spec_prearm) {
|
|
||||||
if (osdDrawSpec(osdDisplayPort)) {
|
|
||||||
// Rendering is complete
|
|
||||||
osdState = OSD_STATE_COMMIT;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif // USE_SPEC_PREARM_SCREEN
|
|
||||||
{
|
|
||||||
osdState = OSD_STATE_UPDATE_CANVAS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OSD_STATE_UPDATE_CANVAS:
|
case OSD_STATE_UPDATE_CANVAS:
|
||||||
// Hide OSD when OSDSW mode is active
|
// Hide OSD when OSDSW mode is active
|
||||||
if (IS_RC_MODE_ACTIVE(BOXOSD)) {
|
if (IS_RC_MODE_ACTIVE(BOXOSD)) {
|
||||||
|
@ -1555,10 +1534,27 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
osdState = OSD_STATE_COMMIT;
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
if (!ARMING_FLAG(ARMED) && osdConfig()->osd_show_spec_prearm) {
|
||||||
|
osdState = OSD_STATE_REFRESH_PREARM;
|
||||||
|
} else
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
{
|
||||||
|
osdState = OSD_STATE_COMMIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
|
case OSD_STATE_REFRESH_PREARM:
|
||||||
|
if (osdDrawSpec(osdDisplayPort)) {
|
||||||
|
// Rendering is complete
|
||||||
|
osdState = OSD_STATE_COMMIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
|
||||||
case OSD_STATE_COMMIT:
|
case OSD_STATE_COMMIT:
|
||||||
displayCommitTransaction(osdDisplayPort);
|
displayCommitTransaction(osdDisplayPort);
|
||||||
|
|
||||||
|
|
|
@ -2199,7 +2199,7 @@ bool osdDrawNextActiveElement(displayPort_t *osdDisplayPort, timeUs_t currentTim
|
||||||
#ifdef USE_SPEC_PREARM_SCREEN
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
||||||
{
|
{
|
||||||
static enum {CLR, RPM, POLES, MIXER, THR, MOTOR, BAT, VER} specState = CLR;
|
static enum {RPM, POLES, MIXER, THR, MOTOR, BAT, VER} specState = RPM;
|
||||||
static int currentRow;
|
static int currentRow;
|
||||||
|
|
||||||
const uint8_t midRow = osdDisplayPort->rows / 2;
|
const uint8_t midRow = osdDisplayPort->rows / 2;
|
||||||
|
@ -2211,14 +2211,8 @@ bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
||||||
|
|
||||||
switch (specState) {
|
switch (specState) {
|
||||||
default:
|
default:
|
||||||
case CLR:
|
|
||||||
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_NONE);
|
|
||||||
currentRow = midRow - 3;
|
|
||||||
|
|
||||||
specState = RPM;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RPM:
|
case RPM:
|
||||||
|
currentRow = midRow - 3;
|
||||||
#ifdef USE_RPM_LIMIT
|
#ifdef USE_RPM_LIMIT
|
||||||
{
|
{
|
||||||
const bool rpmLimitActive = mixerConfig()->rpm_limit > 0 && isMotorProtocolBidirDshot();
|
const bool rpmLimitActive = mixerConfig()->rpm_limit > 0 && isMotorProtocolBidirDshot();
|
||||||
|
@ -2283,7 +2277,7 @@ bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
||||||
len = strlen(FC_VERSION_STRING);
|
len = strlen(FC_VERSION_STRING);
|
||||||
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, FC_VERSION_STRING);
|
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, FC_VERSION_STRING);
|
||||||
|
|
||||||
specState = CLR;
|
specState = RPM;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue