From 8095d3442c03875d420e70dada6b38240fef19d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=ADguel=20=C3=81ngel=20Mulero=20Mart=C3=ADnez?= Date: Tue, 27 Mar 2018 16:34:53 +0200 Subject: [PATCH] Fix MSP_VOLTAGE_METERS and MSP_CURRENT_METERS (#5547) Only sustract the unused voltage/current meters from ESC when USE_ESC_SENSOR is defined --- src/main/interface/msp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/interface/msp.c b/src/main/interface/msp.c index 85559a3b09..fdb4e36715 100644 --- a/src/main/interface/msp.c +++ b/src/main/interface/msp.c @@ -513,8 +513,8 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce case MSP_VOLTAGE_METERS: { // write out id and voltage meter values, once for each meter we support uint8_t count = supportedVoltageMeterCount; -#ifndef USE_OSD_SLAVE - count = supportedVoltageMeterCount - (VOLTAGE_METER_ID_ESC_COUNT - getMotorCount()); +#if !defined(USE_OSD_SLAVE) && defined(USE_ESC_SENSOR) + count -= VOLTAGE_METER_ID_ESC_COUNT - getMotorCount(); #endif for (int i = 0; i < count; i++) { @@ -532,8 +532,8 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce case MSP_CURRENT_METERS: { // write out id and current meter values, once for each meter we support uint8_t count = supportedCurrentMeterCount; -#ifndef USE_OSD_SLAVE - count = supportedCurrentMeterCount - (VOLTAGE_METER_ID_ESC_COUNT - getMotorCount()); +#if !defined(USE_OSD_SLAVE) && defined(USE_ESC_SENSOR) + count -= VOLTAGE_METER_ID_ESC_COUNT - getMotorCount(); #endif for (int i = 0; i < count; i++) {