From 2d8199a43dac59b3c55bf265269d9b4abdc2963c Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 11 May 2023 17:14:15 +0800 Subject: [PATCH 1/6] Fix widgets vs. sensors (TX16s/FS-IA6B FW2.8.3) and updated meaningful units. --- radio/src/telemetry/flysky_ibus.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index e78fd7d57a4..f01a21779d4 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -189,13 +189,13 @@ const FlySkySensor flySkySensors[] = { { AFHDS2A_ID_ODO1, STR_SENSOR_ODO1, UNIT_METERS, 2 }, // 2 bytes Odometer1 -- some magic with 330 needed { AFHDS2A_ID_ODO2, STR_SENSOR_ODO2, UNIT_METERS, 2 }, // 2 bytes Odometer2 -- some magic with 330 needed { AFHDS2A_ID_SPE, STR_SENSOR_ASPD, UNIT_KMH, 2 }, // 2 bytes Speed km/h -- some magic with 330 needed - { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_RAW, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 - { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_RAW, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_GPS, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_GPS, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 { AFHDS2A_ID_GPS_ALT, STR_SENSOR_GPSALT, UNIT_METERS, 2 }, // 4 bytes signed GPS alt m*100 { AFHDS2A_ID_ALT, STR_SENSOR_ALT, UNIT_METERS, 2 }, // 4 bytes signed Alt m*100 - { AFHDS2A_ID_RX_SIG_AFHDS3, STR_SENSOR_RX_QUALITY, UNIT_RAW, 0 }, // RX error rate + { AFHDS2A_ID_RX_SIG_AFHDS3, STR_SENSOR_RX_QUALITY, UNIT_PERCENT, 0 }, // RX error rate { AFHDS2A_ID_RX_SNR_AFHDS3, STR_SENSOR_RX_SNR, UNIT_DB, 1 }, // RX SNR - { AFHDS2A_ID_TX_RSSI, STR_SENSOR_TX_RSSI, UNIT_RAW, 0 }, // Pseudo sensor for TRSSI + { AFHDS2A_ID_TX_RSSI, STR_SENSOR_TX_RSSI, UNIT_DBM, 0 }, // Pseudo sensor for TRSSI { 0x00, NULL, UNIT_RAW, 0 }, // sentinel }; @@ -315,7 +315,7 @@ void processFlySkySensor(const uint8_t * packet, uint8_t type) if (type == 0xAA) value = (packet[3] << 8) | packet[2]; else - value = (packet[5] << 24) | (packet[4] << 16) | (packet[3] << 8) | packet[2]; + value = (packet[6] << 24) | (packet[5] << 16) | (packet[4] << 8) | packet[3]; id = id ? id : SENSOR_TYPE_RX_VOL; // Remapped From 545e61d8b1850a4a6e361738382c44d208e192b7 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 16 May 2023 11:35:46 +0800 Subject: [PATCH 2/6] Updated the GPS sensors to degree unit. --- radio/src/telemetry/flysky_ibus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index f01a21779d4..d92838c3c3d 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -189,8 +189,8 @@ const FlySkySensor flySkySensors[] = { { AFHDS2A_ID_ODO1, STR_SENSOR_ODO1, UNIT_METERS, 2 }, // 2 bytes Odometer1 -- some magic with 330 needed { AFHDS2A_ID_ODO2, STR_SENSOR_ODO2, UNIT_METERS, 2 }, // 2 bytes Odometer2 -- some magic with 330 needed { AFHDS2A_ID_SPE, STR_SENSOR_ASPD, UNIT_KMH, 2 }, // 2 bytes Speed km/h -- some magic with 330 needed - { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_GPS, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 - { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_GPS, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_DEGREE, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_DEGREE, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 { AFHDS2A_ID_GPS_ALT, STR_SENSOR_GPSALT, UNIT_METERS, 2 }, // 4 bytes signed GPS alt m*100 { AFHDS2A_ID_ALT, STR_SENSOR_ALT, UNIT_METERS, 2 }, // 4 bytes signed Alt m*100 { AFHDS2A_ID_RX_SIG_AFHDS3, STR_SENSOR_RX_QUALITY, UNIT_PERCENT, 0 }, // RX error rate From c19b3684ea932a6adc040ca39615ca0008f74750 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 13 Jun 2023 13:13:13 +0800 Subject: [PATCH 3/6] Fixed a bug in AFHDS2 Alt decoding. --- radio/src/telemetry/flysky_ibus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index d92838c3c3d..632346bfee4 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -331,7 +331,7 @@ void processFlySkySensor(const uint8_t * packet, uint8_t type) telemetryData.rssi.set(value); if(value>0) telemetryStreaming = TELEMETRY_TIMEOUT10ms; } - else if (id == AFHDS2A_ID_PRES && value) { + else if (id == SENSOR_TYPE_PRES && value) { // Extract temperature to a new sensor setTelemetryValue(PROTOCOL_TELEMETRY_FLYSKY_IBUS, id | 0x100, 0, instance, ((value >> 19) - 400), UNIT_CELSIUS, 1); // Extract alt to a new sensor From 457d4564ca71820efaebdcbaa038de47314a22dd Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 13 Jun 2023 13:30:16 +0800 Subject: [PATCH 4/6] Fixed a typo. --- radio/src/telemetry/flysky_ibus.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index 632346bfee4..1785c5f3a81 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -126,7 +126,6 @@ enum AFHDS3_FRM_TEMP = 0x57, //virtual AFHDS3_FRM_EXT_V = 0x58, //virtual - AFHDS2A_ID_PRES = 0x41, // Pressure AFHDS2A_ID_TX_V = 0x7F, // TX Voltage @@ -398,8 +397,8 @@ void processFlySkyPacket(const uint8_t * packet) setFlyskyTelemetryValue(AFHDS2A_ID_TX_RSSI, 0, packet[0], UNIT_RAW, 0); const uint8_t * buffer = packet + 1; - int sesnor = 0; - while (sesnor++ < 7) { + int sensor = 0; + while (sensor++ < 7) { if (*buffer == SENSOR_TYPE_END) break; processFlySkySensor(buffer, 0xAA); buffer += 4; From 4d5b3122ecc58a0bdcffa15fcfd870d73bc4da09 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 27 Jul 2023 11:15:19 +0800 Subject: [PATCH 5/6] Update GPS sensors format. --- radio/src/telemetry/flysky_ibus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index 1785c5f3a81..81a598abc9a 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -188,8 +188,8 @@ const FlySkySensor flySkySensors[] = { { AFHDS2A_ID_ODO1, STR_SENSOR_ODO1, UNIT_METERS, 2 }, // 2 bytes Odometer1 -- some magic with 330 needed { AFHDS2A_ID_ODO2, STR_SENSOR_ODO2, UNIT_METERS, 2 }, // 2 bytes Odometer2 -- some magic with 330 needed { AFHDS2A_ID_SPE, STR_SENSOR_ASPD, UNIT_KMH, 2 }, // 2 bytes Speed km/h -- some magic with 330 needed - { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_DEGREE, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 - { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_DEGREE, 7 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_GPS_LATITUDE, 0 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_GPS_LONGITUDE, 0 }, // 4 bytes signed WGS84 in degrees * 1E7 { AFHDS2A_ID_GPS_ALT, STR_SENSOR_GPSALT, UNIT_METERS, 2 }, // 4 bytes signed GPS alt m*100 { AFHDS2A_ID_ALT, STR_SENSOR_ALT, UNIT_METERS, 2 }, // 4 bytes signed Alt m*100 { AFHDS2A_ID_RX_SIG_AFHDS3, STR_SENSOR_RX_QUALITY, UNIT_PERCENT, 0 }, // RX error rate From 584cf81a70db19a241c5b918cc55e22481fd5cad Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 2 Aug 2023 10:56:40 +0800 Subject: [PATCH 6/6] Change Long/Lat unit to RAW. --- radio/src/telemetry/flysky_ibus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index 81a598abc9a..de03fa88dbb 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -188,8 +188,8 @@ const FlySkySensor flySkySensors[] = { { AFHDS2A_ID_ODO1, STR_SENSOR_ODO1, UNIT_METERS, 2 }, // 2 bytes Odometer1 -- some magic with 330 needed { AFHDS2A_ID_ODO2, STR_SENSOR_ODO2, UNIT_METERS, 2 }, // 2 bytes Odometer2 -- some magic with 330 needed { AFHDS2A_ID_SPE, STR_SENSOR_ASPD, UNIT_KMH, 2 }, // 2 bytes Speed km/h -- some magic with 330 needed - { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_GPS_LATITUDE, 0 }, // 4 bytes signed WGS84 in degrees * 1E7 - { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_GPS_LONGITUDE, 0 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LAT, STR_SENSOR_GPS, UNIT_RAW, 0 }, // 4 bytes signed WGS84 in degrees * 1E7 + { AFHDS2A_ID_GPS_LON, STR_SENSOR_GPS, UNIT_RAW, 0 }, // 4 bytes signed WGS84 in degrees * 1E7 { AFHDS2A_ID_GPS_ALT, STR_SENSOR_GPSALT, UNIT_METERS, 2 }, // 4 bytes signed GPS alt m*100 { AFHDS2A_ID_ALT, STR_SENSOR_ALT, UNIT_METERS, 2 }, // 4 bytes signed Alt m*100 { AFHDS2A_ID_RX_SIG_AFHDS3, STR_SENSOR_RX_QUALITY, UNIT_PERCENT, 0 }, // RX error rate