From 782fe3f9b3939f8211958c08d04400daee2144b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ra=C3=BAl=20Ortega?= Date: Mon, 29 Jul 2019 17:51:49 +0200 Subject: [PATCH] enum telemetry providers --- src/main/tracker/frskyx.c | 12 +++++++----- src/main/tracker/telemetry.h | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/tracker/frskyx.c b/src/main/tracker/frskyx.c index 61e2560..77d4369 100755 --- a/src/main/tracker/frskyx.c +++ b/src/main/tracker/frskyx.c @@ -140,10 +140,10 @@ void processHubPacket(uint8_t id, uint16_t value) NS = value; break; case TEMP2: - if(telemetry_provider==1){ + if(telemetry_provider == TELEMETRY_PROVIDER_DIY_GPS){ sats = value / 10; fix = value % 10; - } else if (telemetry_provider==2){ + } else if (telemetry_provider == TELEMETRY_PROVIDER_INAV){ sats = value % 100; } else sats = value; @@ -185,6 +185,8 @@ void processSportPacket(uint8_t *packet) return; } + if(appId == GPS_STATUS) telemetry_provider = TELEMETRY_PROVIDER_APM10; + switch (prim) { case DATA_FRAME: @@ -195,10 +197,10 @@ void processSportPacket(uint8_t *packet) processHubPacket(id, value); } else if (appId >= T2_FIRST_ID && appId <= T2_LAST_ID) { - if(telemetry_provider==1){ + if(telemetry_provider == TELEMETRY_PROVIDER_DIY_GPS){ sats = SPORT_DATA_S32(packet) / 10; //fix = SPORT_DATA_S32(packet) % 10; - } else if (telemetry_provider==2){ + } else if (telemetry_provider == TELEMETRY_PROVIDER_INAV){ sats = SPORT_DATA_S32(packet) % 100; } else { //we assume that other systems just send the sats over temp2 and fix over temp1 @@ -252,7 +254,7 @@ void processSportPacket(uint8_t *packet) } } - else if(appId == GPS_STATUS && telemetry_provider == 3){ + else if(appId == GPS_STATUS && telemetry_provider == TELEMETRY_PROVIDER_APM10){ sats = (uint8_t) (SPORT_DATA_U32(packet) & bitmask(4,0)); //telemetry.gpsAlt = bit32.extract(VALUE,24,7) * (10^bit32.extract(VALUE,22,2)) * (bit32.extract(VALUE,31,1) == 1 and -1 or 1) -- dm uint16_t msl_dc, msl_x, msl_sgn; diff --git a/src/main/tracker/telemetry.h b/src/main/tracker/telemetry.h index b348baf..161724d 100755 --- a/src/main/tracker/telemetry.h +++ b/src/main/tracker/telemetry.h @@ -53,7 +53,10 @@ extern int32_t telemetry_home_lon; extern int16_t telemetry_home_alt; enum telemetryProviders { - NONE = 0, DIY_GPS, INAV, APM10 + TELEMETRY_PROVIDER_NONE = 0, + TELEMETRY_PROVIDER_DIY_GPS, + TELEMETRY_PROVIDER_INAV, + TELEMETRY_PROVIDER_APM10 }; int16_t getTargetAlt(int16_t home_alt); -- 2.11.4.GIT