feat(gateway): add DALI bus ID configuration and enhance group object write handling
Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -713,6 +713,24 @@ config GATEWAY_KNX_MAIN_GROUP
|
||||
Main group used by the built-in KNX to DALI router. Middle groups select
|
||||
the data type and subgroups select broadcast, short-address, or group targets.
|
||||
|
||||
config GATEWAY_KNX_DALI_BUS_ID
|
||||
int "KNX database target DALI bus id"
|
||||
depends on GATEWAY_KNX_BRIDGE_SUPPORTED
|
||||
range 0 15
|
||||
default 0
|
||||
help
|
||||
Selects the native DALI HAL bus targeted by the ETS KNX product database.
|
||||
The current KNX-DALI application supports one ETS-controlled DALI bus.
|
||||
|
||||
config GATEWAY_KNX_DEBUG_DUMP_MEMORY
|
||||
bool "Dump full OpenKNX memory for debugging"
|
||||
depends on GATEWAY_KNX_BRIDGE_SUPPORTED
|
||||
default n
|
||||
help
|
||||
Prints the complete OpenKNX non-volatile memory image when it is restored
|
||||
or committed. Enable only while debugging ETS download and association
|
||||
table issues, because the log is large and may include KNX configuration data.
|
||||
|
||||
config GATEWAY_KNX_TUNNEL_ENABLED
|
||||
bool "Enable KNXnet/IP tunneling mode"
|
||||
depends on GATEWAY_KNX_BRIDGE_SUPPORTED
|
||||
|
||||
@@ -219,6 +219,10 @@
|
||||
#define CONFIG_GATEWAY_KNX_MAIN_GROUP 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_GATEWAY_KNX_DALI_BUS_ID
|
||||
#define CONFIG_GATEWAY_KNX_DALI_BUS_ID 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_GATEWAY_KNX_UDP_PORT
|
||||
#define CONFIG_GATEWAY_KNX_UDP_PORT 3671
|
||||
#endif
|
||||
@@ -606,6 +610,22 @@ bool ValidateChannelBindings() {
|
||||
|
||||
if (kKnxBridgeSupported) {
|
||||
const int knx_uart = CONFIG_GATEWAY_KNX_TP_UART_PORT;
|
||||
if (kKnxBridgeStartupEnabled) {
|
||||
const uint8_t knx_dali_bus_id = static_cast<uint8_t>(CONFIG_GATEWAY_KNX_DALI_BUS_ID);
|
||||
int matches = 0;
|
||||
for (int i = 0; i < CONFIG_GATEWAY_CHANNEL_COUNT; ++i) {
|
||||
if (channels[i].enabled && channels[i].native_phy &&
|
||||
channels[i].native_bus_id == knx_dali_bus_id) {
|
||||
++matches;
|
||||
}
|
||||
}
|
||||
if (matches != 1) {
|
||||
ESP_LOGE(kTag,
|
||||
"KNX DALI bus id %u must match exactly one enabled native DALI channel",
|
||||
knx_dali_bus_id);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (knx_uart >= 0 && k485ControlEnabled && knx_uart == 0) {
|
||||
ESP_LOGE(kTag, "KNX TP UART0 conflicts with the UART0 control bridge");
|
||||
return false;
|
||||
@@ -864,6 +884,7 @@ extern "C" void app_main(void) {
|
||||
default_knx.tunnel_enabled = kKnxTunnelEnabled;
|
||||
default_knx.multicast_enabled = kKnxMulticastEnabled;
|
||||
default_knx.main_group = static_cast<uint8_t>(CONFIG_GATEWAY_KNX_MAIN_GROUP);
|
||||
default_knx.dali_bus_id = static_cast<uint8_t>(CONFIG_GATEWAY_KNX_DALI_BUS_ID);
|
||||
default_knx.udp_port = static_cast<uint16_t>(CONFIG_GATEWAY_KNX_UDP_PORT);
|
||||
default_knx.multicast_address = CONFIG_GATEWAY_KNX_MULTICAST_ADDRESS;
|
||||
default_knx.ip_interface_individual_address =
|
||||
|
||||
@@ -681,6 +681,8 @@ CONFIG_GATEWAY_KNX_OEM_HARDWARE_ID=0xa401
|
||||
CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER=0x0001
|
||||
CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION=0x08
|
||||
CONFIG_GATEWAY_KNX_MAIN_GROUP=0
|
||||
CONFIG_GATEWAY_KNX_DALI_BUS_ID=0
|
||||
# CONFIG_GATEWAY_KNX_DEBUG_DUMP_MEMORY is not set
|
||||
CONFIG_GATEWAY_KNX_TUNNEL_ENABLED=y
|
||||
CONFIG_GATEWAY_KNX_MULTICAST_ENABLED=y
|
||||
CONFIG_GATEWAY_KNX_UDP_PORT=3671
|
||||
|
||||
@@ -676,10 +676,13 @@ CONFIG_GATEWAY_KNX_DATA_SECURE_SUPPORTED=y
|
||||
# CONFIG_GATEWAY_KNX_IP_SECURE_SUPPORTED is not set
|
||||
# CONFIG_GATEWAY_KNX_SECURITY_DEV_ENDPOINTS is not set
|
||||
CONFIG_GATEWAY_KNX_SECURITY_PLAIN_NVS=y
|
||||
CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID=0x00fa
|
||||
CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER=0xa401
|
||||
CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID=0x01e5
|
||||
CONFIG_GATEWAY_KNX_OEM_HARDWARE_ID=0xa401
|
||||
CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER=0x0001
|
||||
CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION=0x08
|
||||
CONFIG_GATEWAY_KNX_MAIN_GROUP=0
|
||||
CONFIG_GATEWAY_KNX_DALI_BUS_ID=0
|
||||
# CONFIG_GATEWAY_KNX_DEBUG_DUMP_MEMORY is not set
|
||||
CONFIG_GATEWAY_KNX_TUNNEL_ENABLED=y
|
||||
CONFIG_GATEWAY_KNX_MULTICAST_ENABLED=y
|
||||
CONFIG_GATEWAY_KNX_UDP_PORT=3671
|
||||
|
||||
Reference in New Issue
Block a user