Merge pull request #6250 from s-hadinger/fix_6247

Fix #6247 and bug introduced in #6243
This commit is contained in:
Theo Arends 2019-08-17 11:15:31 +02:00 committed by GitHub
commit 8084c18c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -631,7 +631,7 @@ void MqttShowState(void)
for (uint32_t i = 1; i <= devices_present; i++) { for (uint32_t i = 1; i <= devices_present; i++) {
#ifdef USE_LIGHT #ifdef USE_LIGHT
if (i >= light_device) { if ((light_device) && (i >= light_device)) {
if (i == light_device) { LightState(1); } // call it only once if (i == light_device) { LightState(1); } // call it only once
} else { } else {
#endif #endif

View File

@ -1643,10 +1643,10 @@ void LightState(uint8_t append)
GetPowerDevice(scommand, light_device + i, sizeof(scommand), 1); GetPowerDevice(scommand, light_device + i, sizeof(scommand), 1);
uint32_t light_power_masked = light_power & (1 << i); // the light_power value for this device uint32_t light_power_masked = light_power & (1 << i); // the light_power value for this device
light_power_masked = light_power_masked ? 1 : 0; // convert to on/off light_power_masked = light_power_masked ? 1 : 0; // convert to on/off
ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_CHANNEL "%d\":%d"), scommand, GetStateText(light_power_masked), light_device + i, ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_CHANNEL "%d\":%d,"), scommand, GetStateText(light_power_masked), light_device + i,
changeUIntScale(light_current_color[i], 0, 255, 0, 100)); changeUIntScale(light_current_color[i], 0, 255, 0, 100));
} }
ResponseAppend_P(PSTR(",\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor)); ResponseAppend_P(PSTR("\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor));
} // light_pwm_multi_channels } // light_pwm_multi_channels
if (!append) { if (!append) {