diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 9ba91f091..b54a32f3c 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -168,6 +168,8 @@ typedef unsigned long power_t; // Power (Relay) type #define NEO_RGBW 5 // Neopixel RGBW leds #define NEO_GRBW 6 // Neopixel GRBW leds +#define LT_SM16716 16 // Lights that use SM16716 will have this bit set in light_type + #define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library #define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete #define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - obsolete but define is present for debugging purposes diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 694f7d4c9..7be59f746 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2425,7 +2425,7 @@ void GpioInit(void) #ifdef USE_SM16716 if (SM16716_ModuleSelected()) { light_type += 3; - light_type |= 16; + light_type |= LT_SM16716; } #endif // ifdef USE_SM16716 if (!light_type) { diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index f65dd43da..bc4a9b91c 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -517,7 +517,7 @@ void LightInit(void) } #endif // USE_WS2812 ************************************************************************ #ifdef USE_SM16716 - else if (16 & light_type) { + else if (LT_SM16716 == light_type - light_subtype) { // init PWM for (uint8_t i = 0; i < light_subtype; i++) { Settings.pwm_value[i] = 0; // Disable direct PWM control @@ -985,7 +985,7 @@ void LightAnimate(void) } #endif // USE_ES2812 ************************************************************************ #ifdef USE_SM16716 - else if (16 & light_type) { + else if (LT_SM16716 == light_type - light_subtype) { // handle any PWM pins, skipping the first 3 values for sm16716 for (uint8_t i = 3; i < light_subtype; i++) { if (pin[GPIO_PWM1 +i-3] < 99) {