From 9983ff9851ca4e9a4939f692631b8095fb19a57b Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 22 Nov 2016 21:08:39 +0100 Subject: [PATCH] =?UTF-8?q?Add=20new=20sensors=20for=20Spektrum=E2=80=99s?= =?UTF-8?q?=20Serial=20Telemetry=20Receiver=20(SPM4649T)=20(#4037)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add new sensors for Spektrum’s Serial Telemetry Receiver (SPM4649T) * Use define instead of hardcoded number --- radio/src/telemetry/spektrum.cpp | 30 +++++++++++++++++++++++++++++- radio/src/translations/cz.h.txt | 4 ++++ radio/src/translations/de.h.txt | 4 ++++ radio/src/translations/en.h.txt | 4 ++++ radio/src/translations/es.h.txt | 4 ++++ radio/src/translations/fi.h.txt | 4 ++++ radio/src/translations/fr.h.txt | 4 ++++ radio/src/translations/it.h.txt | 4 ++++ radio/src/translations/nl.h.txt | 4 ++++ radio/src/translations/pl.h.txt | 4 ++++ radio/src/translations/pt.h.txt | 4 ++++ radio/src/translations/se.h.txt | 4 ++++ 12 files changed, 73 insertions(+), 1 deletion(-) diff --git a/radio/src/telemetry/spektrum.cpp b/radio/src/telemetry/spektrum.cpp index 1a1edb78c..568564759 100644 --- a/radio/src/telemetry/spektrum.cpp +++ b/radio/src/telemetry/spektrum.cpp @@ -23,7 +23,8 @@ /* * Documentation of the Spektrum protocol is available under - * http://www.rcgroups.com/forums/showthread.php?t=1726960&page=22#post34091390 + * https://www.spektrumrc.com/ProdInfo/Files/SPM_Telemetry_Developers_Specs.pdf + * * Multi module adds two byte header of 0xAA [RSSI of telemetry packet] [16 byte message] */ @@ -45,6 +46,7 @@ #define DSM_BIND_PACKET_LENGTH 12 #define I2C_HIGH_CURRENT 0x03 +#define I2C_TEXTGEN 0x0c #define I2C_GPS 0x17 #define I2C_GPS2 0x17 #define I2C_CELLS 0x3a @@ -88,6 +90,16 @@ const SpektrumSensor spektrumSensors[] = { {0x0a, 4, uint16, ZSTR_BATT1_CONSUMPTION, UNIT_MAH, 0}, {0x0a, 6, uint16, ZSTR_BATT2_CONSUMPTION, UNIT_MAH, 0}, + + // Lap Timer + {0x0b, 0, uint8, ZSTR_LAP_NUMBER, UNIT_RAW, 0}, + {0x0b, 0, uint8, ZSTR_GATE_NUMBER, UNIT_RAW, 0}, + {0x0b, 0, uint32, ZSTR_LAP_TIME, UNIT_SECONDS, 3}, + {0x0b, 0, uint32, ZSTR_GATE_TIME, UNIT_SECONDS, 3}, + + // Text Generator + {I2C_TEXTGEN, 0, uint32, ZSTR_FLIGHT_MODE, UNIT_TEXT, 0}, + // AirSpeed, also has max (+2, int16) {0x11, 0, int16, ZSTR_ASPD, UNIT_KMH, 0}, @@ -265,6 +277,22 @@ void processSpektrumPacket(const uint8_t *packet) uint8_t i2cAddress = (packet[2] & 0x7f); uint8_t instance = packet[3]; + if (i2cAddress == I2C_TEXTGEN) { + uint8_t lineNumber = packet[4]; + + uint16_t pseudoId = (i2cAddress << 8 | lineNumber); + + for (int i=5; ii2caddress; sensor++) { if (i2cAddress == sensor->i2caddress) { diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 759d8abbf..7fccefacc 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -1365,3 +1365,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index a1d2bd362..7401087f0 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -1365,3 +1365,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index a4fbddd68..91fc81ef2 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -1336,3 +1336,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index bcd7a5e0a..f5ddb1278 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -1306,3 +1306,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 4e19de890..a65bd2562 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -1300,3 +1300,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 096de4825..d4d5138b9 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -1338,3 +1338,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 69db645db..f1cd02653 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -1342,3 +1342,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index dad9c5408..762c02444 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -1346,3 +1346,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 14cbe4560..bfe3a3375 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -1344,3 +1344,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index 103110a04..aa1a37851 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -1301,3 +1301,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index a1bdf1a0f..4fd64bf4f 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -1360,3 +1360,7 @@ #define ZSTR_QOS_F "FLss" #define ZSTR_QOS_H "Hold" #define ZSTR_BIND "BIND" +#define ZSTR_LAP_NUMBER "Lap " +#define ZSTR_GATE_NUMBER "Gate" +#define ZSTR_LAP_TIME "LapT" +#define ZSTR_GATE_TIME "GteT"