Skip to content

Commit

Permalink
Fixed reporting of extended ESC sensor data in SmartPort.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeller committed Aug 4, 2018
1 parent d0a9a0f commit c54aba7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/telemetry/smartport.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ static void smartPortSendPackage(uint16_t id, uint32_t val)
smartPortWriteFrame(&payload);
}

static bool reportExtendedEscSensors(void) {
return feature(FEATURE_ESC_SENSOR) && telemetryConfig()->smartport_use_extra_sensors;
}

#define ADD_SENSOR(dataId) frSkyDataIdTableInfo.table[frSkyDataIdTableInfo.index++] = dataId

static void initSmartPortSensors(void)
Expand All @@ -328,23 +332,23 @@ static void initSmartPortSensors(void)

if (isBatteryVoltageConfigured()) {
#ifdef USE_ESC_SENSOR
if (!feature(FEATURE_ESC_SENSOR) || !telemetryConfig()->smartport_use_extra_sensors) {
if (!reportExtendedEscSensors())
#endif
{
ADD_SENSOR(FSSP_DATAID_VFAS);
#ifdef USE_ESC_SENSOR
}
#endif

ADD_SENSOR(FSSP_DATAID_A4);
}

if (isAmperageConfigured()) {
#ifdef USE_ESC_SENSOR
if (!feature(FEATURE_ESC_SENSOR) || !telemetryConfig()->smartport_use_extra_sensors) {
if (!reportExtendedEscSensors())
#endif
{
ADD_SENSOR(FSSP_DATAID_CURRENT);
#ifdef USE_ESC_SENSOR
}
#endif

ADD_SENSOR(FSSP_DATAID_FUEL);
}

Expand Down Expand Up @@ -374,7 +378,7 @@ static void initSmartPortSensors(void)
frSkyDataIdTableInfo.index = 0;

#ifdef USE_ESC_SENSOR
if (feature(FEATURE_ESC_SENSOR && telemetryConfig()->smartport_use_extra_sensors)) {
if (reportExtendedEscSensors())
frSkyEscDataIdTableInfo.size = ESC_DATAID_COUNT;
} else {
frSkyEscDataIdTableInfo.size = 0;
Expand Down

0 comments on commit c54aba7

Please sign in to comment.