Merge pull request from toblum/develop

v2.2.3
This commit is contained in:
Debashish Sahu 2019-03-18 12:30:57 -04:00 committed by GitHub
commit e1361b4068
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 18 deletions

View file

@ -99,16 +99,16 @@ WS2812FX* strip;
#endif
#ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#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
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
#ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#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
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
@ -123,16 +123,16 @@ void initDMA(uint16_t stripSize = NUMLEDS){
#endif
#ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#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
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
#ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#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
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
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->setOptions(0, GAMMA); // We only have one WS2812FX segment, set color to human readable GAMMA correction
#ifdef CUSTOM_WS2812FX_ANIMATIONS
strip->setCustomMode(F("Fire 2012"), myCustomEffect);
strip->setCustomMode(0, F("Fire 2012"), myCustomEffect);
#endif
strip->start();
if(mode != HOLD) mode = SET_MODE;

View file

@ -66,9 +66,10 @@ uint32_t autoParams[][4] = { // color, speed, mode, duration (milliseconds)
#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)
const char mqtt_will_topic[] = HOSTNAME "/status";
const char mqtt_will_payload[] = "ONLINE";
const char mqtt_will_payload[] = "OFFLINE";
const char mqtt_intopic[] = HOSTNAME "/in";
const char mqtt_outtopic[] = HOSTNAME "/out";
bool mqtt_lwt_boot_flag = true;
#ifdef ENABLE_MQTT
#define MQTT_MAX_PACKET_SIZE 512

View file

@ -996,15 +996,20 @@ void checkForRequests() {
mqtt_reconnect_retries++;
DBG_OUTPUT_PORT.printf("Attempting MQTT connection %d / %d ...\n", mqtt_reconnect_retries, MQTT_MAX_RECONNECT_TRIES);
// Attempt to connect
if (mqtt_client.connect(mqtt_clientid, mqtt_user, mqtt_pass, mqtt_will_topic.c_str(), 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!");
// Once connected, publish an announcement...
char * message = new char[18 + strlen(HOSTNAME) + 1];
char message[18 + strlen(HOSTNAME) + 1];
strcpy(message, "McLighting ready: ");
strcat(message, HOSTNAME);
mqtt_client.publish(mqtt_outtopic, message);
// ... and resubscribe
mqtt_client.subscribe(mqtt_intopic, qossub);
if(mqtt_lwt_boot_flag)
{
mqtt_client.publish(mqtt_will_topic, "ONLINE");
//mqtt_lwt_boot_flag = false;
}
#ifdef ENABLE_HOMEASSISTANT
ha_send_data.detach();
mqtt_client.subscribe(mqtt_ha_state_in, qossub);
@ -1044,9 +1049,10 @@ void checkForRequests() {
unsigned int msg_len = measureJson(json) + 1;
char buffer[msg_len];
serializeJson(json, buffer, sizeof(buffer));
mqtt->beginPublish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), msg_len, true);
mqtt->write((const uint8_t*)buffer, msg_len);
mqtt->endPublish();
DBG_OUTPUT_PORT.println(buffer);
mqtt_client.beginPublish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), msg_len-1, true);
mqtt_client.write((const uint8_t*)buffer, msg_len-1);
mqtt_client.endPublish();
#endif
#endif
@ -1096,13 +1102,18 @@ void checkForRequests() {
DBG_OUTPUT_PORT.println("Connected to MQTT.");
DBG_OUTPUT_PORT.print("Session present: ");
DBG_OUTPUT_PORT.println(sessionPresent);
char * message = new char[18 + strlen(HOSTNAME) + 1];
char message[18 + strlen(HOSTNAME) + 1];
strcpy(message, "McLighting ready: ");
strcat(message, HOSTNAME);
amqttClient.publish(mqtt_outtopic, qospub, false, message);
//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);
if(mqtt_lwt_boot_flag)
{
amqttClient.publish(mqtt_will_topic, qospub, false, "ONLINE");
mqtt_lwt_boot_flag = false;
}
#ifdef ENABLE_HOMEASSISTANT
ha_send_data.detach();
uint16_t packetIdSub2 = amqttClient.subscribe((char *)mqtt_ha_state_in, qossub);

View file

@ -1 +1 @@
#define SKETCH_VERSION "2.2.2"
#define SKETCH_VERSION "2.2.3"

View file

@ -82,4 +82,10 @@
* 7 Mar 2019 v 2.2.2
* - Add compiler flag for WS2811 strips #define LED_TYPE_WS2811
* - Hotfix #351
*
* 18 Mar 2019 v 2.2.3 (mostly bugfix)
* - PubSubClient related bug fixed
* - UART 1 and 0 were mixed up
* - LWT revisit
* - Custom mode needs index
*/

View file

@ -70,6 +70,7 @@ I hope I didn't miss any sources and mentioned every author. In case I forgot so
- [ ] IR remote support [issue](https://github.com/toblum/McLightingUI/issues/3)
- [ ] Make number of pixels, MQTT and PIN configurable via front end [Issue](https://github.com/toblum/McLighting/issues/93) and [Issue](https://github.com/toblum/McLighting/issues/272)
- [ ] Make switching between methods: Adafruit NeoPixel, NeoPixelBus's DMA, NeoPixelBus's UART1 and NeoPixelBus's UART2 via REST API
- [ ] Add Espalexa library support [Issue](https://github.com/toblum/McLighting/issues/348)
- [x] Make number of pixels, RGB Order and PIN configurable via REST API
- [x] Bundle webpages instead of SPIFFS [Issue](https://github.com/toblum/McLighting/issues/93)
- [x] Music visualizer / Bring back ArtNet [Issue](https://github.com/toblum/McLighting/issues/111)