From b6aa3c96022d9bd1266d608fffd53acfd4cea0ad Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 10:42:53 +0100 Subject: [PATCH 1/9] Add a reminder to fix OSD --- src/main/io/displayport_msp_dji_compat.c | 51 ++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index fbd7445f650..8f457d550af 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -25,6 +25,9 @@ #include "io/dji_osd_symbols.h" #include "drivers/osd_symbols.h" +// 0123456789ABC +static char *dji_logo = "DJI FIX THIS "; + uint8_t getDJICharacter(uint8_t ch, uint8_t page) { uint16_t ech = ch | ((page & 0x3)<< 8) ; @@ -452,16 +455,50 @@ 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_START+1: + case SYM_LOGO_START+2: + case SYM_LOGO_START+3: + case SYM_LOGO_START+4: + case SYM_LOGO_START+5: + case SYM_LOGO_START+6: + case SYM_LOGO_START+7: + case SYM_LOGO_START+8: + case SYM_LOGO_START+9: + case SYM_LOGO_START+10: + case SYM_LOGO_START+11: + case SYM_LOGO_START+12: + case SYM_LOGO_START+13: + case SYM_LOGO_START+14: + case SYM_LOGO_START+15: + case SYM_LOGO_START+16: + case SYM_LOGO_START+17: + case SYM_LOGO_START+18: + case SYM_LOGO_START+19: + case SYM_LOGO_START+20: + case SYM_LOGO_START+21: + case SYM_LOGO_START+22: + case SYM_LOGO_START+23: + case SYM_LOGO_START+24: + case SYM_LOGO_START+25: + case SYM_LOGO_START+26: + case SYM_LOGO_START+27: + case SYM_LOGO_START+28: + case SYM_LOGO_START+29: + case SYM_LOGO_START+30: + case SYM_LOGO_START+31: + case SYM_LOGO_START+32: + case SYM_LOGO_START+33: + case SYM_LOGO_START+34: + case SYM_LOGO_START+35: + case SYM_LOGO_START+36: + case SYM_LOGO_START+37: + case SYM_LOGO_START+38: + case SYM_LOGO_START+39: + return dji_logo[ech - SYM_LOGO_START % 0xC]; - 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; From ebbba222c648e270ff60374597fc52b71eb12ab5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 10:46:29 +0100 Subject: [PATCH 2/9] Replace logos with a reminder OSD needs fixing. --- src/main/io/displayport_msp_dji_compat.c | 50 ++++-------------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 8f457d550af..633b94d193b 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -40,6 +40,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 % 0xC]; + } + + if (ech >= SYM_PILOT_LOGO_LRG_START && ech <= 511) { + return dji_logo[ech - SYM_PILOT_LOGO_LRG_START % 0xC]; + } + switch (ech) { case SYM_RSSI: return DJI_SYM_RSSI; @@ -457,48 +465,6 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) return DJI_SYM_CROSS_TRACK_ERROR; */ - case SYM_LOGO_START: - case SYM_LOGO_START+1: - case SYM_LOGO_START+2: - case SYM_LOGO_START+3: - case SYM_LOGO_START+4: - case SYM_LOGO_START+5: - case SYM_LOGO_START+6: - case SYM_LOGO_START+7: - case SYM_LOGO_START+8: - case SYM_LOGO_START+9: - case SYM_LOGO_START+10: - case SYM_LOGO_START+11: - case SYM_LOGO_START+12: - case SYM_LOGO_START+13: - case SYM_LOGO_START+14: - case SYM_LOGO_START+15: - case SYM_LOGO_START+16: - case SYM_LOGO_START+17: - case SYM_LOGO_START+18: - case SYM_LOGO_START+19: - case SYM_LOGO_START+20: - case SYM_LOGO_START+21: - case SYM_LOGO_START+22: - case SYM_LOGO_START+23: - case SYM_LOGO_START+24: - case SYM_LOGO_START+25: - case SYM_LOGO_START+26: - case SYM_LOGO_START+27: - case SYM_LOGO_START+28: - case SYM_LOGO_START+29: - case SYM_LOGO_START+30: - case SYM_LOGO_START+31: - case SYM_LOGO_START+32: - case SYM_LOGO_START+33: - case SYM_LOGO_START+34: - case SYM_LOGO_START+35: - case SYM_LOGO_START+36: - case SYM_LOGO_START+37: - case SYM_LOGO_START+38: - case SYM_LOGO_START+39: - return dji_logo[ech - SYM_LOGO_START % 0xC]; - case SYM_AH_LEFT: return DJI_SYM_AH_LEFT; From d6a411bbec91aa2f7906c47d1a05b5f80021033a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:37:36 +0100 Subject: [PATCH 3/9] Re-enable logos in DJI compat mode --- src/main/io/displayport_msp_dji_compat.c | 4 ++-- src/main/io/osd.c | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 633b94d193b..4784694b76e 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -41,11 +41,11 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) } if (ech >= SYM_LOGO_START && ech <= 297) { - return dji_logo[ech - SYM_LOGO_START % 0xC]; + return dji_logo[(ech - SYM_LOGO_START) % 0xC]; } if (ech >= SYM_PILOT_LOGO_LRG_START && ech <= 511) { - return dji_logo[ech - SYM_PILOT_LOGO_LRG_START % 0xC]; + return dji_logo[(ech - SYM_PILOT_LOGO_LRG_START) % 0xC]; } switch (ech) { diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 743dc5f83d7..1de01be8924 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -4401,13 +4401,6 @@ 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))) { From 701ef30e0ff55cc7bdc54f72ae9897cdc0a94580 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:50:43 +0100 Subject: [PATCH 4/9] Small changes --- src/main/io/displayport_msp_dji_compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 4784694b76e..826c7b5c145 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -41,11 +41,11 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) } if (ech >= SYM_LOGO_START && ech <= 297) { - return dji_logo[(ech - SYM_LOGO_START) % 0xC]; + return dji_logo[(ech - SYM_LOGO_START) % 0xD]; } if (ech >= SYM_PILOT_LOGO_LRG_START && ech <= 511) { - return dji_logo[(ech - SYM_PILOT_LOGO_LRG_START) % 0xC]; + return dji_logo[(ech - SYM_PILOT_LOGO_LRG_START) % 0xD]; } switch (ech) { From ff477512b3c57f4c4f6a7a8bbddc64b14a7d4563 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:07:32 +0100 Subject: [PATCH 5/9] Change message to read " DJI FIX " " THE OSD " "FOR O3 AND" " O4 " --- src/main/io/displayport_msp_dji_compat.c | 9 ++++++--- src/main/io/osd.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 826c7b5c145..5744dc772e2 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -26,7 +26,10 @@ #include "drivers/osd_symbols.h" // 0123456789ABC -static char *dji_logo = "DJI FIX THIS "; +static char *dji_logo = "DJI FIX " + "THE OSD " + "FOR O3 AND" + "O4 "; uint8_t getDJICharacter(uint8_t ch, uint8_t page) { @@ -41,11 +44,11 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) } if (ech >= SYM_LOGO_START && ech <= 297) { - return dji_logo[(ech - SYM_LOGO_START) % 0xD]; + 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_PILOT_LOGO_LRG_START) % 0xD]; + return dji_logo[(ech - SYM_LOGO_START) % (strlen(dji_logo) + 1)]; } switch (ech) { diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 1de01be8924..a88bfc0012c 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -4405,7 +4405,7 @@ uint8_t drawLogos(bool singular, uint8_t row) { 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) { From 4ea8c651f6c8f1ed2f8abf70597073e9349ff380 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:09:27 +0100 Subject: [PATCH 6/9] formatting --- src/main/io/displayport_msp_dji_compat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 5744dc772e2..c9b1a84eef9 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -26,10 +26,10 @@ #include "drivers/osd_symbols.h" // 0123456789ABC -static char *dji_logo = "DJI FIX " - "THE OSD " +static char *dji_logo = " DJI FIX " + " THE OSD " "FOR O3 AND" - "O4 "; + " O4 "; uint8_t getDJICharacter(uint8_t ch, uint8_t page) { From c8c5d6e629aafde2297f03145efd9a86d15330b4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:23:53 +0100 Subject: [PATCH 7/9] missing header --- src/main/io/displayport_msp_dji_compat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index c9b1a84eef9..2b53b5eae13 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -24,8 +24,9 @@ #include "io/displayport_msp_dji_compat.h" #include "io/dji_osd_symbols.h" #include "drivers/osd_symbols.h" +#include -// 0123456789ABC +// 0123456789 static char *dji_logo = " DJI FIX " " THE OSD " "FOR O3 AND" From 0f60e4bd9d9dbdd284f7bc8f249004370c166c52 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:26:21 +0100 Subject: [PATCH 8/9] Grammar! --- src/main/io/displayport_msp_dji_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 2b53b5eae13..8ea6b5e0ee0 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -27,7 +27,7 @@ #include // 0123456789 -static char *dji_logo = " DJI FIX " +static char *dji_logo = " DJI, FIX " " THE OSD " "FOR O3 AND" " O4 "; From 2b488e7d8dee270c319231b27855fece73e5a333 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:37:19 +0100 Subject: [PATCH 9/9] Balancing --- src/main/io/displayport_msp_dji_compat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 8ea6b5e0ee0..74805fa0598 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -28,9 +28,9 @@ // 0123456789 static char *dji_logo = " DJI, FIX " - " THE OSD " - "FOR O3 AND" - " O4 "; + " THE OSD " + " FOR O3 " + " AND O4 "; uint8_t getDJICharacter(uint8_t ch, uint8_t page) {