Skip to content

Commit

Permalink
add osd row/col defines
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Aug 23, 2024
1 parent 9246ea3 commit 73f141d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
3 changes: 0 additions & 3 deletions src/driver/osd/displayport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/driver/osd/max7456.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/driver/osd/max7456.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions src/driver/osd/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/driver/osd/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
#include <stdbool.h>
#include <stdint.h>

#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

Expand Down
7 changes: 2 additions & 5 deletions src/osd/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 73f141d

Please sign in to comment.