fix: update DALI double send delay and increase SPIRAM malloc reserve size
This commit fix the crash risk when bus abnormal. Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -89,6 +89,22 @@ void GatewayUsbSetupBridge::handleBytes(const uint8_t* data, size_t len) {
|
||||
}
|
||||
|
||||
const uint8_t gateway_id = setupGatewayId();
|
||||
if (len == 3 && data[0] == 0x01 && data[1] == 0x00 && data[2] == 0x00) {
|
||||
const bool ok = dali_domain_.pulseBusLow(gateway_id, config_.reset_pulse_ms);
|
||||
const uint8_t response[2] = {static_cast<uint8_t>(ok ? 0x01 : 0xFD), 0x00};
|
||||
const int written = usb_serial_jtag_write_bytes(response, sizeof(response),
|
||||
pdMS_TO_TICKS(config_.write_timeout_ms));
|
||||
if (written < 0 || static_cast<size_t>(written) != sizeof(response)) {
|
||||
ESP_LOGW(kTag, "failed to write USB bus reset response channel=%u ok=%u",
|
||||
config_.channel_index, ok ? 1 : 0);
|
||||
}
|
||||
if (!ok) {
|
||||
ESP_LOGW(kTag, "failed to pulse DALI bus low for USB reset channel=%u gateway=%u",
|
||||
config_.channel_index, gateway_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[0] == 0x12) {
|
||||
const auto response = dali_domain_.transactBridgeFrame(gateway_id, data, len);
|
||||
if (!response.empty()) {
|
||||
@@ -131,4 +147,4 @@ uint8_t GatewayUsbSetupBridge::setupGatewayId() const {
|
||||
return config_.channel_index;
|
||||
}
|
||||
|
||||
} // namespace gateway
|
||||
} // namespace gateway
|
||||
|
||||
Reference in New Issue
Block a user