Avoid circular header dependencies
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "libopenui/src/bitfield.h"
|
||||
#include "definitions.h"
|
||||
#include "opentx_helpers.h"
|
||||
#include "telemetry/telemetry.h"
|
||||
#include "storage/storage.h"
|
||||
#include "globals.h"
|
||||
|
||||
@@ -35,6 +34,67 @@
|
||||
#define CROSSFIRE_CHANNELS_COUNT 16
|
||||
#define GHOST_CHANNELS_COUNT 16
|
||||
|
||||
#if defined (MULTIMODULE)
|
||||
#define IS_D16_MULTI(module) \
|
||||
(((g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_FRSKY) && \
|
||||
(g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16 || \
|
||||
g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_8CH || \
|
||||
g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_LBT || \
|
||||
g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH || \
|
||||
g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_CLONED)) || \
|
||||
(g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_FRSKYX2))
|
||||
|
||||
#define IS_R9_MULTI(module) \
|
||||
(g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_FRSKY_R9)
|
||||
|
||||
#define IS_HOTT_MULTI(module) \
|
||||
(g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_HOTT)
|
||||
|
||||
#define IS_CONFIG_MULTI(module) \
|
||||
(g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_CONFIG)
|
||||
|
||||
#define IS_DSM_MULTI(module) \
|
||||
(g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM2)
|
||||
|
||||
#define IS_RX_MULTI(module) \
|
||||
((g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_AFHDS2A_RX) || \
|
||||
(g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_FRSKYX_RX) || \
|
||||
(g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_BAYANG_RX) || \
|
||||
(g_model.moduleData[module].getMultiProtocol() == \
|
||||
MODULE_SUBTYPE_MULTI_DSM_RX))
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() \
|
||||
(telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || \
|
||||
(telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && \
|
||||
(IS_D16_MULTI(INTERNAL_MODULE) || IS_D16_MULTI(EXTERNAL_MODULE) || \
|
||||
IS_R9_MULTI(INTERNAL_MODULE) || IS_R9_MULTI(EXTERNAL_MODULE))))
|
||||
#else
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() \
|
||||
(telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || \
|
||||
(telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && \
|
||||
(IS_D16_MULTI(EXTERNAL_MODULE) || IS_R9_MULTI(EXTERNAL_MODULE))))
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define IS_D16_MULTI(module) false
|
||||
#define IS_R9_MULTI(module) false
|
||||
#define IS_HOTT_MULTI(module) false
|
||||
#define IS_CONFIG_MULTI(module) false
|
||||
#define IS_DSM_MULTI(module) false
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT)
|
||||
#define IS_RX_MULTI(module) false
|
||||
#endif
|
||||
|
||||
#define IS_SPEKTRUM_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_SPEKTRUM)
|
||||
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
// When using packed, the pointer in here end up not being aligned, which clang and gcc complain about
|
||||
// Keep the order of the fields that the so that the size stays small
|
||||
@@ -604,6 +664,18 @@ inline bool isBindCh9To16Allowed(uint8_t moduleIndex)
|
||||
}
|
||||
}
|
||||
|
||||
#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 bool isTelemAllowedOnBind(uint8_t moduleIndex)
|
||||
{
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
@@ -771,20 +843,4 @@ inline void getMultiOptionValues(int8_t multi_proto, int8_t & min, int8_t & max)
|
||||
}
|
||||
#endif
|
||||
|
||||
inline const char * getRssiLabel()
|
||||
{
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && (g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FS_AFHDS2A
|
||||
|| g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol() == MODULE_SUBTYPE_MULTI_HOTT)) {
|
||||
return "RQly";
|
||||
}
|
||||
#endif
|
||||
#if defined(GHOST)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_GHOST) {
|
||||
return "RQly";
|
||||
}
|
||||
#endif
|
||||
return "RSSI";
|
||||
}
|
||||
|
||||
#endif // _MODULES_HELPERS_H_
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "flysky_ibus.h"
|
||||
#endif
|
||||
|
||||
#include "pulses/modules_helpers.h"
|
||||
|
||||
extern uint8_t telemetryStreaming; // >0 (true) == data is streaming in. 0 = no data detected for some time
|
||||
|
||||
inline bool TELEMETRY_STREAMING()
|
||||
@@ -115,45 +117,24 @@ void frskyDSetDefault(int index, uint16_t id);
|
||||
|
||||
extern uint8_t telemetryProtocol;
|
||||
|
||||
#if defined (MULTIMODULE)
|
||||
#define IS_D16_MULTI(module) (((g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKY) && (g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16 || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_8CH || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_LBT || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_CLONED)) \
|
||||
|| (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKYX2))
|
||||
#define IS_R9_MULTI(module) (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKY_R9)
|
||||
#define IS_HOTT_MULTI(module) (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_HOTT)
|
||||
#define IS_CONFIG_MULTI(module) (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_CONFIG)
|
||||
#define IS_DSM_MULTI(module) (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM2)
|
||||
#define IS_RX_MULTI(module) ((g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_AFHDS2A_RX) || (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKYX_RX) \
|
||||
|| (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_BAYANG_RX) || (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM_RX))
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && (IS_D16_MULTI(INTERNAL_MODULE) || IS_D16_MULTI(EXTERNAL_MODULE) || IS_R9_MULTI(INTERNAL_MODULE) || IS_R9_MULTI(EXTERNAL_MODULE))))
|
||||
#else
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && (IS_D16_MULTI(EXTERNAL_MODULE) || IS_R9_MULTI(EXTERNAL_MODULE))))
|
||||
#endif
|
||||
#else
|
||||
#define IS_D16_MULTI(module) false
|
||||
#define IS_R9_MULTI(module) false
|
||||
#define IS_HOTT_MULTI(module) false
|
||||
#define IS_CONFIG_MULTI(module) false
|
||||
#define IS_DSM_MULTI(module) false
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT)
|
||||
#define IS_RX_MULTI(module) false
|
||||
#endif
|
||||
|
||||
#define IS_SPEKTRUM_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_SPEKTRUM)
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
inline bool isSportLineUsedByInternalModule()
|
||||
inline const char* getRssiLabel()
|
||||
{
|
||||
return g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT_PXX1;
|
||||
}
|
||||
#else
|
||||
inline bool isSportLineUsedByInternalModule()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE &&
|
||||
(g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol() ==
|
||||
MODULE_SUBTYPE_MULTI_FS_AFHDS2A ||
|
||||
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol() ==
|
||||
MODULE_SUBTYPE_MULTI_HOTT)) {
|
||||
return "RQly";
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "pulses/modules_helpers.h"
|
||||
#if defined(GHOST)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_GHOST) {
|
||||
return "RQly";
|
||||
}
|
||||
#endif
|
||||
return "RSSI";
|
||||
}
|
||||
|
||||
inline uint8_t modelTelemetryProtocol()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user