Skip to content

Commit

Permalink
HDZERO - OSD Centering
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter committed Mar 22, 2024
1 parent ae97c69 commit c8768f6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ static escSensorData_t *escDataCombined;
#define AH_SIDEBAR_WIDTH_POS 7
#define AH_SIDEBAR_HEIGHT_POS 3

static uint8_t leftScreen;

static const char compassBar[] = {
SYM_HEADING_W,
SYM_HEADING_LINE, SYM_HEADING_DIVIDED_LINE, SYM_HEADING_LINE,
Expand Down Expand Up @@ -1163,19 +1165,25 @@ void osdInit(displayPort_t *osdDisplayPortToUse) {
armState = ARMING_FLAG(ARMED);
memset(blinkBits, 0, sizeof(blinkBits));
displayClearScreen(osdDisplayPort);
osdDrawLogo(3, 1);
#if defined(USE_HDZERO_OSD)
if (vcdProfile()->video_system == VIDEO_SYSTEM_HD) {
leftScreen = HDINDENT;
} else
#endif
{ leftScreen = SDINDENT;}
osdDrawLogo(leftScreen + 3, 1);
char string_buffer[30];
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
displayWrite(osdDisplayPort, 20, 6, string_buffer);
displayWrite(osdDisplayPort, leftScreen + 20, 6, string_buffer);
#ifdef USE_CMS
displayWrite(osdDisplayPort, 7, 8, CMS_STARTUP_HELP_TEXT1);
displayWrite(osdDisplayPort, 11, 9, CMS_STARTUP_HELP_TEXT2);
displayWrite(osdDisplayPort, 11, 10, CMS_STARTUP_HELP_TEXT3);
displayWrite(osdDisplayPort, leftScreen + 7, 8, CMS_STARTUP_HELP_TEXT1);
displayWrite(osdDisplayPort, leftScreen + 11, 9, CMS_STARTUP_HELP_TEXT2);
displayWrite(osdDisplayPort, leftScreen + 11, 10, CMS_STARTUP_HELP_TEXT3);
#endif
#ifdef USE_RTC_TIME
char dateTimeBuffer[FORMATTED_DATE_TIME_BUFSIZE];
if (osdFormatRtcDateTime(&dateTimeBuffer[0])) {
displayWrite(osdDisplayPort, 5, 12, dateTimeBuffer);
displayWrite(osdDisplayPort, leftScreen + 5, 12, dateTimeBuffer);
}
#endif
displayResync(osdDisplayPort);
Expand Down Expand Up @@ -1483,12 +1491,12 @@ static timeDelta_t osdShowArmed(void)
timeDelta_t ret;
displayClearScreen(osdDisplayPort);
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !everArmed)) {
osdDrawLogo(3, 1);
osdDrawLogo(leftScreen + 3, 1);
ret = osdConfig()->logo_on_arming_duration * 1e5;
} else {
ret = (REFRESH_1S / 2);
}
displayWrite(osdDisplayPort, 12, 7, "ARMED");
displayWrite(osdDisplayPort, leftScreen + 12, 7, "ARMED");
everArmed = true;
return ret;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/io/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "common/time.h"
#include "pg/pg.h"
#include "pg/vcd.h"

#define OSD_NUM_TIMER_TYPES 3
extern const char * const osdTimerSourceNames[OSD_NUM_TIMER_TYPES];
Expand All @@ -44,6 +45,9 @@ extern const char * const osdTimerSourceNames[OSD_NUM_TIMER_TYPES];
#define OSD_X(x) ((x & OSD_POSITION_XY_MASK) | ((x & OSD_POSITION_XHD_MASK) >> (OSD_POSITION_BIT_XHD - OSD_POSITION_BITS)))
#define OSD_Y(x) ((x >> OSD_POSITION_BITS) & OSD_POSITION_XY_MASK)

#define SDINDENT 0 //Analog leftmost character for OSD Init and Menus
#define HDINDENT 15 //HD leftmost character for OSD Init and Menus

// Timer configuration
// Stored as 15[alarm:8][precision:4][source:4]0
#define OSD_TIMER(src, prec, alarm) ((src & 0x0F) | ((prec & 0x0F) << 4) | ((alarm & 0xFF ) << 8))
Expand Down
3 changes: 2 additions & 1 deletion src/main/pg/vcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
enum VIDEO_SYSTEMS {
VIDEO_SYSTEM_AUTO = 0,
VIDEO_SYSTEM_PAL,
VIDEO_SYSTEM_NTSC
VIDEO_SYSTEM_NTSC,
VIDEO_SYSTEM_HD
};

typedef struct vcdProfile_s {
Expand Down

0 comments on commit c8768f6

Please sign in to comment.