Add support for DT4, DT5, and DT6 devices

- Updated CMakeLists.txt to include new source files for DT4, DT5, and DT6.
- Modified dali.hpp to include headers for DT4, DT5, and DT6.
- Added command definitions for DT4, DT5, and DT6 in dali_define.hpp.
- Enhanced DaliDeviceCapabilities to support DT4, DT5, and DT6 detection.
- Implemented DT4 and DT5 classes with methods for device control and status querying.
- Created DT6 class with methods for device control and status querying.
- Updated decode.cpp to include new device types in the deviceTypeName mapping.
- Enhanced device.cpp to handle new device capabilities.
This commit is contained in:
Tony
2026-04-24 13:36:08 +08:00
parent 21afc6b942
commit bbcfcd11f6
12 changed files with 798 additions and 1 deletions
+78
View File
@@ -0,0 +1,78 @@
#pragma once
#include "base.hpp"
#include <optional>
class DaliDT5ConverterFeatures {
public:
explicit DaliDT5ConverterFeatures(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool outputRange0To10VSelectable() const { return bit(0x01); }
bool internalPullUpSelectable() const { return bit(0x02); }
bool outputFaultDetectionSelectable() const { return bit(0x04); }
bool mainsRelay() const { return bit(0x08); }
bool outputLevelQueryable() const { return bit(0x10); }
bool nonLogarithmicDimmingCurveSupported() const { return bit(0x20); }
bool physicalSelectionByOutputLossSupported() const { return bit(0x40); }
bool physicalSelectionSwitchSupported() const { return bit(0x80); }
private:
int raw_ = 0;
bool bit(int mask) const { return (raw_ & mask) != 0; }
};
class DaliDT5FailureStatus {
public:
explicit DaliDT5FailureStatus(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool outputFaultDetected() const { return (raw_ & 0x01) != 0; }
private:
int raw_ = 0;
};
class DaliDT5ConverterStatus {
public:
explicit DaliDT5ConverterStatus(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool zeroToTenVoltOperation() const { return (raw_ & 0x01) != 0; }
bool internalPullUpOn() const { return (raw_ & 0x02) != 0; }
bool nonLogarithmicDimmingCurveActive() const { return (raw_ & 0x04) != 0; }
private:
int raw_ = 0;
};
class DaliDT5 {
public:
explicit DaliDT5(DaliBase& base);
bool enableDT5();
bool setOutputRange1To10V(int a);
bool setOutputRange0To10V(int a);
bool switchOnInternalPullUp(int a);
bool switchOffInternalPullUp(int a);
bool storePhysicalMinimum(int a, int level);
bool selectDimmingCurve(int a, int curve);
bool resetConverterSettings(int a);
std::optional<int> getDimmingCurve(int a);
std::optional<int> getOutputLevelRaw(int a);
std::optional<double> getOutputLevelVolts(int a);
std::optional<DaliDT5ConverterFeatures> getConverterFeatures(int a);
std::optional<DaliDT5FailureStatus> getFailureStatus(int a);
std::optional<DaliDT5ConverterStatus> getConverterStatus(int a);
std::optional<int> getExtendedVersion(int a);
private:
DaliBase& base_;
bool enable();
static int addrOf(int a);
bool send(int a, int code, bool twice = false);
std::optional<int> query(int a, int code);
};