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
+4 -1
View File
@@ -210,7 +210,10 @@ enum MMDSM2Subtypes {
MM_RF_DSM2_SUBTYPE_AUTO
};
enum ModuleSubtypePPM {
PPM_PROTO_TLM_NONE,
PPM_PROTO_TLM_MLINK
};
enum ModuleSubtypeDSM2 {
DSM2_PROTO_LP45,
+36
View File
@@ -27,6 +27,8 @@
#include "opentx.h"
#include "telemetry/mlink.h"
// Minimum space after the last PPM pulse in us
#define PPM_SAFE_MARGIN 3000 // 3ms
@@ -158,3 +160,37 @@ const etx_proto_driver_t PpmDriver = {
.sendPulses = ppmSendPulses,
.processData = nullptr,
};
//
// additions for PPM with external MLink Module telemetry
//
static void* ppmMLinkInit(uint8_t module);
const etx_proto_driver_t PpmDriverMLink = {
.protocol = PROTOCOL_CHANNELS_PPM_MLINK,
.init = ppmMLinkInit,
.deinit = ppmDeInit,
.sendPulses = ppmSendPulses,
.processData = processExternalMLinkSerialData,
};
static etx_serial_init ppmMLinkSerialParams = {
.baudrate = PPM_MSB_BAUDRATE,
.encoding = ETX_Encoding_8N1,
.direction = ETX_Dir_RX,
.polarity = ETX_Pol_Inverted,
};
static void* ppmMLinkInit(uint8_t module) {
etx_module_state_t *mod_st = (etx_module_state_t *)ppmInit(module);
if (!mod_st)
return nullptr;
if (!modulePortInitSerial(module, ETX_MOD_PORT_UART, &ppmMLinkSerialParams)) {
modulePortInitSerial(module, ETX_MOD_PORT_SPORT_INV, &ppmMLinkSerialParams);
}
return (void*)mod_st;
}
+1
View File
@@ -24,3 +24,4 @@
#include "hal/module_driver.h"
extern const etx_proto_driver_t PpmDriver;
extern const etx_proto_driver_t PpmDriverMLink;
+13 -1
View File
@@ -263,7 +263,16 @@ uint8_t getRequiredProtocol(uint8_t module)
switch (getModuleType(module)) {
case MODULE_TYPE_PPM:
protocol = PROTOCOL_CHANNELS_PPM;
switch (g_model.moduleData[module].subType) {
case PPM_PROTO_TLM_NONE:
protocol = PROTOCOL_CHANNELS_PPM;
break;
case PPM_PROTO_TLM_MLINK:
protocol = PROTOCOL_CHANNELS_PPM_MLINK;
break;
default:
protocol = PROTOCOL_CHANNELS_PPM;
}
break;
case MODULE_TYPE_XJT_PXX1:
@@ -462,6 +471,9 @@ static void pulsesEnableModule(uint8_t module, uint8_t protocol)
case PROTOCOL_CHANNELS_PPM:
_init_module(module, &PpmDriver);
break;
case PROTOCOL_CHANNELS_PPM_MLINK:
_init_module(module, &PpmDriverMLink);
break;
#endif
#if defined(INTERNAL_MODULE_AFHDS2A) && defined(AFHDS2)