feat: telemetry buffer for all internal modules (#5267)
This commit is contained in:
@@ -50,13 +50,11 @@ endif()
|
|||||||
if(INTERNAL_MODULE_MULTI)
|
if(INTERNAL_MODULE_MULTI)
|
||||||
add_definitions(-DHARDWARE_INTERNAL_MODULE)
|
add_definitions(-DHARDWARE_INTERNAL_MODULE)
|
||||||
add_definitions(-DINTERNAL_MODULE_MULTI)
|
add_definitions(-DINTERNAL_MODULE_MULTI)
|
||||||
add_definitions(-DINTERNAL_MODULE_SERIAL_TELEMETRY)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(INTERNAL_MODULE_CRSF)
|
if(INTERNAL_MODULE_CRSF)
|
||||||
add_definitions(-DHARDWARE_INTERNAL_MODULE)
|
add_definitions(-DHARDWARE_INTERNAL_MODULE)
|
||||||
add_definitions(-DINTERNAL_MODULE_CRSF)
|
add_definitions(-DINTERNAL_MODULE_CRSF)
|
||||||
add_definitions(-DINTERNAL_MODULE_SERIAL_TELEMETRY)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(INTERNAL_MODULE_AFHDS2A)
|
if(INTERNAL_MODULE_AFHDS2A)
|
||||||
|
|||||||
@@ -60,37 +60,27 @@
|
|||||||
#include "flysky_ibus.h"
|
#include "flysky_ibus.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t telemetryStreaming = 0;
|
struct telemetry_buffer {
|
||||||
uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
uint8_t buffer[TELEMETRY_RX_PACKET_SIZE];
|
||||||
uint8_t telemetryRxBufferCount = 0;
|
uint8_t length;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t telemetryStreaming = 0;
|
||||||
uint8_t telemetryState = TELEMETRY_INIT;
|
uint8_t telemetryState = TELEMETRY_INIT;
|
||||||
|
|
||||||
TelemetryData telemetryData;
|
TelemetryData telemetryData;
|
||||||
|
|
||||||
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
|
|
||||||
static uint8_t intTelemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
|
||||||
static uint8_t intTelemetryRxBufferCount;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static rxStatStruct rxStat;
|
static rxStatStruct rxStat;
|
||||||
|
|
||||||
uint8_t * getTelemetryRxBuffer(uint8_t moduleIdx)
|
telemetry_buffer _telemetry_rx_buffer[NUM_MODULES];
|
||||||
|
|
||||||
|
uint8_t* getTelemetryRxBuffer(uint8_t moduleIdx)
|
||||||
{
|
{
|
||||||
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
|
return _telemetry_rx_buffer[moduleIdx].buffer;
|
||||||
if (moduleIdx == INTERNAL_MODULE)
|
|
||||||
return intTelemetryRxBuffer;
|
|
||||||
#endif
|
|
||||||
return telemetryRxBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t &getTelemetryRxBufferCount(uint8_t moduleIdx)
|
uint8_t &getTelemetryRxBufferCount(uint8_t moduleIdx)
|
||||||
{
|
{
|
||||||
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
|
return _telemetry_rx_buffer[moduleIdx].length;
|
||||||
if (moduleIdx == INTERNAL_MODULE)
|
|
||||||
return intTelemetryRxBufferCount;
|
|
||||||
#endif
|
|
||||||
return telemetryRxBufferCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rxStatStruct *getRxStatLabels() {
|
rxStatStruct *getRxStatLabels() {
|
||||||
|
|||||||
Reference in New Issue
Block a user