Reduced JSON buffer by 1k.

Increased max RAM FX usage on ESP32 to 20k.
Added relay On handling on realtime data if Off (@JDTSmith).
Added UI refreshing via websockets (@korkbaum).
This commit is contained in:
Blaz Kristan 2021-03-18 23:19:17 +01:00
parent e6a99c1d33
commit c59e792178
7 changed files with 832 additions and 821 deletions

View File

@ -64,7 +64,7 @@
#else #else
#define MAX_NUM_SEGMENTS 18 #define MAX_NUM_SEGMENTS 18
#define MAX_NUM_TRANSITIONS 18 #define MAX_NUM_TRANSITIONS 18
#define MAX_SEGMENT_DATA 16384 #define MAX_SEGMENT_DATA 20480
#endif #endif
#define LED_SKIP_AMOUNT 1 #define LED_SKIP_AMOUNT 1

View File

@ -190,7 +190,7 @@
// maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266 // maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266
#ifndef MAX_LEDS #ifndef MAX_LEDS
#ifdef ESP8266 #ifdef ESP8266
#define MAX_LEDS 8192 //rely on memory limit to limit this to 1600 LEDs #define MAX_LEDS 1664 // can't rely on memory limit to limit this to 1600 LEDs
#else #else
#define MAX_LEDS 8192 #define MAX_LEDS 8192
#endif #endif
@ -205,7 +205,7 @@
#endif #endif
#ifndef MAX_LEDS_PER_BUS #ifndef MAX_LEDS_PER_BUS
#define MAX_LEDS_PER_BUS 4096 #define MAX_LEDS_PER_BUS 2048 // may not be enough for fast LEDs (i.e. APA102)
#endif #endif
// string temp buffer (now stored in stack locally) // string temp buffer (now stored in stack locally)
@ -228,7 +228,7 @@
// Size of buffer for API JSON object (increase for more segments) // Size of buffer for API JSON object (increase for more segments)
#ifdef ESP8266 #ifdef ESP8266
#define JSON_BUFFER_SIZE 10240 #define JSON_BUFFER_SIZE 9120
#else #else
#define JSON_BUFFER_SIZE 16384 #define JSON_BUFFER_SIZE 16384
#endif #endif

View File

@ -210,6 +210,12 @@ function onLoad()
sl.addEventListener('touchstart', toggleBubble); sl.addEventListener('touchstart', toggleBubble);
sl.addEventListener('touchend', toggleBubble); sl.addEventListener('touchend', toggleBubble);
} }
// Creatte UI update WS handler
var mySocket = new WebSocket('ws://'+loc?locip:window.location.hostname+'/ws');
mySocket.onmessage = function(event) {
requestJson({'v':true},false);
}
} }
function updateTablinks(tabI) function updateTablinks(tabI)
@ -960,8 +966,10 @@ function requestJson(command, rinfo = true, verbose = true, callback = null)
{ {
d.getElementById('connind').style.backgroundColor = "#a90"; d.getElementById('connind').style.backgroundColor = "#a90";
lastUpdate = new Date(); lastUpdate = new Date();
/*
if (refreshTimer) clearTimeout(refreshTimer); if (refreshTimer) clearTimeout(refreshTimer);
refreshTimer = setTimeout(function(){requestJson({'v':true},false);},15000); refreshTimer = setTimeout(function(){requestJson({'v':true},false);},15000);
*/
if (!jsonTimeout) jsonTimeout = setTimeout(showErrorToast, 3000); if (!jsonTimeout) jsonTimeout = setTimeout(showErrorToast, 3000);
var req = null; var req = null;
var e1 = d.getElementById('fxlist'); var e1 = d.getElementById('fxlist');

File diff suppressed because it is too large Load Diff

View File

@ -83,6 +83,9 @@ void realtimeLock(uint32_t timeoutMs, byte md)
realtimeTimeout = millis() + timeoutMs; realtimeTimeout = millis() + timeoutMs;
if (timeoutMs == 255001 || timeoutMs == 65000) realtimeTimeout = UINT32_MAX; if (timeoutMs == 255001 || timeoutMs == 65000) realtimeTimeout = UINT32_MAX;
if (bri == 0 && realtimeMode == REALTIME_MODE_INACTIVE && md != realtimeMode) {
toggleOnOff(); // if strip is off (bri==0) and change from inactive RTM
}
realtimeMode = md; realtimeMode = md;
if (arlsForceMaxBri && !realtimeOverride) strip.setBrightness(scaledBri(255)); if (arlsForceMaxBri && !realtimeOverride) strip.setBrightness(scaledBri(255));

View File

@ -247,7 +247,7 @@ bool handleIfNoneMatchCacheHeader(AsyncWebServerRequest* request)
void setStaticContentCacheHeaders(AsyncWebServerResponse *response) void setStaticContentCacheHeaders(AsyncWebServerResponse *response)
{ {
response->addHeader(F("Cache-Control"),"max-age=2592000"); response->addHeader(F("Cache-Control"),"max-age=86400"); // max 1 day for caching
response->addHeader(F("ETag"), String(VERSION)); response->addHeader(F("ETag"), String(VERSION));
} }

View File

@ -302,7 +302,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('v',SET_F("LC"),ledCount); sappend('v',SET_F("LC"),ledCount);
for (uint8_t s=0; s < busses.getNumBusses(); s++){ for (uint8_t s=0; s < busses.getNumBusses(); s++) {
Bus* bus = busses.getBus(s); Bus* bus = busses.getBus(s);
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length