feat: telemetry buffer for all internal modules (#5267)

This commit is contained in:
Raphael Coeffic
2024-07-08 21:41:43 +10:00
committed by GitHub
parent 0a264badda
commit 9518dca3f9
2 changed files with 10 additions and 22 deletions
@@ -50,13 +50,11 @@ endif()
if(INTERNAL_MODULE_MULTI)
add_definitions(-DHARDWARE_INTERNAL_MODULE)
add_definitions(-DINTERNAL_MODULE_MULTI)
add_definitions(-DINTERNAL_MODULE_SERIAL_TELEMETRY)
endif()
if(INTERNAL_MODULE_CRSF)
add_definitions(-DHARDWARE_INTERNAL_MODULE)
add_definitions(-DINTERNAL_MODULE_CRSF)
add_definitions(-DINTERNAL_MODULE_SERIAL_TELEMETRY)
endif()
if(INTERNAL_MODULE_AFHDS2A)
+10 -20
View File
@@ -60,37 +60,27 @@
#include "flysky_ibus.h"
#endif
uint8_t telemetryStreaming = 0;
uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
uint8_t telemetryRxBufferCount = 0;
struct telemetry_buffer {
uint8_t buffer[TELEMETRY_RX_PACKET_SIZE];
uint8_t length;
};
uint8_t telemetryStreaming = 0;
uint8_t telemetryState = TELEMETRY_INIT;
TelemetryData telemetryData;
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
static uint8_t intTelemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
static uint8_t intTelemetryRxBufferCount;
#endif
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)
if (moduleIdx == INTERNAL_MODULE)
return intTelemetryRxBuffer;
#endif
return telemetryRxBuffer;
return _telemetry_rx_buffer[moduleIdx].buffer;
}
uint8_t &getTelemetryRxBufferCount(uint8_t moduleIdx)
{
#if defined(INTERNAL_MODULE_SERIAL_TELEMETRY)
if (moduleIdx == INTERNAL_MODULE)
return intTelemetryRxBufferCount;
#endif
return telemetryRxBufferCount;
return _telemetry_rx_buffer[moduleIdx].length;
}
rxStatStruct *getRxStatLabels() {