diff --git a/src/driver/osd/displayport.h b/src/driver/osd/displayport.h index 4e40c83a6..e2bd1e8e6 100644 --- a/src/driver/osd/displayport.h +++ b/src/driver/osd/displayport.h @@ -4,9 +4,6 @@ #include "driver/osd/osd.h" -#define DISPLAYPORT_ROWS 18 -#define DISPLAYPORT_COLS 50 - void displayport_init(); bool displayport_is_ready(); void displayport_intro(); diff --git a/src/driver/osd/max7456.c b/src/driver/osd/max7456.c index c47ccf6b7..e4c506563 100644 --- a/src/driver/osd/max7456.c +++ b/src/driver/osd/max7456.c @@ -246,7 +246,7 @@ bool max7456_push_string(uint8_t attr, uint8_t x, uint8_t y, const uint8_t *data buf[offset++] = DMM; buf[offset++] = max7456_map_attr(attr); - const uint16_t pos = x + y * 30; + const uint16_t pos = x + y * MAX7456_COLS; buf[offset++] = DMAH; buf[offset++] = (pos >> 8) & 0xFF; buf[offset++] = DMAL; diff --git a/src/driver/osd/max7456.h b/src/driver/osd/max7456.h index 67b6ddd72..167b48fcc 100644 --- a/src/driver/osd/max7456.h +++ b/src/driver/osd/max7456.h @@ -6,9 +6,6 @@ #define MAX7456_READ_FLAG 0x80 -#define MAX7456_COLS 32 -#define MAX7456_ROWS 16 - #define VM0 0x00 #define VM1 0x01 #define VOS 0x03 diff --git a/src/driver/osd/osd.c b/src/driver/osd/osd.c index 0655db3e7..fd9d4123d 100644 --- a/src/driver/osd/osd.c +++ b/src/driver/osd/osd.c @@ -8,20 +8,17 @@ #include "io/simulator.h" #include "util/util.h" -#define MAX_ROWS DISPLAYPORT_ROWS -#define MAX_COLS DISPLAYPORT_COLS - -#define MAX_DISPLAY_SIZE (DISPLAYPORT_COLS * DISPLAYPORT_ROWS) +#define MAX_DISPLAY_SIZE (HD_COLS * HD_ROWS) static osd_segment_t osd_seg; static osd_device_t osd_device = OSD_DEVICE_NONE; static osd_char_t display[MAX_DISPLAY_SIZE]; -static bool display_row_dirty[DISPLAYPORT_ROWS]; +static bool display_row_dirty[HD_ROWS]; static bool display_dirty = false; -static uint8_t cols = DISPLAYPORT_COLS; -static uint8_t rows = DISPLAYPORT_ROWS; +static uint8_t cols = HD_COLS; +static uint8_t rows = HD_ROWS; void osd_device_init() { #ifdef USE_DIGITAL_VTX @@ -89,7 +86,7 @@ uint8_t osd_clear_async() { for (uint32_t i = 0; i < (MAX_DISPLAY_SIZE / 2); i++) { ((uint32_t *)display)[i] = ((0x20 << 16) | 0x20); } - memset(display_row_dirty, 0, MAX_ROWS * sizeof(bool)); + memset(display_row_dirty, 0, HD_ROWS * sizeof(bool)); display_dirty = false; state++; return 0; diff --git a/src/driver/osd/osd.h b/src/driver/osd/osd.h index cd6e771b6..f95f00efb 100644 --- a/src/driver/osd/osd.h +++ b/src/driver/osd/osd.h @@ -3,6 +3,18 @@ #include #include +#define MAX7456_COLS 30 +#define MAX7456_ROWS 16 + +#define DISPLAYPORT_ROWS 18 +#define DISPLAYPORT_COLS 50 + +#define HD_ROWS DISPLAYPORT_ROWS +#define HD_COLS DISPLAYPORT_COLS + +#define SD_COLS MAX7456_COLS +#define SD_ROWS MAX7456_ROWS + #define OSD_TXN_BUFFER 128 #define OSD_TXN_MAX 16 diff --git a/src/osd/render.c b/src/osd/render.c index eced5b243..2ec97f7af 100644 --- a/src/osd/render.c +++ b/src/osd/render.c @@ -31,9 +31,6 @@ #define HOLD 0 #define TEMP 1 -#define HD_ROWS 18 -#define HD_COLS 50 - extern profile_t profile; static vtx_settings_t vtx_settings_copy; @@ -1081,10 +1078,10 @@ void osd_display() { osd_menu_select(3, OSD_AUTO, osd_element_labels[i]); if (osd_menu_select_int(20, OSD_AUTO, el->pos_x, 3)) { - el->pos_x = osd_menu_adjust_int(el->pos_x, 1, 0, osd_system == OSD_SYS_HD ? HD_COLS : 30); + el->pos_x = osd_menu_adjust_int(el->pos_x, 1, 0, osd_system == OSD_SYS_HD ? HD_COLS : SD_COLS); } if (osd_menu_select_int(26, OSD_AUTO, el->pos_y, 3)) { - el->pos_y = osd_menu_adjust_int(el->pos_y, 1, 0, osd_system == OSD_SYS_HD ? HD_ROWS : 15); + el->pos_y = osd_menu_adjust_int(el->pos_y, 1, 0, osd_system == OSD_SYS_HD ? HD_ROWS : SD_ROWS); } } osd_menu_scroll_finish(3);