Dali add dimmer control

This commit is contained in:
Theo Arends 2024-10-10 18:04:27 +02:00
parent 04f3df8bf6
commit c7845f1864
1 changed files with 12 additions and 4 deletions

View File

@ -190,17 +190,25 @@ void DaliInput(void) {
if (Dali->input_ready) {
Dali->address = Dali->received_dali_data >> 8;
Dali->command = Dali->received_dali_data;
uint8_t dimmer = Dali->dimmer;
if (BROADCAST_DP == Dali->address) {
Dali->power = (Dali->command); // State
if (Dali->power) {
Dali->dimmer = Dali->command; // Value
}
}
// AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Received 0x%04X"), Dali->received_dali_data);
if (Settings->sbflag1.dali_web) { // DaliWeb 1
if (dimmer != Dali->dimmer) {
dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100);
char scmnd[20];
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), dimmer);
ExecuteCommand(scmnd, SRC_SWITCH);
}
} else {
ResponseDali();
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI));
}
Dali->input_ready = false;
}
}