Cleanup
This commit is contained in:
@@ -58,32 +58,9 @@ InternalModulePulsesData intmodulePulsesData __DMA;
|
|||||||
ExternalModulePulsesData extmodulePulsesData __DMA;
|
ExternalModulePulsesData extmodulePulsesData __DMA;
|
||||||
TrainerPulsesData trainerPulsesData __DMA;
|
TrainerPulsesData trainerPulsesData __DMA;
|
||||||
|
|
||||||
static TimerHandle_t telemetryTimer = nullptr;
|
|
||||||
static StaticTimer_t telemetryTimerBuffer;
|
|
||||||
|
|
||||||
void telemetryTimerCb(TimerHandle_t xTimer)
|
|
||||||
{
|
|
||||||
(void)xTimer;
|
|
||||||
if (!s_pulses_paused) {
|
|
||||||
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
|
|
||||||
telemetryWakeup();
|
|
||||||
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void startPulses()
|
void startPulses()
|
||||||
{
|
{
|
||||||
if (!telemetryTimer) {
|
telemetryStart();
|
||||||
telemetryTimer =
|
|
||||||
xTimerCreateStatic("Telem", 4 / RTOS_MS_PER_TICK, pdTRUE, (void*)0,
|
|
||||||
telemetryTimerCb, &telemetryTimerBuffer);
|
|
||||||
if (telemetryTimer) {
|
|
||||||
if( xTimerStart( telemetryTimer, 0 ) != pdPASS ) {
|
|
||||||
/* The timer could not be set into the Active state. */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s_pulses_paused = false;
|
s_pulses_paused = false;
|
||||||
|
|
||||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||||
@@ -101,13 +78,9 @@ void startPulses()
|
|||||||
|
|
||||||
void stopPulses()
|
void stopPulses()
|
||||||
{
|
{
|
||||||
if (telemetryTimer) {
|
telemetryStop();
|
||||||
if( xTimerStop( telemetryTimer, 5 / RTOS_MS_PER_TICK ) != pdPASS ) {
|
|
||||||
/* The timer could not be set into the Active state. */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s_pulses_paused = true;
|
s_pulses_paused = true;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < NUM_MODULES; i++)
|
for (uint8_t i = 0; i < NUM_MODULES; i++)
|
||||||
moduleState[i].protocol = PROTOCOL_CHANNELS_UNINITIALIZED;
|
moduleState[i].protocol = PROTOCOL_CHANNELS_UNINITIALIZED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, gpioh, gpioi, gpio
|
|||||||
USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
|
USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
|
||||||
ADC_Common_TypeDef adc;
|
ADC_Common_TypeDef adc;
|
||||||
RTC_TypeDef rtc;
|
RTC_TypeDef rtc;
|
||||||
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { }
|
|
||||||
void lcdCopy(void * dest, void * src);
|
void lcdCopy(void * dest, void * src);
|
||||||
|
|
||||||
FATFS g_FATFS_Obj;
|
FATFS g_FATFS_Obj;
|
||||||
@@ -802,3 +802,6 @@ struct TouchState getInternalTouchState()
|
|||||||
return simTouchState;
|
return simTouchState;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void telemetryStart() {}
|
||||||
|
void telemetryStop() {}
|
||||||
|
|||||||
@@ -283,14 +283,6 @@ void sportProcessTelemetryPacket(uint16_t id, uint8_t subId, uint8_t instance,
|
|||||||
uint32_t data, TelemetryUnit unit = UNIT_RAW);
|
uint32_t data, TelemetryUnit unit = UNIT_RAW);
|
||||||
void sportProcessTelemetryPacketWithoutCrc(uint8_t origin, const uint8_t *packet);
|
void sportProcessTelemetryPacketWithoutCrc(uint8_t origin, const uint8_t *packet);
|
||||||
|
|
||||||
void telemetryWakeup();
|
|
||||||
void telemetryReset();
|
|
||||||
|
|
||||||
extern uint8_t telemetryProtocol;
|
|
||||||
void telemetryInit(uint8_t protocol);
|
|
||||||
|
|
||||||
void telemetryInterrupt10ms();
|
|
||||||
|
|
||||||
bool pushFrskyTelemetryData(uint8_t data); // returns true when end of frame detected
|
bool pushFrskyTelemetryData(uint8_t data); // returns true when end of frame detected
|
||||||
void processFrskyTelemetryData(uint8_t data);
|
void processFrskyTelemetryData(uint8_t data);
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,9 @@
|
|||||||
#include "libopenui.h"
|
#include "libopenui.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include <timers.h>
|
||||||
|
|
||||||
uint8_t telemetryStreaming = 0;
|
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 telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
|
||||||
uint8_t telemetryRxBufferCount = 0;
|
uint8_t telemetryRxBufferCount = 0;
|
||||||
@@ -106,6 +109,45 @@ void telemetryMirrorSend(uint8_t data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(SIMU)
|
||||||
|
static TimerHandle_t telemetryTimer = nullptr;
|
||||||
|
static StaticTimer_t telemetryTimerBuffer;
|
||||||
|
|
||||||
|
static void telemetryTimerCb(TimerHandle_t xTimer)
|
||||||
|
{
|
||||||
|
(void)xTimer;
|
||||||
|
if (!s_pulses_paused) {
|
||||||
|
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
|
||||||
|
telemetryWakeup();
|
||||||
|
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void telemetryStart()
|
||||||
|
{
|
||||||
|
if (!telemetryTimer) {
|
||||||
|
telemetryTimer =
|
||||||
|
xTimerCreateStatic("Telem", 4 / RTOS_MS_PER_TICK, pdTRUE, (void*)0,
|
||||||
|
telemetryTimerCb, &telemetryTimerBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (telemetryTimer) {
|
||||||
|
if( xTimerStart( telemetryTimer, 0 ) != pdPASS ) {
|
||||||
|
/* The timer could not be set into the Active state. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void telemetryStop()
|
||||||
|
{
|
||||||
|
if (telemetryTimer) {
|
||||||
|
if( xTimerStop( telemetryTimer, 5 / RTOS_MS_PER_TICK ) != pdPASS ) {
|
||||||
|
/* The timer could not be set into the Active state. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void processTelemetryData(uint8_t data)
|
void processTelemetryData(uint8_t data)
|
||||||
{
|
{
|
||||||
#if defined(CROSSFIRE)
|
#if defined(CROSSFIRE)
|
||||||
|
|||||||
@@ -87,6 +87,17 @@ void telemetrySetMirrorCb(void* ctx, void (*fct)(void*, uint8_t));
|
|||||||
// Mirror telemetry byte
|
// Mirror telemetry byte
|
||||||
void telemetryMirrorSend(uint8_t data);
|
void telemetryMirrorSend(uint8_t data);
|
||||||
|
|
||||||
|
void telemetryWakeup();
|
||||||
|
void telemetryReset();
|
||||||
|
|
||||||
|
extern uint8_t telemetryProtocol;
|
||||||
|
void telemetryInit(uint8_t protocol);
|
||||||
|
|
||||||
|
void telemetryInterrupt10ms();
|
||||||
|
|
||||||
|
void telemetryStart();
|
||||||
|
void telemetryStop();
|
||||||
|
|
||||||
#define TELEMETRY_AVERAGE_COUNT 3
|
#define TELEMETRY_AVERAGE_COUNT 3
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
Reference in New Issue
Block a user