feat: Add DALI raw frame handling and USB setup bridge

- Introduced DaliRawFrame structure to encapsulate raw frame data.
- Enhanced DaliDomainService to manage raw frame sinks and processing.
- Implemented raw frame task for asynchronous handling of incoming DALI frames.
- Integrated raw frame handling in GatewayBleBridge and GatewayNetworkService.
- Added GatewayUsbSetupBridge to facilitate USB Serial/JTAG communication with DALI.
- Configured ESP-NOW for wireless communication and setup management.
- Updated GatewayRuntime to support clearing wireless credentials on boot button long press.
- Enhanced CMakeLists to include new components and dependencies.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Tony
2026-04-30 04:15:05 +08:00
parent 3d8d00c3dd
commit 4ce3513dd2
20 changed files with 984 additions and 25 deletions
@@ -10,6 +10,9 @@
#include <vector>
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "freertos/task.h"
class Dali;
class DaliComm;
@@ -65,6 +68,13 @@ struct DaliChannelInfo {
std::string name;
};
struct DaliRawFrame {
uint8_t channel_index{0};
uint8_t gateway_id{0};
DaliPhyKind phy_kind{DaliPhyKind::kCustom};
std::vector<uint8_t> data;
};
class DaliDomainService {
public:
DaliDomainService();
@@ -78,6 +88,7 @@ class DaliDomainService {
const char* implementationName() const;
size_t channelCount() const;
std::vector<DaliChannelInfo> channelInfo() const;
void addRawFrameSink(std::function<void(const DaliRawFrame& frame)> sink);
bool resetBus(uint8_t gateway_id) const;
bool writeBridgeFrame(uint8_t gateway_id, const uint8_t* data, size_t len) const;
@@ -108,9 +119,17 @@ class DaliDomainService {
DaliChannel* findChannelByGateway(uint8_t gateway_id);
const DaliChannel* findChannelByGateway(uint8_t gateway_id) const;
DaliChannel* findChannelByIndex(uint8_t channel_index);
const DaliChannel* findChannelByHardwareBus(uint8_t bus_id) const;
bool hasSerialPort(int uart_port) const;
esp_err_t startRawFrameTask();
static void RawFrameTaskEntry(void* arg);
void rawFrameTaskLoop();
void notifyRawFrameSinks(const DaliRawFrame& frame);
std::vector<std::unique_ptr<DaliChannel>> channels_;
std::vector<std::function<void(const DaliRawFrame& frame)>> raw_frame_sinks_;
SemaphoreHandle_t raw_frame_sink_lock_{nullptr};
TaskHandle_t raw_frame_task_handle_{nullptr};
};
} // namespace gateway