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

Fix vertical alignment of ARMED screen on NTSC #3149

Merged
merged 3 commits into from
May 3, 2018
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
4 changes: 4 additions & 0 deletions src/main/drivers/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ void displayClearScreen(displayPort_t *instance)

void displayDrawScreen(displayPort_t *instance)
{
if (instance->rows == 0 || instance->cols == 0) {
// Display not fully initialized yet
displayResync(instance);
}
instance->vTable->drawScreen(instance);
}

Expand Down
9 changes: 7 additions & 2 deletions src/main/drivers/max7456.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ static BITARRAY_DECLARE(screenIsDirty, VIDEO_BUFFER_CHARS_PAL);
#define MAX_CHARS2UPDATE 10
#define BYTES_PER_CHAR2UPDATE 8 // [3-4] spi regs + values for them

static bool firstInit = true;
static uint8_t videoSignalCfg = 0;
static uint8_t videoSignalReg = VIDEO_MODE_PAL | OSD_ENABLE; //PAL by default
static bool max7456Lock = false;
Expand All @@ -186,8 +187,13 @@ static int max7456PrepareBuffer(uint8_t * buf, int bufPtr, uint8_t add, uint8_t

uint8_t max7456GetRowsCount(void)
{
if (videoSignalReg & VIDEO_MODE_PAL)
if (firstInit) {
// Not initialized yet
return 0;
}
if (videoSignalReg & VIDEO_MODE_PAL) {
return VIDEO_LINES_PAL;
}

return VIDEO_LINES_NTSC;
}
Expand All @@ -201,7 +207,6 @@ void max7456ReInit(void)
int bufPtr;
uint8_t maxScreenRows;
uint8_t srdata = 0;
static bool firstInit = true;

// Check if device is available
if (max7456dev == NULL) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,8 @@ static void osdShowArmed(void)
char buf[MAX(32, FORMATTED_DATE_TIME_BUFSIZE)];
char *date;
char *time;
uint8_t y = 7;
// We need 6 visible rows
uint8_t y = MIN((osdDisplayPort->rows / 2) - 1, osdDisplayPort->rows - 6 - 1);

displayClearScreen(osdDisplayPort);
displayWrite(osdDisplayPort, 12, y, "ARMED");
Expand Down