diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 7c8fe3a..1bac501 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -523,3 +523,61 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- 2047 +125% Channels bits are concatenated to fit in 22 bytes like in SBUS protocol */ +/* + Multiprotocol telemetry definition + + Serial: 100000 Baud 8e2 (same as input) + + TLV Protocol (type, length, value), allows a TX to ignore unknown messages + + Format: header (4 byte) + data (variable) + + [0] = 'M' (0x4d) + [1] = 'P' (0x50) + + + The first byte is deliberatly chosen to be different from other telemetry protocols + (e.g. 0xAA for DSM/Multi, 0xAA for FlySky and 0x7e for Frsky) to allow a TX to detect + the telemetry format of older versions + + [2] Type (see below) + [3] Length (excluding the 4 header bytes) + + [4-xx] data + + +Type = 0x01 Multimodule Status: + [4] Flags + + 0x01 = Input signal detected + 0x02 = Serial mode enabled + 0x04 = protocol is invalid + 0x08 = module is in binding mode + + [5-8] uint32 - version of multi code + + more information can be added by specifing a longer length of the type, the TX will just ignore these bytes + + +Type 0x02 Frksy S.port telemetry +Type 0x03 Frsky Hub telemetry + + *No* usual frsky byte stuffing + + +Type 0x04 Spektrum telemetry data + data[0] RSSI + data[1-15] telemetry data + +Type 0x05 DSM bind data + data[0-16] DSM bind data + + technically DSM bind data is only 10 bytes but multi send 16 + like with telemtry, check length field) + +Type 0x06 Flysky AFHDS2 telemetry data + length: 29 + data[0] = RSSI value + data[1-28] telemetry data + +*/ diff --git a/Multiprotocol/Telemetry.ino b/Multiprotocol/Telemetry.ino index ac986c6..ab3bb23 100644 --- a/Multiprotocol/Telemetry.ino +++ b/Multiprotocol/Telemetry.ino @@ -17,8 +17,13 @@ //************************** #if defined TELEMETRY +#if defined MULTI_TELEMETRY + #define MULTI_TIME 1000*1000*1000 // 1s + uint32_t lastMulti = 0; +#endif + #if defined SPORT_TELEMETRY - #define SPORT_TIME 12000 + #define SPORT_TIME 12000 //12ms #define FRSKY_SPORT_PACKET_SIZE 8 uint32_t last = 0; uint8_t sport_counter=0; @@ -524,6 +529,13 @@ void TelemetryUpdate() return; } #endif + #if defined MULTI_TELEMETRY + { + uint32_t now = micros(); + if ((now - lastMulti) > MULTI_TIME) { + sendMultiStatus(); + } + } }