Skip to content

Commit

Permalink
OSD - fix macro arguments (betaflight#14074)
Browse files Browse the repository at this point in the history
  • Loading branch information
ledvinap authored Dec 9, 2024
1 parent 8ef7344 commit 663427b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/osd/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ extern const char * const osdTimerSourceNames[OSD_NUM_TIMER_TYPES];
#define OSD_POSITION_XHD_MASK (1 << OSD_POSITION_BIT_XHD)
#define OSD_POSITION_XY_MASK ((1 << OSD_POSITION_BITS) - 1)
#define OSD_TYPE_MASK 0xC000 // bits 14-15
#define OSD_POS(x,y) ((x & OSD_POSITION_XY_MASK) | ((x << (OSD_POSITION_BIT_XHD - OSD_POSITION_BITS)) & OSD_POSITION_XHD_MASK) | \
((y & OSD_POSITION_XY_MASK) << OSD_POSITION_BITS))
#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 OSD_TYPE(x) ((x & OSD_TYPE_MASK) >> 14)
#define OSD_POS(x, y) (((x) & OSD_POSITION_XY_MASK) \
| (((x) << (OSD_POSITION_BIT_XHD - OSD_POSITION_BITS)) & OSD_POSITION_XHD_MASK) \
| (((y) & OSD_POSITION_XY_MASK) << OSD_POSITION_BITS)) \
/**/
#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 OSD_TYPE(x) (((x) & OSD_TYPE_MASK) >> 14)

#define OSD_SD_COLS VIDEO_COLUMNS_SD
#define OSD_SD_ROWS VIDEO_LINES_PAL
Expand Down

0 comments on commit 663427b

Please sign in to comment.