Small memory improvements
This commit is contained in:
parent
b9c27ed324
commit
b72e6f16ca
@ -301,11 +301,10 @@ class WS2812FX {
|
||||
colorOrder = 0;
|
||||
paletteFade = 0;
|
||||
paletteBlend = 0;
|
||||
ablMilliampsMax = 750;
|
||||
ablMilliampsMax = 850;
|
||||
currentMilliamps = 0;
|
||||
_locked = NULL;
|
||||
_locked = nullptr;
|
||||
_modeUsesLock = false;
|
||||
_cronixieDigits = new byte[6];
|
||||
bus = new NeoPixelWrapper();
|
||||
RESET_RUNTIME;
|
||||
}
|
||||
@ -499,7 +498,7 @@ class WS2812FX {
|
||||
_triggered;
|
||||
|
||||
byte* _locked;
|
||||
byte* _cronixieDigits;
|
||||
byte _cronixieDigits[6];
|
||||
|
||||
mode_ptr _mode[MODE_COUNT]; // SRAM footprint: 4 bytes per element
|
||||
|
||||
|
4
wled00/data/update.htm
Normal file
4
wled00/data/update.htm
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head><meta content='width=device-width' name='viewport'><title>WLED Message</title><script>function B(){window.history.back()}</script>
|
||||
<style>:root{--aCol:#D9B310;--bCol:#0B3C5D;--cCol:#1D2731;--dCol:#328CC1;--sCol:#000;--tCol:#328CC1;--cFn:Verdana;}.bt{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%}</style></head>
|
||||
<body><h2>WLED Software Update</h2>Installed version: 0.8.4-dev<br>Download the latest binary: <a href="https://github.com/Aircoookie/WLED/releases"><img src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a><br><form method='POST' action='/update' enctype='multipart/form-data'><input type='file' class="bt" name='update' required><br><input type='submit' class="bt" value='Update!'></form><button type="button" class="bt" onclick="B()">Back</button></body></html>
|
@ -4,7 +4,7 @@
|
||||
|
||||
//USER HTML HERE (/u subpage)
|
||||
const char PAGE_usermod[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||
<html><body>There is no usermod installed or it doesn't specify a custom web page.</body></html>)=====";
|
||||
<html><body>No usermod installed or it doesn't specify a custom web page.</body></html>)=====";
|
||||
|
||||
|
||||
//server message
|
||||
@ -12,15 +12,21 @@ const char PAGE_msg[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||
<html><head><meta content='width=device-width' name='viewport'>
|
||||
<title>WLED Message</title>
|
||||
<script>function B(){window.history.back()};function RS(){window.location = "/settings";}function RP(){top.location.href="/";}</script>
|
||||
%CSS%.bt{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%%;margin:0;background-attachment:fixed}</style></head>
|
||||
%CSS%.bt{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%%;margin:0}</style></head>
|
||||
<body><h2>%MSG%</body></html>)=====";
|
||||
|
||||
|
||||
//firmware update page
|
||||
const char PAGE_update[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||
<html><head><meta content='width=device-width' name='viewport'><title>WLED Message</title><script>function B(){window.history.back()}</script>
|
||||
%CSS%.bt{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%%}</style></head>
|
||||
<body><h2>WLED Software Update</h2>Installed version: 0.8.4-dev<br>Download the latest binary: <a href="https://github.com/Aircoookie/WLED/releases"><img src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a><br><form method='POST' action='/update' enctype='multipart/form-data'><input type='file' class="bt" name='update' required><br><input type='submit' class="bt" value='Update!'></form><button type="button" class="bt" onclick="B()">Back</button></body></html>)=====";
|
||||
|
||||
|
||||
//new user welcome page
|
||||
#ifndef WLED_DISABLE_MOBILE_UI
|
||||
const char PAGE_welcome[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||
<html><head><meta content='width=device-width' name='viewport'>
|
||||
<title>WLED Welcome!</title>
|
||||
<html><head><meta content='width=device-width' name='viewport'><title>WLED Welcome!</title>
|
||||
%CSS%body{font-family:var(--cFn),sans-serif;text-align:center;background:linear-gradient(var(--bCol),black);margin:0;background-attachment: fixed;color: var(--tCol);}svg {fill: var(--dCol);}
|
||||
</style></head>
|
||||
<body>
|
||||
|
@ -89,7 +89,7 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1903091
|
||||
#define VERSION 1903092
|
||||
char versionString[] = "0.8.4-dev";
|
||||
|
||||
|
||||
@ -122,8 +122,6 @@ bool recoveryAPDisabled = false; //never open AP (not recommended)
|
||||
IPAddress staticIP(0, 0, 0, 0); //static IP of ESP
|
||||
IPAddress staticGateway(0, 0, 0, 0); //gateway (router) IP
|
||||
IPAddress staticSubnet(255, 255, 255, 0); //most common subnet in home networks
|
||||
IPAddress staticDNS(8, 8, 8, 8); //only for NTP, google DNS server
|
||||
|
||||
|
||||
//LED CONFIG
|
||||
uint16_t ledCount = 30; //overcurrent prevented by ABL
|
||||
@ -533,6 +531,7 @@ void loop() {
|
||||
if (aOtaEnabled) ArduinoOTA.handle();
|
||||
#endif
|
||||
handleNightlight();
|
||||
yield();
|
||||
if (!onlyAP) {
|
||||
handleHue();
|
||||
handleBlynk();
|
||||
|
@ -309,14 +309,14 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
|
||||
|
||||
//helper to get int value at a position in string
|
||||
int getNumVal(String* req, uint16_t pos)
|
||||
int getNumVal(const String* req, uint16_t pos)
|
||||
{
|
||||
return req->substring(pos+3).toInt();
|
||||
}
|
||||
|
||||
|
||||
//helper to get int value at a position in string
|
||||
bool updateVal(String* req, const char* key, byte* val, byte minv=0, byte maxv=255)
|
||||
bool updateVal(const String* req, const char* key, byte* val, byte minv=0, byte maxv=255)
|
||||
{
|
||||
int pos = req->indexOf(key);
|
||||
if (pos < 1) return false;
|
||||
@ -346,7 +346,7 @@ bool updateVal(String* req, const char* key, byte* val, byte minv=0, byte maxv=2
|
||||
|
||||
|
||||
//HTTP API request parser
|
||||
bool handleSet(AsyncWebServerRequest *request, String req)
|
||||
bool handleSet(AsyncWebServerRequest *request, const String& req)
|
||||
{
|
||||
if (!(req.indexOf("win") >= 0)) return false;
|
||||
|
||||
|
@ -175,7 +175,7 @@ void initCon()
|
||||
|
||||
if (staticIP[0] != 0)
|
||||
{
|
||||
WiFi.config(staticIP, staticGateway, staticSubnet, staticDNS);
|
||||
WiFi.config(staticIP, staticGateway, staticSubnet, IPAddress(8,8,8,8));
|
||||
} else
|
||||
{
|
||||
WiFi.config(0U, 0U, 0U);
|
||||
|
@ -60,7 +60,8 @@ BLYNK_WRITE(V2)
|
||||
|
||||
BLYNK_WRITE(V3)
|
||||
{
|
||||
handleSet(nullptr, (param.asInt()>0)?"win&T=1&IN":"win&T=0&IN");//power
|
||||
bool on = (param.asInt()>0);
|
||||
if (!on != !bri) {toggleOnOff(); colorUpdated(9);}
|
||||
}
|
||||
|
||||
BLYNK_WRITE(V4)
|
||||
@ -83,7 +84,7 @@ BLYNK_WRITE(V6)
|
||||
|
||||
BLYNK_WRITE(V7)
|
||||
{
|
||||
handleSet(nullptr, (param.asInt()>0)?"win&ND&IN":"win&NL=0&IN");//nl
|
||||
nightlightActive = (param.asInt()>0);
|
||||
}
|
||||
|
||||
BLYNK_WRITE(V8)
|
||||
|
@ -90,19 +90,6 @@ void initServer()
|
||||
server.on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||
});
|
||||
|
||||
server.on("/power", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
String val = "";
|
||||
if (strip.currentMilliamps == 0)
|
||||
{
|
||||
val = "Power calculation disabled";
|
||||
} else
|
||||
{
|
||||
val += (String)strip.currentMilliamps;
|
||||
val += "mA currently";
|
||||
}
|
||||
serveMessage(request, 200, val, "This is just an estimate (does not account for factors like wire resistance). It is NOT a measurement!", 254);
|
||||
});
|
||||
//*******END*******/
|
||||
|
||||
server.on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
@ -127,10 +114,9 @@ void initServer()
|
||||
//init ota page
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(request, 200, "WLED Software Update", "Installed version: " + String(versionString) + "<br>Download the latest binary: "
|
||||
"<a href=\"https://github.com/Aircoookie/WLED/releases\"><img src=\"https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square\"></a>"
|
||||
"<br><form method='POST' action='/update' enctype='multipart/form-data'>"
|
||||
"<input type='file' class=\"bt\" name='update' required><br><input type='submit' class=\"bt\" value='Update!'></form>", 254);
|
||||
olen = 0;
|
||||
getCSSColors();
|
||||
request->send_P(200, "text/html", PAGE_update, msgProcessor);
|
||||
});
|
||||
|
||||
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
@ -251,8 +237,7 @@ String msgProcessor(const String& var)
|
||||
{
|
||||
if (var == "CSS") return String(obuf);
|
||||
if (var == "MSG") {
|
||||
String messageBody = "";
|
||||
messageBody += messageHead;
|
||||
String messageBody = messageHead;
|
||||
messageBody += "</h2>";
|
||||
messageBody += messageSub;
|
||||
uint32_t optt = optionType;
|
||||
|
Loading…
Reference in New Issue
Block a user