fix(radio): race condition on pulse buffer (#6634)

This commit is contained in:
Raphael Coeffic
2025-10-14 20:42:41 +10:00
committed by GitHub
parent 2cbd995f35
commit dd029bc591
22 changed files with 73 additions and 6 deletions
+4
View File
@@ -22,6 +22,7 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
enum ChannelsProtocols {
PROTOCOL_CHANNELS_UNINITIALIZED,
@@ -62,6 +63,9 @@ struct etx_proto_driver_t {
// Some module settings may have been modified
void (*onConfigChange)(void* ctx);
// Previous Frame already sent?
bool (*txCompleted)(void* ctx);
// Module state mode has been modified
// void (*onModeChange)(void* ctx, uint8_t old_mode, uint8_t new_mode);
};
+16
View File
@@ -297,6 +297,22 @@ uint8_t modulePortGetModule(etx_module_state_t* st)
return st - _module_states;
}
bool modulePortSerialTxCompleted(void* ctx)
{
auto st = (etx_module_state_t*)ctx;
auto drv = modulePortGetSerialDrv(st->tx);
auto drv_ctx = modulePortGetCtx(st->tx);
return drv->txCompleted(drv_ctx);
}
bool modulePortTimerTxCompleted(void* ctx)
{
auto st = (etx_module_state_t*)ctx;
auto drv = modulePortGetTimerDrv(st->tx);
auto drv_ctx = modulePortGetCtx(st->tx);
return drv->txCompleted(drv_ctx);
}
bool modulePortIsPortUsedByModule(uint8_t module, uint8_t port)
{
auto mod_st = modulePortGetState(module);
+3
View File
@@ -162,6 +162,9 @@ inline void* modulePortGetCtx(const etx_module_driver_t& d) {
return d.ctx;
}
bool modulePortSerialTxCompleted(void* ctx);
bool modulePortTimerTxCompleted(void* ctx);
bool modulePortIsPortUsedByModule(uint8_t module, uint8_t port);
bool modulePortIsPortUsed(uint8_t port);
+2 -1
View File
@@ -22,6 +22,7 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
enum SerialEncoding {
@@ -79,7 +80,7 @@ typedef struct {
void (*sendBuffer)(void* ctx, const uint8_t* data, uint32_t size);
// Is TX phase completed
uint8_t (*txCompleted)(void* ctx);
bool (*txCompleted)(void* ctx);
// Wait for last send operation to complete
void (*waitForTxCompleted)(void* ctx);
+2
View File
@@ -22,6 +22,7 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
typedef struct {
@@ -33,4 +34,5 @@ typedef struct {
void* (*init)(void* hw_def, const etx_timer_config_t* cfg);
void (*deinit)(void* ctx);
void (*send)(void* ctx, const etx_timer_config_t* cfg, const void* pulses, uint16_t length);
bool (*txCompleted)(void* ctx);
} etx_timer_driver_t;