Release v0.8.6

This commit is contained in:
cschwinne 2019-10-26 00:00:44 +02:00
parent 0cd46f932a
commit ba1117e10e
12 changed files with 26 additions and 13 deletions

View File

@ -2,7 +2,7 @@
<html> <html>
<head><meta charset="utf-8"><meta name="theme-color" content="#fff"> <head><meta charset="utf-8"><meta name="theme-color" content="#fff">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/> <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/>
<title>WLED 0.8.5</title> <title>WLED 0.8.6</title>
<script> <script>
var d=document; var d=document;
var w=window.getComputedStyle(d.querySelector("html")); var w=window.getComputedStyle(d.querySelector("html"));

View File

@ -7,7 +7,7 @@
<meta name="theme-color" content="#333333"> <meta name="theme-color" content="#333333">
<meta content="yes" name="apple-mobile-web-app-capable"> <meta content="yes" name="apple-mobile-web-app-capable">
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAGACGAAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAE1JREFUOI1j/P//PwOxgNGeAUMxE9G6cQCKDWAhpADZ2f8PMjBS3QW08QK20KaZC2gfC9hCnqouoNgARgY7zMxAyNlUdQHlXiAlO2MDAD63EVqNHAe0AAAAAElFTkSuQmCC"/> <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAGACGAAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAE1JREFUOI1j/P//PwOxgNGeAUMxE9G6cQCKDWAhpADZ2f8PMjBS3QW08QK20KaZC2gfC9hCnqouoNgARgY7zMxAyNlUdQHlXiAlO2MDAD63EVqNHAe0AAAAAElFTkSuQmCC"/>
<title>WLED 0.8.5</title> <title>WLED 0.8.6</title>
<script>function feedback(){}</script> <script>function feedback(){}</script>
<style> <style>
*{transition-duration: 0.5s;} *{transition-duration: 0.5s;}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -85,7 +85,7 @@ el.innerHTML=x;el.selectedIndex=pl?p:f;}).catch(function(){el.innerHTML=e;})}fun
<div class="helpB"><button type="button" onclick="H()">?</button></div> <div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr> <button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
<h2>LED setup</h2> <h2>LED setup</h2>
LED count: <input name="LC" type="number" min="1" max="1200" oninput=UI() required><br> LED count: <input name="LC" type="number" min="1" max="1500" oninput=UI() required><br>
<i>Recommended power supply for brightest white:</i><br> <i>Recommended power supply for brightest white:</i><br>
<b><span id="psu">?</span></b><br><br> <b><span id="psu">?</span></b><br><br>
Maximum Current: <input name="MA" type="number" min="250" max="65000" required> mA<br> Maximum Current: <input name="MA" type="number" min="250" max="65000" required> mA<br>

View File

@ -30,7 +30,7 @@
//#define WLED_ENABLE_FS_EDITOR //enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock //#define WLED_ENABLE_FS_EDITOR //enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock
//to toggle usb serial debug (un)comment the following line //to toggle usb serial debug (un)comment the following line
#define WLED_DEBUG //#define WLED_DEBUG
//library inclusions //library inclusions
@ -100,7 +100,7 @@
//version code in format yymmddb (b = daily build) //version code in format yymmddb (b = daily build)
#define VERSION 1910253 #define VERSION 1910255
char versionString[] = "0.8.6"; char versionString[] = "0.8.6";
@ -263,6 +263,7 @@ bool apActive = false;
bool forceReconnect = false; bool forceReconnect = false;
uint32_t lastReconnectAttempt = 0; uint32_t lastReconnectAttempt = 0;
bool interfacesInited = false; bool interfacesInited = false;
bool wasConnected = false;
//color //color
byte col[]{255, 159, 0, 0}; //target RGB(W) color byte col[]{255, 159, 0, 0}; //target RGB(W) color
@ -411,6 +412,9 @@ IPAddress ntpServerIP;
unsigned int ntpLocalPort = 2390; unsigned int ntpLocalPort = 2390;
#define NTP_PACKET_SIZE 48 #define NTP_PACKET_SIZE 48
#define MAX_LEDS 1500
#define MAX_LEDS_DMA 500
//string temp buffer (now stored in stack locally) //string temp buffer (now stored in stack locally)
#define OMAX 2048 #define OMAX 2048
char* obuf; char* obuf;

View File

@ -298,7 +298,7 @@ void loadSettingsFromEEPROM(bool first)
if (apChannel > 13 || apChannel < 1) apChannel = 1; if (apChannel > 13 || apChannel < 1) apChannel = 1;
apHide = EEPROM.read(228); apHide = EEPROM.read(228);
if (apHide > 1) apHide = 1; if (apHide > 1) apHide = 1;
ledCount = EEPROM.read(229) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > 1200 || ledCount == 0) ledCount = 30; ledCount = EEPROM.read(229) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > MAX_LEDS || ledCount == 0) ledCount = 30;
notifyButton = EEPROM.read(230); notifyButton = EEPROM.read(230);
notifyTwice = EEPROM.read(231); notifyTwice = EEPROM.read(231);

View File

