Added preprocessor constant for LT_SM16716 for improved code readability

Note that this differs from other LT_* in that it's not an enum
Ensure the SM16716 codepath is only taken when the top half of light_type is LT_SM16716
This commit is contained in:
Colin Kuebler 2019-02-01 19:41:12 -05:00
parent 6d19a9c998
commit d7b8a6453d
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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) {