bug-fixes

- UART 1 and 0 were mixed up
- LWT revisit
- Custom mode needs index
This commit is contained in:
Debashish Sahu 2019-03-16 12:50:23 -04:00
parent 2806bb0910
commit b15f013019
2 changed files with 13 additions and 13 deletions

View file

@ -99,16 +99,16 @@ WS2812FX* strip;
#endif #endif
#ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods #ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#ifndef LED_TYPE_WS2811 #ifndef LED_TYPE_WS2811
NeoEsp8266Uart0800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) NeoEsp8266Uart1800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else #else
NeoEsp8266Uart0400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) NeoEsp8266Uart1400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif #endif
#endif #endif
#ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods #ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#ifndef LED_TYPE_WS2811 #ifndef LED_TYPE_WS2811
NeoEsp8266Uart1800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) NeoEsp8266Uart0800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else #else
NeoEsp8266Uart1400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) NeoEsp8266Uart0400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif #endif
#endif #endif
@ -123,16 +123,16 @@ void initDMA(uint16_t stripSize = NUMLEDS){
#endif #endif
#ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods #ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#ifndef LED_TYPE_WS2811 #ifndef LED_TYPE_WS2811
dma = new NeoEsp8266Uart0800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) dma = new NeoEsp8266Uart1800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else #else
dma = new NeoEsp8266Uart0400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) dma = new NeoEsp8266Uart1400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif #endif
#endif #endif
#ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods #ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#ifndef LED_TYPE_WS2811 #ifndef LED_TYPE_WS2811
dma = new NeoEsp8266Uart1800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) dma = new NeoEsp8266Uart0800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else #else
dma = new NeoEsp8266Uart1400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) dma = new NeoEsp8266Uart0400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif #endif
#endif #endif
dma->Initialize(); dma->Initialize();
@ -293,7 +293,7 @@ void initStrip(uint16_t stripSize = WS2812FXStripSettings.stripSize, neoPixelTyp
strip->setColor(main_color.red, main_color.green, main_color.blue); strip->setColor(main_color.red, main_color.green, main_color.blue);
strip->setOptions(0, GAMMA); // We only have one WS2812FX segment, set color to human readable GAMMA correction strip->setOptions(0, GAMMA); // We only have one WS2812FX segment, set color to human readable GAMMA correction
#ifdef CUSTOM_WS2812FX_ANIMATIONS #ifdef CUSTOM_WS2812FX_ANIMATIONS
strip->setCustomMode(F("Fire 2012"), myCustomEffect); strip->setCustomMode(0, F("Fire 2012"), myCustomEffect);
#endif #endif
strip->start(); strip->start();
if(mode != HOLD) mode = SET_MODE; if(mode != HOLD) mode = SET_MODE;

View file

@ -999,7 +999,7 @@ void checkForRequests() {
if (mqtt_client.connect(mqtt_clientid, mqtt_user, mqtt_pass, mqtt_will_topic, 2, true, mqtt_will_payload, true)) { if (mqtt_client.connect(mqtt_clientid, mqtt_user, mqtt_pass, mqtt_will_topic, 2, true, mqtt_will_payload, true)) {
DBG_OUTPUT_PORT.println("MQTT connected!"); DBG_OUTPUT_PORT.println("MQTT connected!");
// Once connected, publish an announcement... // Once connected, publish an announcement...
char * message = new char[18 + strlen(HOSTNAME) + 1]; char message[18 + strlen(HOSTNAME) + 1];
strcpy(message, "McLighting ready: "); strcpy(message, "McLighting ready: ");
strcat(message, HOSTNAME); strcat(message, HOSTNAME);
mqtt_client.publish(mqtt_outtopic, message); mqtt_client.publish(mqtt_outtopic, message);
@ -1008,7 +1008,7 @@ void checkForRequests() {
if(mqtt_lwt_boot_flag) if(mqtt_lwt_boot_flag)
{ {
mqtt_client.publish(mqtt_will_topic, "ONLINE"); mqtt_client.publish(mqtt_will_topic, "ONLINE");
mqtt_lwt_boot_flag = false; //mqtt_lwt_boot_flag = false;
} }
#ifdef ENABLE_HOMEASSISTANT #ifdef ENABLE_HOMEASSISTANT
ha_send_data.detach(); ha_send_data.detach();
@ -1102,12 +1102,12 @@ void checkForRequests() {
DBG_OUTPUT_PORT.println("Connected to MQTT."); DBG_OUTPUT_PORT.println("Connected to MQTT.");
DBG_OUTPUT_PORT.print("Session present: "); DBG_OUTPUT_PORT.print("Session present: ");
DBG_OUTPUT_PORT.println(sessionPresent); DBG_OUTPUT_PORT.println(sessionPresent);
char * message = new char[18 + strlen(HOSTNAME) + 1]; char message[18 + strlen(HOSTNAME) + 1];
strcpy(message, "McLighting ready: "); strcpy(message, "McLighting ready: ");
strcat(message, HOSTNAME); strcat(message, HOSTNAME);
amqttClient.publish(mqtt_outtopic, qospub, false, message); amqttClient.publish(mqtt_outtopic, qospub, false, message);
//Subscribe //Subscribe
uint16_t packetIdSub1 = amqttClient.subscribe((char *)mqtt_intopic, qossub); uint16_t packetIdSub1 = amqttClient.subscribe(mqtt_intopic, qossub);
DBG_OUTPUT_PORT.printf("Subscribing at QoS %d, packetId: ", qossub); DBG_OUTPUT_PORT.println(packetIdSub1); DBG_OUTPUT_PORT.printf("Subscribing at QoS %d, packetId: ", qossub); DBG_OUTPUT_PORT.println(packetIdSub1);
if(mqtt_lwt_boot_flag) if(mqtt_lwt_boot_flag)
{ {