From 38ee6fe10605b87317fdee97951ec8bbd7b58960 Mon Sep 17 00:00:00 2001 From: Roman Lut <11955117+RomanLut@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:15:56 +0300 Subject: [PATCH] better unsupported OSD error reporting --- src/main/fc/fc_msp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index fc1891e439..91cde5bbf8 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -3187,6 +3187,12 @@ static bool mspParameterGroupsCommand(sbuf_t *dst, sbuf_t *src) return true; } +bool isOSDTypeSupportedBySimulator(void) +{ + displayPort_t *osdDisplayPort = osdGetDisplayPort(); + return (osdDisplayPort && osdDisplayPort->cols == 30 && (osdDisplayPort->rows == 13 || osdDisplayPort->rows == 16)); +} + void mspWriteSimulatorOSD(sbuf_t *dst) { //RLE encoding @@ -3201,7 +3207,7 @@ void mspWriteSimulatorOSD(sbuf_t *dst) displayPort_t *osdDisplayPort = osdGetDisplayPort(); - if (osdDisplayPort && osdDisplayPort->cols == 30 && (osdDisplayPort->rows == 13 || osdDisplayPort->rows == 16)) + if (isOSDTypeSupportedBySimulator()) { sbufWriteU8(dst, osdPos_y | (osdDisplayPort->rows == 16 ? 128: 0)); sbufWriteU8(dst, osdPos_x); @@ -3603,7 +3609,11 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu simulatorData.debugIndex = 0; } - tmp_u8 = simulatorData.debugIndex | ((mixerConfig()->platformType == PLATFORM_AIRPLANE) ? 128 : 0) | (ARMING_FLAG(ARMED) ? 64 : 0); + tmp_u8 = simulatorData.debugIndex | + ((mixerConfig()->platformType == PLATFORM_AIRPLANE) ? 128 : 0) | + (ARMING_FLAG(ARMED) ? 64 : 0) | + (!feature(FEATURE_OSD) ? 32: 0) | + (!isOSDTypeSupportedBySimulator() ? 16: 0); sbufWriteU8(dst, tmp_u8 ); sbufWriteU32(dst, debug[simulatorData.debugIndex]);