fix(gateway): update DALI configuration parameters for improved performance and reliability

This commit add comat parameter for some old DALI-1 control gear.

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-05-21 17:03:35 +08:00
parent 0827befb06
commit 20642e5ec3
8 changed files with 239 additions and 73 deletions
+11 -11
View File
@@ -17,11 +17,11 @@ config DALI_DEFAULT_BAUDRATE
config DALI_TIMER_RESOLUTION_HZ
int "Native DALI timer resolution Hz"
range 1000000 8000000
default 3000000
default 3636363
help
GPTimer resolution for native DALI Manchester timing. The default 3 MHz
allows a 1200 bps half-bit period of 416.67 us to be represented as
1250 timer ticks.
GPTimer resolution for native DALI Manchester timing. The default
3.636363 MHz timing matches the gateway's tuned 1200 bps behavior for
older control gear that needs more recovery margin between commands.
config DALI_CUSTOM_HALF_BIT_TIME_X100_US
int "Custom native DALI half-bit time x100 us"
@@ -51,7 +51,7 @@ config DALI_RX_STOP_CONDITION_US
config DALI_QUERY_RESPONSE_TIMEOUT_MS
int "DALI query response timeout ms"
range 10 100
default 25
default 30
help
Time to wait for a complete backward frame after a forward query has
finished transmitting. DALI backward frames start 5.5-10.5 ms after the
@@ -61,7 +61,7 @@ config DALI_QUERY_RESPONSE_TIMEOUT_MS
config DALI_DOUBLE_SEND_DELAY_MS
int "Double-send delay ms"
range 0 100
default 10
default 20
help
Delay between the two frames sent by dali_send_double(), measured after
the first frame has completed. Exposed for development tuning.
@@ -69,7 +69,7 @@ config DALI_DOUBLE_SEND_DELAY_MS
config DALI_FORWARD_ACTIVITY_WAIT_MS
int "Forward-frame wait after bus activity ms"
range 0 1000
default 25
default 20
help
Minimum delay before sending a 2- to 4-byte forward frame after normal
bus activity. This is the native queue anti-collision wait.
@@ -77,7 +77,7 @@ config DALI_FORWARD_ACTIVITY_WAIT_MS
config DALI_FORWARD_AFTER_BACKWARD_WAIT_MS
int "Forward-frame wait after backward frame ms"
range 0 1000
default 5
default 10
help
Minimum delay before sending a 2- to 4-byte forward frame after the last
valid 1-byte backward frame received by the native bus.
@@ -94,7 +94,7 @@ config DALI_FORWARD_MAX_WAIT_MS
config DALI_BACKWARD_IDLE_TIMEOUT_MS
int "Backward-frame idle wait timeout ms"
range 0 1000
default 9
default 10
help
Time a 1-byte backward frame waits for an idle bus before being sent
anyway. Backward frame sends are not echo-verified because collisions
@@ -103,7 +103,7 @@ config DALI_BACKWARD_IDLE_TIMEOUT_MS
config DALI_BUS_POWER_CHECK_INTERVAL_MS
int "Bus power-down check interval ms"
range 10 5000
default 100
default 500
help
Interval used to resample the RX pin while the native DALI bus is marked
power-down. This lets the HAL recover when the bus was already powered
@@ -112,7 +112,7 @@ config DALI_BUS_POWER_CHECK_INTERVAL_MS
config DALI_BUS_ABNORMAL_REPORT_INTERVAL_MS
int "Legacy bus abnormal report interval ms"
range 0 60000
default 1000
default 3000
help
Interval for publishing the legacy two-byte FF FD bus-abnormal raw frame
while the native DALI bus is power-down. Set to 0 to disable the report.
+3 -3
View File
@@ -53,13 +53,13 @@ Use `menuconfig` under `DALI Component` to configure:
The native bus monitor uses `CONFIG_DALI_BUS_POWER_CHECK_INTERVAL_MS` to resample RX while
power-down and `CONFIG_DALI_BUS_ABNORMAL_REPORT_INTERVAL_MS` to publish legacy `FF FD`
raw frames while down. The report interval defaults to 1000 ms; set it to 0 to disable the
raw frames while down. The report interval defaults to 3000 ms; set it to 0 to disable the
compatibility report.
Native timing defaults target standard 1200 bps DALI: a 416.67 us half-bit period is
generated by the default 3 MHz timer as 1250 ticks. `CONFIG_DALI_CUSTOM_HALF_BIT_TIME_X100_US`
generated by the default 3.636363 MHz timer. `CONFIG_DALI_CUSTOM_HALF_BIT_TIME_X100_US`
can override the half-bit period for development; keep it at 0 for baudrate-derived timing.
Query no-response timeout defaults to 25 ms, which covers the 5.5-10.5 ms backward-frame
Query no-response timeout defaults to 30 ms, which covers the 5.5-10.5 ms backward-frame
start window plus the approximately 9.95 ms backward frame duration.
Native TX queue arbitration uses frame length as the frame type signal. Two- to four-byte
+2 -2
View File
@@ -7,11 +7,11 @@
#include "freertos/semphr.h"
#ifndef CONFIG_DALI_QUERY_RESPONSE_TIMEOUT_MS
#define CONFIG_DALI_QUERY_RESPONSE_TIMEOUT_MS 25
#define CONFIG_DALI_QUERY_RESPONSE_TIMEOUT_MS 30
#endif
#ifndef CONFIG_DALI_DOUBLE_SEND_DELAY_MS
#define CONFIG_DALI_DOUBLE_SEND_DELAY_MS 10
#define CONFIG_DALI_DOUBLE_SEND_DELAY_MS 20
#endif
static SemaphoreHandle_t s_dali_core_lock;
+6 -6
View File
@@ -64,7 +64,7 @@
#endif
#ifndef CONFIG_DALI_TIMER_RESOLUTION_HZ
#define CONFIG_DALI_TIMER_RESOLUTION_HZ 3000000
#define CONFIG_DALI_TIMER_RESOLUTION_HZ 3636363
#endif
#ifndef CONFIG_DALI_CUSTOM_HALF_BIT_TIME_X100_US
@@ -80,19 +80,19 @@
#endif
#ifndef CONFIG_DALI_BUS_POWER_CHECK_INTERVAL_MS
#define CONFIG_DALI_BUS_POWER_CHECK_INTERVAL_MS 100
#define CONFIG_DALI_BUS_POWER_CHECK_INTERVAL_MS 500
#endif
#ifndef CONFIG_DALI_BUS_ABNORMAL_REPORT_INTERVAL_MS
#define CONFIG_DALI_BUS_ABNORMAL_REPORT_INTERVAL_MS 1000
#define CONFIG_DALI_BUS_ABNORMAL_REPORT_INTERVAL_MS 3000
#endif
#ifndef CONFIG_DALI_FORWARD_ACTIVITY_WAIT_MS
#define CONFIG_DALI_FORWARD_ACTIVITY_WAIT_MS 25
#define CONFIG_DALI_FORWARD_ACTIVITY_WAIT_MS 20
#endif
#ifndef CONFIG_DALI_FORWARD_AFTER_BACKWARD_WAIT_MS
#define CONFIG_DALI_FORWARD_AFTER_BACKWARD_WAIT_MS 5
#define CONFIG_DALI_FORWARD_AFTER_BACKWARD_WAIT_MS 10
#endif
#ifndef CONFIG_DALI_FORWARD_MAX_WAIT_MS
@@ -100,7 +100,7 @@
#endif
#ifndef CONFIG_DALI_BACKWARD_IDLE_TIMEOUT_MS
#define CONFIG_DALI_BACKWARD_IDLE_TIMEOUT_MS 9
#define CONFIG_DALI_BACKWARD_IDLE_TIMEOUT_MS 10
#endif
#define WITHIN_RANGE(x, min, max) ((x) > (min) && (x) < (max))