Skip to content

Commit

Permalink
Merge pull request #10589 from iNavFlight/mmosca-dji-fix-this
Browse files Browse the repository at this point in the history
A little reminder on the OSD
  • Loading branch information
mmosca authored Jan 13, 2025
2 parents f0fcd15 + 2b488e7 commit 0c5754f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
25 changes: 16 additions & 9 deletions src/main/io/displayport_msp_dji_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
#include "io/displayport_msp_dji_compat.h"
#include "io/dji_osd_symbols.h"
#include "drivers/osd_symbols.h"
#include <string.h>

// 0123456789
static char *dji_logo = " DJI, FIX "
" THE OSD "
" FOR O3 "
" AND O4 ";

uint8_t getDJICharacter(uint8_t ch, uint8_t page)
{
Expand All @@ -37,6 +44,14 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page)
return DJI_SYM_AH_DECORATION;
}

if (ech >= SYM_LOGO_START && ech <= 297) {
return dji_logo[(ech - SYM_LOGO_START) % (strlen(dji_logo) + 1)];
}

if (ech >= SYM_PILOT_LOGO_LRG_START && ech <= 511) {
return dji_logo[(ech - SYM_LOGO_START) % (strlen(dji_logo) + 1)];
}

switch (ech) {
case SYM_RSSI:
return DJI_SYM_RSSI;
Expand Down Expand Up @@ -452,16 +467,8 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page)
case SYM_CROSS_TRACK_ERROR:
return DJI_SYM_CROSS_TRACK_ERROR;
case SYM_LOGO_START:
return DJI_SYM_LOGO_START;
case SYM_LOGO_WIDTH:
return DJI_SYM_LOGO_WIDTH;
case SYM_LOGO_HEIGHT:
return DJI_SYM_LOGO_HEIGHT;
*/

case SYM_AH_LEFT:
return DJI_SYM_AH_LEFT;

Expand Down
9 changes: 1 addition & 8 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4401,18 +4401,11 @@ uint8_t drawLogos(bool singular, uint8_t row) {
bool usePilotLogo = (osdConfig()->use_pilot_logo && osdDisplayIsHD());
bool useINAVLogo = (singular && !usePilotLogo) || !singular;

#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is in use, the pilot logo cannot be used, due to font issues.
if (isDJICompatibleVideoSystem(osdConfig())) {
usePilotLogo = false;
useINAVLogo = false;
}
#endif

uint8_t logoSpacing = osdConfig()->inav_to_pilot_logo_spacing;

if (logoSpacing > 0 && ((osdDisplayPort->cols % 2) != (logoSpacing % 2))) {
logoSpacing++; // Add extra 1 character space between logos, if the odd/even of the OSD cols doesn't match the odd/even of the logo spacing
}
}

// Draw Logo(s)
if (usePilotLogo && !singular) {
Expand Down

0 comments on commit 0c5754f

Please sign in to comment.