Refactor KNX DALI Gateway Configuration and Update Device Parameters

- Introduced configuration macros for OEM manufacturer ID, application number, and application version in knxprod.h.
- Updated product identity definitions to use the new configuration macros.
- Modified device type enumeration to include additional device types.
- Adjusted color space enumeration values for consistency.
- Defined generated group object layout constants for memory offsets and block sizes.
- Enhanced knx_dali_gw.cpp to utilize the new configuration macros for manufacturer ID and program version.
- Updated the device initialization logic to reflect the new hardware and program version structures.
- Removed obsolete knx_dali_gw subproject and updated related submodules.

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-05-16 01:51:01 +08:00
parent 2a3808c1e4
commit e79223c87e
18 changed files with 699 additions and 780 deletions
+33 -14
View File
@@ -1,13 +1,27 @@
#pragma once
#include "sdkconfig.h"
#ifndef CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID
#define CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID 0x00A4
#endif
#ifndef CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER
#define CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER 0x0001
#endif
#ifndef CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION
#define CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION 0x08
#endif
// Minimal stub for knxprod.h — generated KNX product definitions.
// The full file (1796 bytes of parameters, 1439 group objects) will be
// adapted in Phase 3 to use the gateway/knx API directly.
// Product identity
#define MAIN_OpenKnxId 0xA4
#define MAIN_ApplicationNumber 1
#define MAIN_ApplicationVersion 5
#define MAIN_OpenKnxId (CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID & 0xff)
#define MAIN_ApplicationNumber CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER
#define MAIN_ApplicationVersion CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION
#define MAIN_OrderNumber "REG1-Dali"
#define MAIN_ParameterSize 1796
#define MAIN_MaxKoNumber 1439
@@ -17,8 +31,13 @@ enum PT_DeviceType : uint8_t {
PT_deviceType_Deaktiviert = 0,
PT_deviceType_DT0 = 1,
PT_deviceType_DT1 = 2,
PT_deviceType_DT6 = 3,
PT_deviceType_DT8 = 4,
PT_deviceType_DT2 = 3,
PT_deviceType_DT3 = 4,
PT_deviceType_DT4 = 5,
PT_deviceType_DT5 = 6,
PT_deviceType_DT6 = 7,
PT_deviceType_DT7 = 8,
PT_deviceType_DT8 = 9,
};
enum PT_ColorType : uint8_t {
@@ -29,8 +48,8 @@ enum PT_ColorType : uint8_t {
};
enum PT_ColorSpace : uint8_t {
PT_colorSpace_rgb = 0,
PT_colorSpace_xy = 1,
PT_colorSpace_rgb = 1,
PT_colorSpace_xy = 0,
};
// Placeholder macros — will be replaced with direct Bau07B0 access in Phase 3.
@@ -57,10 +76,10 @@ enum PT_ColorSpace : uint8_t {
#define ParamHCL_type(channelIndex) (0)
// Group object offset placeholders
#define ADR_KoOffset 0
#define GRP_KoOffset 0
#define HCL_KoOffset 0
#define ADR_KoBlockSize 0
#define GRP_KoBlockSize 0
#define HCL_KoBlockSize 0
// Generated group object layout constants
#define ADR_KoOffset 12
#define GRP_KoOffset 1164
#define HCL_KoOffset 1436
#define ADR_KoBlockSize 18
#define GRP_KoBlockSize 17
#define HCL_KoBlockSize 1
+39 -4
View File
@@ -2,6 +2,8 @@
#include "knx/bau07B0.h"
#include "sdkconfig.h"
#include "esp_log.h"
namespace gateway {
@@ -11,6 +13,38 @@ namespace {
constexpr const char* kTag = "knx_dali_gw";
#ifndef CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID
#define CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID 0x00A4
#endif
#ifndef CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER
#define CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER 0x0001
#endif
#ifndef CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION
#define CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION 0x08
#endif
constexpr uint16_t kKnxOemManufacturerId =
static_cast<uint16_t>(CONFIG_GATEWAY_KNX_OEM_MANUFACTURER_ID);
constexpr uint16_t kKnxOemApplicationNumber =
static_cast<uint16_t>(CONFIG_GATEWAY_KNX_OEM_APPLICATION_NUMBER);
constexpr uint8_t kKnxOemApplicationVersion =
static_cast<uint8_t>(CONFIG_GATEWAY_KNX_OEM_APPLICATION_VERSION);
constexpr uint8_t kKnxOemHardwareType[6] = {
0x00,
0x00,
static_cast<uint8_t>(kKnxOemManufacturerId & 0xff),
static_cast<uint8_t>(kKnxOemApplicationNumber & 0xff),
kKnxOemApplicationVersion,
0x00};
constexpr uint8_t kKnxOemProgramVersion[5] = {
static_cast<uint8_t>((kKnxOemManufacturerId >> 8) & 0xff),
static_cast<uint8_t>(kKnxOemManufacturerId & 0xff),
static_cast<uint8_t>((kKnxOemApplicationNumber >> 8) & 0xff),
static_cast<uint8_t>(kKnxOemApplicationNumber & 0xff),
kKnxOemApplicationVersion};
} // namespace
// =============================================================================
@@ -31,12 +65,13 @@ struct KnxDaliGateway::Impl {
bool init() {
if (initialized) return true;
device.deviceObject().manufacturerId(0x00a4);
device.deviceObject().manufacturerId(kKnxOemManufacturerId);
device.deviceObject().bauNumber(platform.uniqueSerialNumber());
const uint8_t order_number[10] = {'R', 'E', 'G', '1', '-', 'D', 'a', 'l', 'i', 0};
device.deviceObject().hardwareType(kKnxOemHardwareType);
const uint8_t order_number[10] = {
'R', 'E', 'G', '1', '-', 'D', 'a', 'l', 'i', 0};
device.deviceObject().orderNumber(order_number);
const uint8_t program_version[5] = {0x00, 0xa4, 0x00, 0x01, 0x05};
device.parameters().property(PID_PROG_VERSION)->write(program_version);
device.parameters().property(PID_PROG_VERSION)->write(kKnxOemProgramVersion);
device.readMemory();