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
+4
View File
@@ -27,6 +27,10 @@
#include "storage/modelslist.h"
#endif
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
// TODO find why we need this (for REGISTER at least)
#if defined(PCBXLITE)
#define EVT_BUTTON_PRESSED() EVT_KEY_FIRST(KEY_ENTER)
+4
View File
@@ -22,6 +22,10 @@
#include "opentx.h"
#include "mixer_scheduler.h"
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
uint8_t g_moduleIdx;
uint8_t getSwitchWarningsCount()
+8 -1
View File
@@ -22,6 +22,10 @@
#include "bind_menu_d16.h"
#include "opentx.h"
#if defined(MULTIMODULE)
#include "telemetry/multi.h"
#endif
BindChoiceMenu::BindChoiceMenu(Window *parent, uint8_t moduleIdx,
std::function<void()> onPress,
std::function<void()> onCancel) :
@@ -68,11 +72,14 @@ void BindChoiceMenu::onSelect(BindChanMode mode)
}
ModuleData* md = &g_model.moduleData[moduleIdx];
#if defined(MULTIMODULE)
if (isModuleMultimodule(moduleIdx)) {
md->multi.receiverTelemetryOff = !receiverTelemetry;
md->multi.receiverHigherChannels = receiverHigherChannels;
setMultiBindStatus(moduleIdx, MULTI_BIND_INITIATED);
} else {
} else
#endif
{
md->pxx.receiverTelemetryOff = !receiverTelemetry;
md->pxx.receiverHigherChannels = receiverHigherChannels;
}
@@ -24,6 +24,8 @@
#include "mixer_scheduler.h"
#include "telemetry/crossfire.h"
#define SET_DIRTY() storageDirty(EE_MODEL)
CrossfireSettings::CrossfireSettings(Window* parent, const FlexGridLayout& g,
+6
View File
@@ -22,6 +22,10 @@
#include "hw_intmodule.h"
#include "opentx.h"
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
#define SET_DIRTY() storageDirty(EE_GENERAL)
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(3),
@@ -77,6 +81,7 @@ void InternalModuleWindow::setModuleType(int moduleType)
SET_DIRTY();
}
#if defined(CROSSFIRE)
int InternalModuleWindow::getBaudrate()
{
return CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate);
@@ -88,6 +93,7 @@ void InternalModuleWindow::setBaudrate(int val)
restartModule(INTERNAL_MODULE);
SET_DIRTY();
}
#endif
void InternalModuleWindow::updateBaudrateLine()
{
+2
View File
@@ -32,8 +32,10 @@ class InternalModuleWindow : public FormGroup::Line
uint8_t lastModule = 0;
lv_obj_t* br_box = nullptr;
#if defined(CROSSFIRE)
static int getBaudrate();
static void setBaudrate(int val);
#endif
void setModuleType(int moduleType);
void updateBaudrateLine();
+7 -1
View File
@@ -37,6 +37,7 @@
#endif
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#include "crossfire_settings.h"
#endif
@@ -196,9 +197,11 @@ void ModuleWindow::updateModule()
GET_DEFAULT(*modelId), [=](int32_t newValue) {
if (newValue != *modelId) {
*modelId = newValue;
#if defined(CROSSFIRE)
if (isModuleCrossfire(moduleIdx)) {
moduleState[moduleIdx].counter = CRSF_FRAME_MODELID;
}
#endif
SET_DIRTY();
}
});
@@ -566,6 +569,7 @@ void ModuleSubTypeChoice::update()
void ModuleSubTypeChoice::openMenu()
{
#if defined(MULTIMODULE)
if (isModuleMultimodule(moduleIdx)) {
auto menu = new Menu(this);
@@ -587,7 +591,9 @@ void ModuleSubTypeChoice::openMenu()
ModuleData* md = &g_model.moduleData[moduleIdx];
int idx = protos->getIndex(md->multi.rfProtocol);
if (idx >= 0) menu->select(idx);
} else {
} else
#endif
{
Choice::openMenu();
}
}
@@ -23,6 +23,9 @@
#include "radio_ghost_module_config.h"
#include "libopenui.h"
#include "telemetry/ghost.h"
#include "telemetry/ghost_menu.h"
class GhostModuleConfigWindow: public Window
{
public:
@@ -21,6 +21,10 @@
#include "opentx.h"
#if defined(GHOST)
#include "telemetry/ghost.h"
#endif
void menuGhostModuleConfig(event_t event)
{
switch (event) {
@@ -23,6 +23,10 @@
#include "hal/adc_driver.h"
#include "aux_serial_driver.h"
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
#if defined(PCBTARANIS)
enum {
ITEM_RADIO_HARDWARE_LABEL_STICKS,
+14 -2
View File
@@ -25,8 +25,6 @@
#include "stamp.h"
#include "lua_api.h"
#include "api_filesystem.h"
#include "telemetry/frsky.h"
#include "telemetry/multi.h"
#include "aux_serial_driver.h"
#if defined(LIBOPENUI)
@@ -77,6 +75,20 @@
#include "lua/lua_exports_nv14.inc"
#endif
#include "telemetry/frsky.h"
#if defined(MULTIMODULE)
#include "telemetry/multi.h"
#endif
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
#if defined(GHOST)
#include "telemetry/ghost.h"
#endif
#if defined(SIMU)
#define RADIO_VERSION FLAVOUR "-simu"
#else
+4
View File
@@ -904,6 +904,10 @@ constexpr uint8_t SD_SCREEN_FILE_LENGTH = 64;
constexpr uint8_t TEXT_FILENAME_MAXLEN = 40;
#if defined(GHOST)
#include "telemetry/ghost_menu.h"
#endif
union ReusableBuffer
{
struct {
+2
View File
@@ -27,6 +27,8 @@
#include "intmodule_serial_driver.h"
#endif
#include "telemetry/crossfire.h"
#define CROSSFIRE_CH_BITS 11
#define CROSSFIRE_CENTER 0x3E0
#if defined(PPM_CENTER_ADJUSTABLE)
+2
View File
@@ -20,6 +20,8 @@
*/
#include "opentx.h"
#include "telemetry/ghost.h"
#include "telemetry/ghost_menu.h"
uint8_t createGhostMenuControlFrame(uint8_t * frame, int16_t * pulses)
{
+7 -3
View File
@@ -40,6 +40,10 @@
#include "pulses/crossfire.h"
#endif
#if defined(GHOST)
#include "telemetry/ghost.h"
#endif
#if defined(MULTIMODULE)
#include "io/multi_protolist.h"
#include "pulses/multi.h"
@@ -388,14 +392,14 @@ static void enablePulsesInternalModule(uint8_t protocol)
break;
#endif
#if defined(INTERNAL_MODULE_MULTI)
#if defined(INTERNAL_MODULE_MULTI) && defined(MULTIMODULE)
case PROTOCOL_CHANNELS_MULTIMODULE:
internalModuleContext = MultiInternalDriver.init(INTERNAL_MODULE);
internalModuleDriver = &MultiInternalDriver;
break;
#endif
#if defined(INTERNAL_MODULE_CRSF)
#if defined(INTERNAL_MODULE_CRSF) && defined(CROSSFIRE)
case PROTOCOL_CHANNELS_CROSSFIRE:
internalModuleContext = CrossfireInternalDriver.init(INTERNAL_MODULE);
internalModuleDriver = &CrossfireInternalDriver;
@@ -409,7 +413,7 @@ static void enablePulsesInternalModule(uint8_t protocol)
break;
#endif
#if defined(INTERNAL_MODULE_AFHDS2A)
#if defined(INTERNAL_MODULE_AFHDS2A) && defined(AFHDS2A)
case PROTOCOL_CHANNELS_AFHDS2A:
internalModuleContext = Afhds2InternalDriver.init(INTERNAL_MODULE);
internalModuleDriver = &Afhds2InternalDriver;
+4
View File
@@ -37,6 +37,10 @@
#include "dataconstants.h"
#endif
#if defined(CROSSFIRE)
#include "telemetry/crossfire.h"
#endif
#define PRINTF_BUFFER_SIZE 128
static void (*dbg_serial_putc)(void*, uint8_t) = nullptr;
+2 -1
View File
@@ -211,7 +211,7 @@ endif()
if(MULTIMODULE)
add_definitions(-DMULTIMODULE)
set(SRC ${SRC} pulses/multi.cpp telemetry/spektrum.cpp telemetry/hitec.cpp telemetry/hott.cpp telemetry/mlink.cpp telemetry/multi.cpp io/multi_firmware_update.cpp)
set(SRC ${SRC} pulses/multi.cpp telemetry/hitec.cpp telemetry/hott.cpp telemetry/mlink.cpp telemetry/multi.cpp io/multi_firmware_update.cpp)
endif()
if(MULTIMODULE OR AFHDS3)
set(SRC ${SRC} telemetry/flysky_ibus.cpp)
@@ -286,6 +286,7 @@ set(SRC
telemetry/frsky_d.cpp
telemetry/frsky_sport.cpp
telemetry/frsky_pxx2.cpp
telemetry/spektrum.cpp
crc.cpp
vario.cpp
)
@@ -24,6 +24,10 @@
#include "fifo.h"
#include "dmafifo.h"
#if defined(GHOST)
#include "telemetry/ghost.h"
#endif
Fifo<uint8_t, TELEMETRY_FIFO_SIZE> telemetryNoDMAFifo;
uint32_t telemetryErrors = 0;
@@ -22,6 +22,10 @@
#include "board.h"
#include "opentx.h"
#if defined(GHOST)
#include "telemetry/ghost.h"
#endif
Fifo<uint8_t, TELEMETRY_FIFO_SIZE> telemetryFifo;
uint32_t telemetryErrors = 0;
+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;