From 837dffecdc54eb8271afb5d754f767690161ba98 Mon Sep 17 00:00:00 2001 From: WismyYao Date: Tue, 2 Jun 2020 16:38:57 +0800 Subject: [PATCH] Wismy/vfr (#7661) Change 'FLR' to 'VFR' Show R9M power in 'mW' --- radio/src/telemetry/frsky.h | 2 +- radio/src/telemetry/frsky_sport.cpp | 16 +++++++++++++--- radio/src/translations/cz.h.txt | 2 +- radio/src/translations/de.h.txt | 2 +- radio/src/translations/en.h.txt | 2 +- radio/src/translations/es.h.txt | 2 +- radio/src/translations/fi.h.txt | 2 +- radio/src/translations/fr.h.txt | 2 +- radio/src/translations/it.h.txt | 2 +- radio/src/translations/nl.h.txt | 2 +- radio/src/translations/pl.h.txt | 2 +- radio/src/translations/pt.h.txt | 2 +- radio/src/translations/se.h.txt | 2 +- 13 files changed, 25 insertions(+), 15 deletions(-) diff --git a/radio/src/telemetry/frsky.h b/radio/src/telemetry/frsky.h index 623ecb67d..751196d1c 100644 --- a/radio/src/telemetry/frsky.h +++ b/radio/src/telemetry/frsky.h @@ -192,7 +192,7 @@ enum FrSkyDataState { #define DIY_STREAM_FIRST_ID 0x5000 #define DIY_STREAM_LAST_ID 0x50FF #define FACT_TEST_ID 0xF000 -#define FRAME_LOSS_RATE_ID 0xF010 +#define VALID_FRAME_RATE_ID 0xF010 #define RSSI_ID 0xF101 #define ADC1_ID 0xF102 #define ADC2_ID 0xF103 diff --git a/radio/src/telemetry/frsky_sport.cpp b/radio/src/telemetry/frsky_sport.cpp index d5215e300..bf816cf04 100644 --- a/radio/src/telemetry/frsky_sport.cpp +++ b/radio/src/telemetry/frsky_sport.cpp @@ -30,7 +30,7 @@ struct FrSkySportSensor { }; const FrSkySportSensor sportSensors[] = { - { FRAME_LOSS_RATE_ID, FRAME_LOSS_RATE_ID, 0, ZSTR_FLR, UNIT_PERCENT, 0 }, + { VALID_FRAME_RATE_ID, VALID_FRAME_RATE_ID, 0, ZSTR_VFR, UNIT_PERCENT, 0 }, { RSSI_ID, RSSI_ID, 0, ZSTR_RSSI, UNIT_DB, 0 }, #if defined(MULTIMODULE) { TX_RSSI_ID, TX_RSSI_ID, 0, ZSTR_TX_RSSI , UNIT_DB , 0 }, @@ -224,9 +224,19 @@ void sportProcessTelemetryPacketWithoutCrc(uint8_t origin, const uint8_t * packe } #endif } + else if (dataId == VALID_FRAME_RATE_ID) { + data = 100 - SPORT_DATA_U8(packet); + } else if (dataId == R9_PWR_ID) { - uint32_t r9pwr[] = {100, 200, 500, 1000}; - data = r9pwr[SPORT_DATA_U8(packet) & 0x03]; + // receive 'dBm' and show by 'mw' + static const uint32_t r9pwrs[][2] = {{0, 1}, {5, 3}, {10, 10}, {13, 20}, {14, 25}, {20, 100}, {23, 200}, {27, 500}, {30, 1000}}; + uint32_t dBm = SPORT_DATA_U8(packet); + for (auto & r9pwr : r9pwrs) { + if (dBm == r9pwr[0]) { + data = r9pwr[1]; + break; + } + } } else if (dataId == XJT_VERSION_ID) { telemetryData.xjtVersion = HUB_DATA_U16(packet); diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index ac34feec2..115f2ab17 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -1193,7 +1193,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index c9e91bd45..842050723 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -1200,7 +1200,7 @@ #define TR_AUTH_FAILURE "Auth-failure" // ---------------------------------------------------------------- -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index e7c30c01e..c17be6890 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -1197,7 +1197,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 428505c1c..699a47368 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -1196,7 +1196,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltaje") #define TR_AUTH_FAILURE "Fallo " LCDW_128_480_LINEBREAK "autentificación" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 4ff379551..1396855a9 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -1205,7 +1205,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 80f462c09..bfd07bd25 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -1221,7 +1221,7 @@ #define TR_RTC_CHECK TR("Vérif. RTC", "Vérif. pile RTC") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 37a494f8a..b9a9cf639 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -1214,7 +1214,7 @@ #define TR_RTC_CHECK TR("Controllo RTC", "Controllo voltaggio RTC") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index 36377aca8..c50884c73 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -1206,7 +1206,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 1753b3ec3..2e1389e2c 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -1213,7 +1213,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index a9b5d0027..fb0e97e48 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -1202,7 +1202,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 8868d8106..deacd3518 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -1213,7 +1213,7 @@ #define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage") #define TR_AUTH_FAILURE "Auth-failure" -#define ZSTR_FLR "FLR" +#define ZSTR_VFR "VFR" #define ZSTR_RSSI "RSSI" #define ZSTR_R9PW "R9PW" #define ZSTR_RAS "SWR"