Fix compilation with MULTIMODULE=NO

And allow for Spektrum telemetry to stay enabled (needed for DSMP module).
This commit is contained in:
Raphael Coeffic
2022-07-22 20:45:04 +10:00
committed by Peter Feerick
parent 59466b1978
commit 8379b47e2b
29 changed files with 204 additions and 58 deletions
+2
View File
@@ -19,6 +19,8 @@
* GNU General Public License for more details.
*/
#include "crossfire.h"
#include "opentx.h"
#include "aux_serial_driver.h"
+3
View File
@@ -19,6 +19,9 @@
* GNU General Public License for more details.
*/
#include "ghost.h"
#include "ghost_menu.h"
#include "opentx.h"
#include "aux_serial_driver.h"
-24
View File
@@ -165,27 +165,3 @@ enum GhostFrames
GHST_MENU_CONTROL
};
constexpr uint8_t GHST_MENU_LINES = 6;
constexpr uint8_t GHST_MENU_CHARS = 20;
// GHST_DL_MENU_DESC (27 bytes)
struct GhostMenuFrame
{
uint8_t address;
uint8_t length ;
uint8_t packetId;
uint8_t menuStatus; // GhostMenuStatus
uint8_t lineFlags; // GhostLineFlags
uint8_t lineIndex; // 0 = first line
unsigned char menuText[GHST_MENU_CHARS];
uint8_t crc;
};
struct GhostMenuData
{
uint8_t menuStatus; // Update Line, Clear Menu, etc.
uint8_t lineFlags; // Carat states, Inverse, Bold for each of Menu Label, and Value
uint8_t splitLine; // Store beginning of Value substring
char menuText[GHST_MENU_CHARS + 1];
};
+47
View File
@@ -0,0 +1,47 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#pragma once
#include <inttypes.h>
constexpr uint8_t GHST_MENU_LINES = 6;
constexpr uint8_t GHST_MENU_CHARS = 20;
// GHST_DL_MENU_DESC (27 bytes)
struct GhostMenuFrame
{
uint8_t address;
uint8_t length ;
uint8_t packetId;
uint8_t menuStatus; // GhostMenuStatus
uint8_t lineFlags; // GhostLineFlags
uint8_t lineIndex; // 0 = first line
unsigned char menuText[GHST_MENU_CHARS];
uint8_t crc;
};
struct GhostMenuData {
uint8_t menuStatus; // Update Line, Clear Menu, etc.
uint8_t lineFlags; // Carat states, Inverse, Bold for each of Menu Label, and Value
uint8_t splitLine; // Store beginning of Value substring
char menuText[GHST_MENU_CHARS + 1];
};
+1
View File
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "mlink.h"
struct MLinkSensor
{
+9 -3
View File
@@ -19,11 +19,17 @@
* GNU General Public License for more details.
*/
#include "opentx.h"
#include "telemetry.h"
#include "multi.h"
#include "io/multi_protolist.h"
#include "aux_serial_driver.h"
#include "telemetry.h"
#include "io/multi_protolist.h"
#include "multi.h"
#include "spektrum.h"
#include "flysky_ibus.h"
#include "hitec.h"
#include "hott.h"
#include "mlink.h"
constexpr int32_t MULTI_DESIRED_VERSION = (1 << 24) | (3 << 16) | (3 << 8) | 0;
#define MULTI_CHAN_BITS 11
+5 -2
View File
@@ -352,7 +352,7 @@ void processSpektrumPacket(const uint8_t *packet)
uint8_t i2cAddress = (packet[2] & 0x7f);
if (i2cAddress == I2C_FWD_PGM) {
#if defined(LUA)
#if defined(LUA) && defined(MULTIMODULE)
// Forward Programming
if (Multi_Buffer && memcmp(Multi_Buffer, "DSM", 3) == 0) {
// Multi_Buffer[0..2]=="DSM" -> Lua script is running
@@ -571,11 +571,14 @@ void processDSMBindPacket(uint8_t module, const uint8_t *packet)
/* Finally stop binding as the rx just told us that it is bound */
if (getModuleMode(module) == MODULE_MODE_BIND) {
auto module_type = g_model.moduleData[module].type;
#if defined(MULTIMODULE)
if (module_type == MODULE_TYPE_MULTIMODULE &&
g_model.moduleData[module].multi.rfProtocol ==
MODULE_SUBTYPE_MULTI_DSM2) {
setMultiBindStatus(module, MULTI_BIND_FINISHED);
} else if (module_type == MODULE_TYPE_LEMON_DSMP) {
} else
#endif
if (module_type == MODULE_TYPE_LEMON_DSMP) {
setModuleMode(module, MODULE_MODE_NORMAL);
}
}
+21
View File
@@ -36,6 +36,27 @@
#include <FreeRTOS/include/timers.h>
#endif
#include "spektrum.h"
#if defined(CROSSFIRE)
#include "crossfire.h"
#endif
#if defined(GHOST)
#include "ghost.h"
#endif
#if defined(MULTIMODULE)
#include "hitec.h"
#include "hott.h"
#include "multi.h"
#include "mlink.h"
#endif
#if defined(MULTIMODULE) || defined(AFHDS2A) || defined(AFHDS3)
#include "flysky_ibus.h"
#endif
uint8_t telemetryStreaming = 0;
uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
uint8_t telemetryRxBufferCount = 0;
+3 -18
View File
@@ -23,28 +23,13 @@
#define _TELEMETRY_H_
#include "dataconstants.h"
#include "frsky.h"
#include "io/frsky_sport.h"
#include "crossfire.h"
#include "myeeprom.h"
#include "io/frsky_sport.h"
#if defined(GHOST)
#include "ghost.h"
#endif
#if defined(MULTIMODULE)
#include "spektrum.h"
#include "hitec.h"
#include "hott.h"
#include "multi.h"
#include "mlink.h"
#endif
#include "myeeprom.h"
#if defined(MULTIMODULE) || defined(AFHDS3)
#include "flysky_ibus.h"
#endif
#include "pulses/modules_helpers.h"
#include "frsky.h"
#include "io/frsky_sport.h"
extern uint8_t telemetryStreaming; // >0 (true) == data is streaming in. 0 = no data detected for some time
inline bool TELEMETRY_STREAMING()
+26 -3
View File
@@ -27,7 +27,30 @@
#include "libopenui.h"
#endif
#include "telemetry/flysky_nv14.h"
#include "spektrum.h"
#if defined(CROSSFIRE)
#include "crossfire.h"
#endif
#if defined(GHOST)
#include "ghost.h"
#endif
#if defined(PCBNV14)
#include "telemetry/flysky_nv14.h"
#endif
#if defined(MULTIMODULE)
#include "hitec.h"
#include "hott.h"
#include "multi.h"
#include "mlink.h"
#endif
#if defined(MULTIMODULE) || defined(AFHDS2A) || defined(AFHDS3)
#include "flysky_ibus.h"
#endif
TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
uint8_t allowNewSensors;
@@ -551,17 +574,17 @@ int setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t subId, ui
break;
#endif
#if defined(AFHDS2)
#if defined(AFHDS2) && defined(PCBNV14)
case PROTOCOL_TELEMETRY_FLYSKY_NV14:
flySkyNv14SetDefault(index, id, subId, instance);
break;
#endif
#if defined(MULTIMODULE)
case PROTOCOL_TELEMETRY_SPEKTRUM:
spektrumSetDefault(index, id, subId, instance);
break;
#if defined(MULTIMODULE)
case PROTOCOL_TELEMETRY_HITEC:
hitecSetDefault(index, id, subId, instance);
break;