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:
parent
5a7b1879ee
commit
8095d3442c
|
@ -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++) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue