Enhance DALI command handling: add support for repeated forward commands and introduce delay for specific commands
Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
+22
-3
@@ -229,14 +229,30 @@ DaliCompareAddrResult DaliAddr::compareAddr(int ad, std::optional<int> /*minH*/,
|
|||||||
int DaliAddr::compareMulti(int h, int m, int l, int ad) {
|
int DaliAddr::compareMulti(int h, int m, int l, int ad) {
|
||||||
int addr = ad + 1;
|
int addr = ad + 1;
|
||||||
int retL = l;
|
int retL = l;
|
||||||
|
int retM = m;
|
||||||
|
int retH = h;
|
||||||
|
|
||||||
for (int i = 0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
if (!base_.isAllocAddr) return addr - 1;
|
if (!base_.isAllocAddr) return addr - 1;
|
||||||
|
|
||||||
retL++;
|
if (addr > 63) {
|
||||||
if (retL > 255) break;
|
return addr - 1;
|
||||||
|
}
|
||||||
|
|
||||||
const auto ok = base_.compare(h, m, retL);
|
retL++;
|
||||||
|
if (retL > 255) {
|
||||||
|
retL = 0;
|
||||||
|
retM++;
|
||||||
|
if (retM > 255) {
|
||||||
|
retM = 0;
|
||||||
|
retH++;
|
||||||
|
if (retH > 255) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto ok = base_.compare(retH, retM, retL);
|
||||||
if (!ok.has_value() || !ok.value()) {
|
if (!ok.has_value() || !ok.value()) {
|
||||||
addr--;
|
addr--;
|
||||||
break;
|
break;
|
||||||
@@ -246,6 +262,9 @@ int DaliAddr::compareMulti(int h, int m, int l, int ad) {
|
|||||||
const auto status = base_.getOnlineStatus(addr);
|
const auto status = base_.getOnlineStatus(addr);
|
||||||
if (!status.has_value() || !status.value()) break;
|
if (!status.has_value() || !status.value()) break;
|
||||||
addr++;
|
addr++;
|
||||||
|
if (addr > 63) {
|
||||||
|
return addr - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!base_.programShortAddr(addr)) continue;
|
if (!base_.programShortAddr(addr)) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user