Fix MSP_VOLTAGE_METERS and MSP_CURRENT_METERS (#5547)

Only sustract the unused voltage/current meters from ESC when
USE_ESC_SENSOR is defined
This commit is contained in:
Míguel Ángel Mulero Martínez 2018-03-27 16:34:53 +02:00 committed by Michael Keller
parent 5a7b1879ee
commit 8095d3442c
1 changed files with 4 additions and 4 deletions

View File

@ -513,8 +513,8 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
case MSP_VOLTAGE_METERS: { case MSP_VOLTAGE_METERS: {
// write out id and voltage meter values, once for each meter we support // write out id and voltage meter values, once for each meter we support
uint8_t count = supportedVoltageMeterCount; uint8_t count = supportedVoltageMeterCount;
#ifndef USE_OSD_SLAVE #if !defined(USE_OSD_SLAVE) && defined(USE_ESC_SENSOR)
count = supportedVoltageMeterCount - (VOLTAGE_METER_ID_ESC_COUNT - getMotorCount()); count -= VOLTAGE_METER_ID_ESC_COUNT - getMotorCount();
#endif #endif
for (int i = 0; i < count; i++) { 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: { case MSP_CURRENT_METERS: {
// write out id and current meter values, once for each meter we support // write out id and current meter values, once for each meter we support
uint8_t count = supportedCurrentMeterCount; uint8_t count = supportedCurrentMeterCount;
#ifndef USE_OSD_SLAVE #if !defined(USE_OSD_SLAVE) && defined(USE_ESC_SENSOR)
count = supportedCurrentMeterCount - (VOLTAGE_METER_ID_ESC_COUNT - getMotorCount()); count -= VOLTAGE_METER_ID_ESC_COUNT - getMotorCount();
#endif #endif
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {