Add support for multi-protocol trainer (#6896)

* Add support for multi-protocol trainer

* Fix telemetry condition

* Trainer mode not supported on Sky9X

* fixed radio trainer screen

- convert values properly.
- apply the weights as setup.

* Fix T16 with BT

* String fixes

* Cosmetics
This commit is contained in:
Raphael Coeffic
2019-10-22 15:53:12 +02:00
committed by 3djc
parent 5c9fba04c7
commit 6d77932f89
17 changed files with 107 additions and 40 deletions
+15 -19
View File
@@ -111,13 +111,21 @@ extern uint8_t telemetryProtocol;
#endif
#define IS_SPEKTRUM_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_SPEKTRUM)
#if defined(PCBTARANIS) || defined(PCBHORUS)
inline bool isSportLineUsedByInternalModule()
{
return g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT_PXX1;
}
#else
inline bool isSportLineUsedByInternalModule()
{
return false;
}
#endif
inline uint8_t modelTelemetryProtocol()
{
bool internalModuleInUse = IS_INTERNAL_MODULE_ENABLED();
#if defined(INTERNAL_MODULE_MULTI)
//internal muli module is not conflicting with external one
internalModuleInUse = false;
#endif
bool sportUsed = isSportLineUsedByInternalModule();
#if defined(CROSSFIRE)
if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_CROSSFIRE) {
@@ -125,12 +133,12 @@ inline uint8_t modelTelemetryProtocol()
}
#endif
if (!internalModuleInUse && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) {
if (!sportUsed && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) {
return g_model.telemetryProtocol;
}
#if defined(MULTIMODULE)
if (!internalModuleInUse && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE) {
if (!sportUsed && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE) {
return PROTOCOL_TELEMETRY_MULTIMODULE;
}
#endif
@@ -236,18 +244,6 @@ extern OutputTelemetryBuffer outputTelemetryBuffer __DMA;
extern Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo;
#endif
#if defined(PCBTARANIS) || defined(PCBHORUS)
inline bool isSportLineUsedByInternalModule()
{
return g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT_PXX1;
}
#else
inline bool isSportLineUsedByInternalModule()
{
return false;
}
#endif
void processPXX2Frame(uint8_t module, uint8_t *frame);
#endif // _TELEMETRY_H_