mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +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"
|
#include "telemetry/msp_shared.h"
|
||||||
|
|
||||||
#define SMARTPORT_MIN_TELEMETRY_RESPONSE_DELAY_US 500
|
#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
|
// these data identifiers are obtained from https://github.com/opentx/opentx/blob/master/radio/src/telemetry/frsky_hub.h
|
||||||
enum
|
enum
|
||||||
|
@ -137,6 +138,7 @@ enum
|
||||||
|
|
||||||
static uint8_t telemetryState = TELEMETRY_STATE_UNINITIALIZED;
|
static uint8_t telemetryState = TELEMETRY_STATE_UNINITIALIZED;
|
||||||
static uint8_t smartPortIdCnt = 0;
|
static uint8_t smartPortIdCnt = 0;
|
||||||
|
static bool smartPortHasRested = false;
|
||||||
|
|
||||||
typedef struct smartPortFrame_s {
|
typedef struct smartPortFrame_s {
|
||||||
uint8_t sensorId;
|
uint8_t sensorId;
|
||||||
|
@ -369,6 +371,14 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
|
||||||
id = frSkyDataIdTable[smartPortIdCnt];
|
id = frSkyDataIdTable[smartPortIdCnt];
|
||||||
}
|
}
|
||||||
smartPortIdCnt++;
|
smartPortIdCnt++;
|
||||||
|
if (smartPortIdCnt % SMARTPORT_REST_PERIOD == 0) {
|
||||||
|
if (!smartPortHasRested) {
|
||||||
|
smartPortIdCnt--;
|
||||||
|
smartPortHasRested = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
smartPortHasRested = false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case FSSP_DATAID_VFAS :
|
case FSSP_DATAID_VFAS :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue