Skip to content

Commit

Permalink
Merge pull request #3149 from iNavFlight/agh_armed_ntsc_fix
Browse files Browse the repository at this point in the history
Fix vertical alignment of ARMED screen on NTSC
  • Loading branch information
digitalentity authored May 3, 2018
2 parents 969e8e2 + 8ba3e6a commit 656f0a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
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

0 comments on commit 656f0a6

Please sign in to comment.