mirror of https://github.com/arendst/Tasmota.git
Fix discovery compile error when no light is enabled
This commit is contained in:
parent
e2b7cd96e6
commit
901d4a6a17
|
@ -79,18 +79,24 @@ void TasDiscoverMessage(void) {
|
||||||
PSTR(PUB_PREFIX),
|
PSTR(PUB_PREFIX),
|
||||||
PSTR(PUB_PREFIX2));
|
PSTR(PUB_PREFIX2));
|
||||||
|
|
||||||
uint8_t lightidx = MAX_RELAYS + 1; // Will store the starting position of the lights
|
uint8_t light_idx = MAX_RELAYS + 1; // Will store the starting position of the lights
|
||||||
if (Light.subtype > LST_NONE) {
|
uint8_t light_subtype = 0;
|
||||||
if (!light_controller.isCTRGBLinked()) { // One or two lights present
|
bool light_controller_isCTRGBLinked = false;
|
||||||
lightidx = TasmotaGlobal.devices_present - 2;
|
#ifdef USE_LIGHT
|
||||||
|
light_subtype = Light.subtype;
|
||||||
|
if (light_subtype > LST_NONE) {
|
||||||
|
light_controller_isCTRGBLinked = light_controller.isCTRGBLinked();
|
||||||
|
if (!light_controller_isCTRGBLinked) { // One or two lights present
|
||||||
|
light_idx = TasmotaGlobal.devices_present - 2;
|
||||||
} else {
|
} else {
|
||||||
lightidx = TasmotaGlobal.devices_present - 1;
|
light_idx = TasmotaGlobal.devices_present - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Light.device > 0) && Settings->flag3.pwm_multi_channels) { // How many relays are light devices?
|
if ((Light.device > 0) && Settings->flag3.pwm_multi_channels) { // How many relays are light devices?
|
||||||
lightidx = TasmotaGlobal.devices_present - Light.subtype;
|
light_idx = TasmotaGlobal.devices_present - light_subtype;
|
||||||
}
|
}
|
||||||
|
#endif // USE_LIGHT
|
||||||
|
|
||||||
uint16_t Relay[MAX_RELAYS] = { 0 }; // Base array to store the relay type
|
uint16_t Relay[MAX_RELAYS] = { 0 }; // Base array to store the relay type
|
||||||
uint16_t Shutter[MAX_RELAYS] = { 0 }; // Array to store a temp list for shutters
|
uint16_t Shutter[MAX_RELAYS] = { 0 }; // Array to store a temp list for shutters
|
||||||
|
@ -114,7 +120,7 @@ void TasDiscoverMessage(void) {
|
||||||
if (Shutter[i] != 0) { // Check if there are shutters present
|
if (Shutter[i] != 0) { // Check if there are shutters present
|
||||||
Relay[i] = 3; // Relay is a shutter
|
Relay[i] = 3; // Relay is a shutter
|
||||||
} else {
|
} else {
|
||||||
if (i >= lightidx || (iFanMod && (0 == i))) { // First relay on Ifan controls the light
|
if (i >= light_idx || (iFanMod && (0 == i))) { // First relay on Ifan controls the light
|
||||||
Relay[i] = 2; // Relay is a light
|
Relay[i] = 2; // Relay is a light
|
||||||
} else {
|
} else {
|
||||||
if (!iFanMod) { // Relays 2-4 for ifan are controlled by FANSPEED and don't need to be present if TasmotaGlobal.module_type = SONOFF_IFAN02 or SONOFF_IFAN03
|
if (!iFanMod) { // Relays 2-4 for ifan are controlled by FANSPEED and don't need to be present if TasmotaGlobal.module_type = SONOFF_IFAN02 or SONOFF_IFAN03
|
||||||
|
@ -182,8 +188,8 @@ void TasDiscoverMessage(void) {
|
||||||
Settings->flag4.alexa_ct_range,
|
Settings->flag4.alexa_ct_range,
|
||||||
Settings->flag5.mqtt_switches,
|
Settings->flag5.mqtt_switches,
|
||||||
Settings->flag5.fade_fixed_duration,
|
Settings->flag5.fade_fixed_duration,
|
||||||
light_controller.isCTRGBLinked(),
|
light_controller_isCTRGBLinked,
|
||||||
Light.subtype);
|
light_subtype);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MAX_SHUTTERS; i++) {
|
for (uint32_t i = 0; i < MAX_SHUTTERS; i++) {
|
||||||
#ifdef USE_SHUTTER
|
#ifdef USE_SHUTTER
|
||||||
|
|
Loading…
Reference in New Issue