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:
commit
c917540e6a
1 changed files with 10 additions and 0 deletions
|
@ -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 :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue