Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust SW blink interval #9644

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/drivers/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "config/parameter_group.h"

#define SW_BLINK_CYCLE_MS 200 // 200ms on / 200ms off
#define SW_BLINK_CYCLE_MS 500 // Xms on / Xms off

#define getBlinkOnOff() ( (millis() / SW_BLINK_CYCLE_MS) & 1 )

Expand Down
26 changes: 6 additions & 20 deletions src/main/io/displayport_msp_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, con
static int drawScreen(displayPort_t *displayPort) // 250Hz
{
static uint8_t counter = 0;
static bool lastBlinkStatus = false;
bool blinkStatus = getBlinkOnOff();

if ((!cmsInMenu && IS_RC_MODE_ACTIVE(BOXOSD)) || (counter++ % DRAW_FREQ_DENOM)) { // 62.5Hz
return 0;
Expand All @@ -277,19 +275,6 @@ static int drawScreen(displayPort_t *displayPort) // 250Hz
sendSubFrameMs = (osdConfig()->msp_displayport_fullframe_interval > 0) ? (millis() + DS2MS(osdConfig()->msp_displayport_fullframe_interval)) : 0;
}

if (lastBlinkStatus != blinkStatus) {
if (displayConfig()->force_sw_blink) {
// Make sure any blinking characters are updated
for (unsigned int pos = 0; pos < sizeof(screen); pos++) {
if (bitArrayGet(blinkChar, pos)) {
bitArraySet(dirty, pos);
}
}
}

lastBlinkStatus = blinkStatus;
}

uint8_t subcmd[COLS + 4];
uint8_t updateCount = 0;
subcmd[0] = MSP_DP_WRITE_STRING;
Expand All @@ -309,9 +294,6 @@ static int drawScreen(displayPort_t *displayPort) // 250Hz
do {
bitArrayClr(dirty, pos);
subcmd[len] = isBfCompatibleVideoSystem(osdConfig()) ? getBfCharacter(screen[pos++], page): screen[pos++];
if (bitArrayGet(blinkChar, pos) && displayConfig()->force_sw_blink && blinkStatus) {
subcmd[len] = SYM_BLANK;
}
len++;

if (bitArrayGet(dirty, pos)) {
Expand All @@ -323,7 +305,7 @@ static int drawScreen(displayPort_t *displayPort) // 250Hz
attributes |= (page << DISPLAYPORT_MSP_ATTR_FONTPAGE);
}

if (blink && !displayConfig()->force_sw_blink) {
if (blink) {
attributes |= (1 << DISPLAYPORT_MSP_ATTR_BLINK);
}

Expand All @@ -349,7 +331,7 @@ static int drawScreen(displayPort_t *displayPort) // 250Hz
vtxReset = false;
}

return 0;
return 0;
}

static void resync(displayPort_t *displayPort)
Expand Down Expand Up @@ -380,6 +362,10 @@ static bool getFontMetadata(displayFontMetadata_t *metadata, const displayPort_t
static textAttributes_t supportedTextAttributes(const displayPort_t *displayPort)
{
UNUSED(displayPort);

//textAttributes_t attr = TEXT_ATTRIBUTES_NONE;
//TEXT_ATTRIBUTES_ADD_BLINK(attr);
//return attr;
return TEXT_ATTRIBUTES_NONE;
}

Expand Down
Loading