feat: Support for ext. Multiplex MLink JR type module (#3352)

* introducing external MLink module telemetry as module PPM subtype

* implemented fix for sensor discovery display not showing all detected sensors (is in separate PR too)

implemented PPM subtypes in Companion

* add PPM subtype to model printer

finalize subtypes for PPM in Companion

* added logic to try to use HW UART with inverters turned off first (e.g. NV14), then, if not successfull use soft serial inverted (== uninverted data due to HW inverters on PCB)

changed start bit detection IRQ priority from 5 to the previous 0 (also in separate PR)

* extended telemetry timeout to 2s due to slow Mlink RSSI update rate

* changed the "NOTLM" sub-type texts to:

- "No Telem" for 128x64 (this is the max numbers of characters it can take)
- "No Telemetry" everything else including Companion

* Companion:

- lower case 1st charachter on PpmSubTypeStrings to ppmSubTypeStrings
- added telemetry hooks for ppmSubTypeStrings stringx

* simplified serial port initialization for MLink telemetry

* editorial change: corrected obsolete comment
This commit is contained in:
Michael
2023-05-16 11:22:47 +10:00
committed by GitHub
parent 3d6bc638a6
commit 5db37e2a2b
21 changed files with 231 additions and 14 deletions
+22 -2
View File
@@ -35,14 +35,34 @@ enum {
MLINK_CAPACITY = 11,
MLINK_FLOW = 12,
MLINK_DISTANCE = 13,
MLINK_GRATE = 14,
MLINK_RX_VOLTAGE = 16, // out of range ID for specific RxBt treatment
MLINK_LOSS = 17, // out of range ID for handling number of loss
MLINK_TX_RSSI = 18, // out of range ID for handling Telemetry RSSi reported by multi
MLINK_TX_LQI = 19, // out of range ID for handling Telemetry LQI reported by multi
MLINK_SPECIAL = 20, // out of raneg ID fro handling special value class
};
void processMLinkTelemetryData(uint8_t data, uint8_t* rxBuffer, uint8_t& rxBufferCount);
#define MLINK_SVC 0 // ID speial value class - can't use in enum as indexes have to start at 0
void mlinkSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
// Used by multi protocol
void processMLinkPacket(const uint8_t *packet);
void processMLinkPacket(const uint8_t *packet, bool multi);
// used by telemetry driver
#define MSB_EXT_MODULE_PACKET_LEN 18 // packet length minus start and stop byte
#define MSB_STX 0x02 // start byte
#define MSB_ETX 0x03 // stop byte
#define MSB_STUFF_ESC 0x1B // ESC symbol
#define MSB_STUFF_OFFSET 0x20 // byte stuffing offset
#define MSB_VALID_TELEMETRY 0x13
#define MSB_NORMAL 0x06
#define MSB_NORMAL_FAST 0x04
#define MSB_RANGE 0x46
#define MSB_RANGE_FAST 0x44
// used by external MLink module driver
#define PPM_MSB_BAUDRATE 115200
void processExternalMLinkSerialData(void* ctx, uint8_t data, uint8_t* buffer, uint8_t* len);