1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 16:55:29 +03:00

Merge pull request #3206 from iNavFlight/agh_fix_fport_sensor_lost

Make SmartPort sensors rest a cycle out of every 3
This commit is contained in:
Konstantin Sharlaimov 2018-05-13 14:16:01 +10:00 committed by GitHub
commit c917540e6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,6 +59,7 @@
#include "telemetry/msp_shared.h"
#define SMARTPORT_MIN_TELEMETRY_RESPONSE_DELAY_US 500
#define SMARTPORT_REST_PERIOD 3 // Needed to avoid lost sensors on FPort, see #3198
// these data identifiers are obtained from https://github.com/opentx/opentx/blob/master/radio/src/telemetry/frsky_hub.h
enum
@ -137,6 +138,7 @@ enum
static uint8_t telemetryState = TELEMETRY_STATE_UNINITIALIZED;
static uint8_t smartPortIdCnt = 0;
static bool smartPortHasRested = false;
typedef struct smartPortFrame_s {
uint8_t sensorId;
@ -369,6 +371,14 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
id = frSkyDataIdTable[smartPortIdCnt];
}
smartPortIdCnt++;
if (smartPortIdCnt % SMARTPORT_REST_PERIOD == 0) {
if (!smartPortHasRested) {
smartPortIdCnt--;
smartPortHasRested = true;
return;
}
smartPortHasRested = false;
}
switch (id) {
case FSSP_DATAID_VFAS :