@ -55,10 +55,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (subPage == 2) if (subPage == 2)
{ {
int t = request->arg("LC").toInt(); int t = request->arg("LC").toInt();
if (t > 0 && t <= 1200) ledCount = t; if (t > 0 && t <= MAX_LEDS) ledCount = t;
#ifndef ARDUINO_ARCH_ESP32 #ifndef ARDUINO_ARCH_ESP32
#if LEDPIN == 3 #if LEDPIN == 3
if (ledCount > 300) ledCount = 300; //DMA method uses too much ram if (ledCount > MAX_LEDS_DMA) ledCount = MAX_LEDS_DMA; //DMA method uses too much ram
#endif #endif
#endif #endif
strip.ablMilliampsMax = request->arg("MA").toInt(); strip.ablMilliampsMax = request->arg("MA").toInt();

View File

@ -6,10 +6,10 @@ void wledInit()
{ {
EEPROM.begin(EEPSIZE); EEPROM.begin(EEPSIZE);
ledCount = EEPROM.read(229) + ((EEPROM.read(398) << 8) & 0xFF00); ledCount = EEPROM.read(229) + ((EEPROM.read(398) << 8) & 0xFF00);
if (ledCount > 1200 || ledCount == 0) ledCount = 30; if (ledCount > MAX_LEDS || ledCount == 0) ledCount = 30;
#ifndef ARDUINO_ARCH_ESP32 #ifndef ARDUINO_ARCH_ESP32
#if LEDPIN == 3 #if LEDPIN == 3
if (ledCount > 300) ledCount = 300; //DMA method uses too much ram if (ledCount > MAX_LEDS_DMA) ledCount = MAX_LEDS_DMA; //DMA method uses too much ram
#endif #endif
#endif #endif
Serial.begin(115200); Serial.begin(115200);
@ -233,6 +233,7 @@ void initInterfaces() {
reconnectHue(); reconnectHue();
initMqtt(); initMqtt();
interfacesInited = true; interfacesInited = true;
wasConnected = true;
} }
byte stacO = 0; byte stacO = 0;
@ -262,6 +263,7 @@ void handleConnection() {
initConnection(); initConnection();
interfacesInited = false; interfacesInited = false;
forceReconnect = false; forceReconnect = false;
wasConnected = false;
return; return;
} }
if (!WLED_CONNECTED) { if (!WLED_CONNECTED) {
@ -271,7 +273,7 @@ void handleConnection() {
initConnection(); initConnection();
} }
if (millis() - lastReconnectAttempt > 300000 && WLED_WIFI_CONFIGURED) initConnection(); if (millis() - lastReconnectAttempt > 300000 && WLED_WIFI_CONFIGURED) initConnection();
if (!apActive && millis() - lastReconnectAttempt > 12000) initAP(); if (!apActive && millis() - lastReconnectAttempt > 12000 && (!wasConnected || apBehavior == 1)) initAP();
} else if (!interfacesInited) { //newly connected } else if (!interfacesInited) { //newly connected
DEBUG_PRINTLN(""); DEBUG_PRINTLN("");
DEBUG_PRINT("Connected! IP address: "); DEBUG_PRINT("Connected! IP address: ");

View File

@ -174,6 +174,9 @@ void handleNotifications()
//wled notifier, block if realtime packets active //wled notifier, block if realtime packets active
if (udpIn[0] == 0 && !realtimeActive && receiveNotifications) if (udpIn[0] == 0 && !realtimeActive && receiveNotifications)
{ {
//ignore notification if received within a second after sending a notification ourselves
if (millis() - notificationSentTime < 1000) return;
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects); bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
//apply colors from notification //apply colors from notification
if (receiveNotificationColor || !someSel) if (receiveNotificationColor || !someSel)

View File

@ -98,12 +98,12 @@ void publishMqtt()
const char HA_static_JSON[] PROGMEM = R"=====(,"bri_val_tpl":"{{value}}","rgb_cmd_tpl":"{{'#%02x%02x%02x' | format(red, green, blue)}}","rgb_val_tpl":"{{value[1:3]|int(base=16)}},{{value[3:5]|int(base=16)}},{{value[5:7]|int(base=16)}}","qos":0,"opt":true,"pl_on":"ON","pl_off":"OFF","fx_val_tpl":"{{value}}","fx_list":[)====="; const char HA_static_JSON[] PROGMEM = R"=====(,"bri_val_tpl":"{{value}}","rgb_cmd_tpl":"{{'#%02x%02x%02x' | format(red, green, blue)}}","rgb_val_tpl":"{{value[1:3]|int(base=16)}},{{value[3:5]|int(base=16)}},{{value[5:7]|int(base=16)}}","qos":0,"opt":true,"pl_on":"ON","pl_off":"OFF","fx_val_tpl":"{{value}}","fx_list":[)=====";
char buffer[2400]; //TODO: this is a TERRIBLE waste of precious memory, local var leads to exception though. Maybe dynamic allocation, but it is unclear when to free char* buffer;
void sendHADiscoveryMQTT() void sendHADiscoveryMQTT()
{ {
#if ARDUINO_ARCH_ESP32 || LEDPIN != 3 #if ARDUINO_ARCH_ESP32 || LWIP_VERSION_MAJOR > 1
/* /*
YYYY is device topic YYYY is device topic
@ -139,6 +139,8 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
*/ */
doSendHADiscovery = false; doSendHADiscovery = false;
if (mqtt == nullptr || !mqtt->connected()) return; if (mqtt == nullptr || !mqtt->connected()) return;
buffer = new char[2400];
if (!buffer) {delete[] buffer; return;}
char bufc[36], bufcol[38], bufg[36], bufapi[38]; char bufc[36], bufcol[38], bufg[36], bufapi[38];
@ -214,6 +216,8 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
strcat(pubt, "/config"); strcat(pubt, "/config");
bool success = mqtt->publish(pubt, 0, true, buffer); bool success = mqtt->publish(pubt, 0, true, buffer);
DEBUG_PRINTLN(success); DEBUG_PRINTLN(success);
yield();
delete[] buffer;
#endif #endif
} }