Files
gateway/components/knx_dali_gw/src/knx_dali_channel.h
T
Tony c60ef2ccde feat: Enhance DALI Gateway with RGBW and RGBCW support
- Added support for RGBW and RGBCW color modes in the DALI Gateway.
- Updated JSON color mode parsing to handle new color types.
- Extended the StoreDt8SceneSnapshot function to include white, amber, and free color parameters.
- Introduced new methods in DaliGatewayBridge for setting RGBW, RGBCW, and RGBWAF colors.
- Modified KnxDaliChannel to send RGBW and RGBCW colors based on the color type.
- Updated parameter types and definitions in the KNX product XML files to accommodate new color modes.
- Enhanced README with migration details and validation instructions.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-29 11:32:10 +08:00

92 lines
2.3 KiB
C++

#pragma once
// =============================================================================
// KnxDaliChannel — Per-address / per-group DALI channel (ported from DaliChannel)
// =============================================================================
#include "dali_gateway_bridge.h"
#include "knx/group_object.h"
#include <cstdint>
namespace gateway {
namespace knx_dali_gw {
class KnxDaliChannel {
public:
KnxDaliChannel();
~KnxDaliChannel();
void init(uint8_t channel_index, bool is_group, DaliGatewayBridge& bridge);
void setup();
void loop();
void processInputKo(GroupObject& ko);
// --- Configuration ---
void setOnValue(uint8_t value);
void setGroups(uint16_t groups);
void setGroupState(uint8_t group, bool state);
void setGroupState(uint8_t group, uint8_t value);
void setMinMax(uint8_t min, uint8_t max);
void setMinArc(uint8_t min);
void setHcl(uint8_t curve, uint16_t temp, uint8_t bri);
uint8_t getMin() const { return min_; }
uint8_t getMax() const { return max_; }
uint16_t getGroups() const { return groups_; }
bool isNight{false};
private:
enum class DimmDirection { kDown, kUp, kNone };
void loopDimming();
void loopStaircase();
void loopQueryLevel();
void sendColor();
void setSwitchState(bool value, bool is_switch_command = true);
void setDimmState(uint8_t value, bool is_dimm_command = true, bool is_last = false);
void koHandleSwitch(GroupObject& ko);
void koHandleDimmRel(GroupObject& ko);
void koHandleDimmAbs(GroupObject& ko);
void koHandleLock(GroupObject& ko);
void koHandleColor(GroupObject& ko);
DaliGatewayBridge* dali_{nullptr};
uint8_t index_{0};
bool is_group_{false};
// Dimming
DimmDirection dimm_direction_{DimmDirection::kNone};
uint8_t dimm_step_{0};
uint64_t dimm_last_{0};
uint8_t dimm_interval_{100};
// Staircase
uint64_t start_time_{0};
uint32_t interval_{0};
// Limits
uint8_t min_{0};
uint8_t max_{254};
uint8_t on_day_{100};
uint8_t on_night_{10};
// State
bool current_state_{false};
uint8_t current_step_{0};
bool current_is_locked_{false};
uint8_t current_color_[6]{};
// HCL
uint8_t hcl_curve_{255};
uint16_t hcl_current_temp_{0};
// Groups
uint16_t groups_{0};
};
} // namespace knx_dali_gw
} // namespace gateway