From 363bf09be0b4a9fe600ba287ba4594c41c905de4 Mon Sep 17 00:00:00 2001 From: Mr D - RC Date: Sat, 9 Nov 2024 08:36:01 +0000 Subject: [PATCH] Updates - Force band and mode to uppercase - Fix bug with band and mode not finalising the string output to the OSD - Changed RSSI dBm and SNR display outputs slightly. So that the OSD is more consistent - Show mW symbol for power elements when no data is present. Again, more consistency and doesn't make people wonder why the elements are not showing up. --- src/main/fc/fc_msp.c | 5 +++++ src/main/io/osd.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 3182ede9700..989fdee5521 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -34,6 +34,7 @@ #include "common/color.h" #include "common/maths.h" #include "common/streambuf.h" +#include "common/string_light.h" #include "common/bitarray.h" #include "common/time.h" #include "common/utils.h" @@ -2947,9 +2948,13 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) rxLinkStatistics.band[i] = sbufReadU8(src); } + sl_toupperptr(rxLinkStatistics.band); + for (int i = 0; i < 6; i++) { rxLinkStatistics.mode[i] = sbufReadU8(src); } + + sl_toupperptr(rxLinkStatistics.mode); } return MSP_RESULT_NO_REPLY; diff --git a/src/main/io/osd.c b/src/main/io/osd.c index a7f9f024868..3370ced1075 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -2471,7 +2471,7 @@ static bool osdDrawSingleElement(uint8_t item) if (rssi <= -100) { tfp_sprintf(buff + 1, "%4d%c", rssi, SYM_DBM); } else { - tfp_sprintf(buff + 1, "%3d%c%c", rssi, SYM_DBM, ' '); + tfp_sprintf(buff + 1, " %3d%c", rssi, SYM_DBM); } if (!failsafeIsReceivingRxData()){ TEXT_ATTRIBUTES_ADD_BLINK(elemAttr); @@ -2560,7 +2560,7 @@ static bool osdDrawSingleElement(uint8_t item) if (snrFiltered <= -10 || snrFiltered >= 10) { tfp_sprintf(buff + 1, "%3d%c", snrFiltered, SYM_DB); } else { - tfp_sprintf(buff + 1, "%2d%c%c", snrFiltered, SYM_DB, ' '); + tfp_sprintf(buff + 1, " %2d%c", snrFiltered, SYM_DB); } } break; @@ -2569,7 +2569,7 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_TX_POWER_UPLINK: { if (!failsafeIsReceivingRxData()) - tfp_sprintf(buff, "%s%c", " ", SYM_BLANK); + tfp_sprintf(buff, "%s%c", " ", SYM_MW); else tfp_sprintf(buff, "%4d%c", rxLinkStatistics.uplinkTXPower, SYM_MW); break; @@ -2578,7 +2578,7 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_RX_POWER_DOWNLINK: { if (!failsafeIsReceivingRxData()) - tfp_sprintf(buff, "%s%c%c", " ", SYM_BLANK, SYM_BLANK); + tfp_sprintf(buff, "%s%c%c", " ", SYM_MW, SYM_AH_DECORATION_DOWN); else tfp_sprintf(buff, "%4d%c%c", rxLinkStatistics.downlinkTXPower, SYM_MW, SYM_AH_DECORATION_DOWN); break; @@ -2586,11 +2586,13 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_RX_BAND: displayWriteChar(osdDisplayPort, elemPosX++, elemPosY, SYM_RX_BAND); strcat(buff, rxLinkStatistics.band); + buff[4] = '\0'; break; case OSD_RX_MODE: displayWriteChar(osdDisplayPort, elemPosX++, elemPosY, SYM_RX_MODE); strcat(buff, rxLinkStatistics.mode); + buff[6] = '\0'; break; #endif