Skip to content

Commit

Permalink
FS working for ESP8266
Browse files Browse the repository at this point in the history
  • Loading branch information
Aircoookie committed Nov 8, 2020
1 parent 362156c commit 98e4ac6
Show file tree
Hide file tree
Showing 12 changed files with 2,601 additions and 1,969 deletions.
10 changes: 6 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ build_flags = -g -w -DMQTT_MAX_PACKET_SIZE=1024 -DPIO_FRAMEWORK_ARDUINO_LWIP_HIG
-D DECODE_LG=true

build_flags_esp8266 = ${common.build_flags} -DESP8266
build_flags_esp32 = ${common.build_flags} -DARDUINO_ARCH_ESP32
build_flags_esp32 = ${common.build_flags} -DARDUINO_ARCH_ESP32 -DCONFIG_LITTLEFS_FOR_IDF_3_2

# enables all features for travis CI
build_flags_all_features =
Expand All @@ -138,6 +138,8 @@ build_flags_all_features =

ldscript_512k = eagle.flash.512k.ld ;for older versions change this to eagle.flash.512k0.ld
ldscript_1m0m = eagle.flash.1m.ld ;for older versions change this to eagle.flash.1m0.ld
ldscript_1m128k = eagle.flash.1m128.ld
ldscript_2m512k = eagle.flash.2m512.ld
ldscript_2m1m = eagle.flash.2m1m.ld
ldscript_4m1m = eagle.flash.4m1m.ld
ldscript_4m3m = eagle.flash.4m3m.ld
Expand Down Expand Up @@ -165,13 +167,13 @@ lib_extra_dirs =
lib_compat_mode = strict
lib_deps =
[email protected]
#[email protected]
https://github.com/Makuna/NeoPixelBus
[email protected]
[email protected]
ESPAsyncUDP
[email protected]
https://github.com/Aircoookie/ESPAsyncWebServer
[email protected]
https://github.com/lorol/LITTLEFS.git
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
#TFT_eSPI
#For use SSD1306 OLED display uncomment following
Expand Down Expand Up @@ -213,7 +215,7 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABL
[env:esp01_1m_full]
board = esp01_1m
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_1m0m}
board_build.ldscript = ${common.ldscript_1m128k}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA

[env:esp07]
Expand Down
4 changes: 2 additions & 2 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
/* each segment uses 52 bytes of SRAM memory, so if you're application fails because of
insufficient memory, decreasing MAX_NUM_SEGMENTS may help */
#ifdef ESP8266
#define MAX_NUM_SEGMENTS 10
#define MAX_NUM_SEGMENTS 12
#else
#define MAX_NUM_SEGMENTS 10
#define MAX_NUM_SEGMENTS 16
#endif

/* How much data bytes all segments combined may allocate */
Expand Down
14 changes: 13 additions & 1 deletion wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void deserializeConfig() {
getStringFromJson(otaPass, pwd, 33); //normally not present due to security
}

//DMX missing!

}

void serializeConfig() {
Expand Down Expand Up @@ -564,6 +564,18 @@ void serializeConfig() {
ota[F("lock-wifi")] = wifiLock;
ota[F("pskl")] = strlen(otaPass);
ota[F("aota")] = aOtaEnabled;

#ifdef WLED_ENABLE_DMX
JsonObject dmx = doc.createNestedObject("dmx");
dmx[F("chan")] = DMXChannels;
dmx[F("gap")] = DMXGap;
dmx[F("start")] = DMXStart;
dmx[F("start-led")] = DMXStartLED;

JsonArray dmx_fixmap = dmx.createNestedArray("fixmap");
for (byte i = 0; i < 15; i++)
dmx_fixmap.add(DMXFixtureMap[i]);
#endif
//}

File f = WLED_FS.open("/cfg.json", "w");
Expand Down
517 changes: 427 additions & 90 deletions wled00/data/index.htm

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions wled00/data/settings_time.htm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
var ih="<tr><th>Active</th><th>Hour</th><th>Minute</th><th>Preset</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>";
for (i=0;i<8;i++)
{
ih+="<tr><td><input name=\"W"+i+"\" id=\"W"+i+"\" type=\"number\" style=\"display:none\"><input id=\"W"+i+"0\" type=\"checkbox\"></td><td><input name=\"H"+i+"\" type=\"number\" min=\"0\" max=\"24\"></td><td><input name=\"N"+i+"\" type=\"number\" min=\"0\" max=\"59\"></td><td><input name=\"T"+i+"\" type=\"number\" min=\"0\" max=\"16\"></td>";
ih+="<tr><td><input name=\"W"+i+"\" id=\"W"+i+"\" type=\"number\" style=\"display:none\"><input id=\"W"+i+"0\" type=\"checkbox\"></td><td><input name=\"H"+i+"\" type=\"number\" min=\"0\" max=\"24\"></td><td><input name=\"N"+i+"\" type=\"number\" min=\"0\" max=\"59\"></td><td><input name=\"T"+i+"\" type=\"number\" min=\"0\" max=\"250\"></td>";
for (j=1;j<8;j++) ih+="<td><input id=\"W"+i+j+"\" type=\"checkbox\"></td>";
}
gId("TMT").innerHTML=ih;
Expand Down Expand Up @@ -139,11 +139,11 @@ <h3>Macro presets</h3>
<i>Presets now also can be used as macros to save both JSON and HTTP API commands.<br>
Just enter the preset id below!</i>
<i>Use 0 for the default action instead of a preset</i><br>
Alexa On/Off Preset: <input name="A0" type="number" min="0" max="16" required> <input name="A1" type="number" min="0" max="16" required><br>
Button short press Preset: Macro: <input name="MP" type="number" min="0" max="16" required><br>
Long Press: <input name="ML" type="number" min="0" max="16" required> Double press: <input name="MD" type="number" min="0" max="16" required><br>
Countdown-Over Preset: <input name="MC" type="number" min="0" max="16" required><br>
Timed-Light-Over Presets: <input name="MN" type="number" min="0" max="16" required><br>
Alexa On/Off Preset: <input name="A0" type="number" min="0" max="250" required> <input name="A1" type="number" min="0" max="250" required><br>
Button short press Preset: Macro: <input name="MP" type="number" min="0" max="250" required><br>
Long Press: <input name="ML" type="number" min="0" max="250" required> Double press: <input name="MD" type="number" min="0" max="250" required><br>
Countdown-Over Preset: <input name="MC" type="number" min="0" max="250" required><br>
Timed-Light-Over Presets: <input name="MN" type="number" min="0" max="250" required><br>
<h3>Time-controlled presets</h3>
<div style="display: inline-block">
<table id="TMT">
Expand Down
11 changes: 9 additions & 2 deletions wled00/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

#ifndef WLED_DISABLE_FILESYSTEM

#ifdef ARDUINO_ARCH_ESP32
#include "esp_spiffs.h" //FS info bare IDF function until FS wrapper is available for ESP32
#ifdef ARDUINO_ARCH_ESP32 //FS info bare IDF function until FS wrapper is available for ESP32
#if WLED_FS != LITTLEFS
#include "esp_spiffs.h"
#endif
#endif

#define FS_BUFSIZE 256
Expand Down Expand Up @@ -358,7 +360,12 @@ bool readObjectFromFile(const char* file, const char* key, JsonDocument* dest)

void updateFSInfo() {
#ifdef ARDUINO_ARCH_ESP32
#if WLED_FS == LITTLEFS
fsBytesTotal = LITTLEFS.totalBytes();
fsBytesUsed = LITTLEFS.usedBytes();
#else
esp_spiffs_info(nullptr, &fsBytesTotal, &fsBytesUsed);
#endif
#else
FSInfo fsi;
WLED_FS.info(fsi);
Expand Down
38 changes: 15 additions & 23 deletions wled00/html_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ type="submit">Save</button></form></body></html>)=====";
// Autogenerated from wled00/data/settings_time.htm, do not edit!!
const char PAGE_settings_time[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta name="viewport" content="width=500"><meta
charset="utf-8"><title>Time Settings</title><script>
var d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings")}function B(){window.open("/settings","_self")}function S(){BTa(),GetV(),Cs(),FC()}function gId(t){return d.getElementById(t)}function Cs(){gId("cac").style.display="none",gId("coc").style.display="block",gId("ccc").style.display="none",gId("ca").selected&&(gId("cac").style.display="block"),gId("cc").selected&&(gId("coc").style.display="none",gId("ccc").style.display="block"),gId("cn").selected&&(gId("coc").style.display="none")}function BTa(){var t="<tr><th>Active</th><th>Hour</th><th>Minute</th><th>Macro</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>";for(i=0;i<8;i++)for(t+='<tr><td><input name="W'+i+'" id="W'+i+'" type="number" style="display:none"><input id="W'+i+'0" type="checkbox"></td><td><input name="H'+i+'" type="number" min="0" max="24"></td><td><input name="N'+i+'" type="number" min="0" max="59"></td><td><input name="T'+i+'" type="number" min="0" max="16"></td>',j=1;j<8;j++)t+='<td><input id="W'+i+j+'" type="checkbox"></td>';gId("TMT").innerHTML=t}function FC(){for(j=0;j<8;j++)for(i=0;i<8;i++)gId("W"+i+j).checked=gId("W"+i).value>>j&1}function Wd(){for(a=[0,0,0,0,0,0,0,0],i=0;i<8;i++){for(m=1,j=0;j<8;j++)a[i]+=gId("W"+i+j).checked*m,m*=2;gId("W"+i).value=a[i]}}function GetV() {
var d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings")}function B(){window.open("/settings","_self")}function S(){BTa(),GetV(),Cs(),FC()}function gId(t){return d.getElementById(t)}function Cs(){gId("cac").style.display="none",gId("coc").style.display="block",gId("ccc").style.display="none",gId("ca").selected&&(gId("cac").style.display="block"),gId("cc").selected&&(gId("coc").style.display="none",gId("ccc").style.display="block"),gId("cn").selected&&(gId("coc").style.display="none")}function BTa(){var t="<tr><th>Active</th><th>Hour</th><th>Minute</th><th>Preset</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>";for(i=0;i<8;i++)for(t+='<tr><td><input name="W'+i+'" id="W'+i+'" type="number" style="display:none"><input id="W'+i+'0" type="checkbox"></td><td><input name="H'+i+'" type="number" min="0" max="24"></td><td><input name="N'+i+'" type="number" min="0" max="59"></td><td><input name="T'+i+'" type="number" min="0" max="250"></td>',j=1;j<8;j++)t+='<td><input id="W'+i+j+'" type="checkbox"></td>';gId("TMT").innerHTML=t}function FC(){for(j=0;j<8;j++)for(i=0;i<8;i++)gId("W"+i+j).checked=gId("W"+i).value>>j&1}function Wd(){for(a=[0,0,0,0,0,0,0,0],i=0;i<8;i++){for(m=1,j=0;j<8;j++)a[i]+=gId("W"+i+j).checked*m,m*=2;gId("W"+i).value=a[i]}}function GetV() {
%CSS%%SCSS%</head><body onload="S()"><form
id="form_s" name="Sf" method="post" onsubmit="Wd()"><div class="helpB"><button
type="button" onclick="H()">?</button></div><button type="button" onclick="B()">
Expand Down Expand Up @@ -318,28 +318,20 @@ Year: 20 <input name="CY" type="number" min="0" max="99" required> Month: <input
type="number" min="1" max="31" required><br>Hour: <input name="CH"
type="number" min="0" max="23" required> Minute: <input name="CM" type="number"
min="0" max="59" required> Second: <input name="CS" type="number" min="0"
max="59" required><br><h3>Advanced Macros</h3>Define API macros here:<br>1:
<input name="M1" maxlength="64"><br>2: <input name="M2" maxlength="64"><br>3:
<input name="M3" maxlength="64"><br>4: <input name="M4" maxlength="64"><br>5:
<input name="M5" maxlength="64"><br>6: <input name="M6" maxlength="64"><br>7:
<input name="M7" maxlength="64"><br>8: <input name="M8" maxlength="64"><br>9:
<input name="M9" maxlength="64"><br>10: <input name="M10" maxlength="64"><br>
11: <input name="M11" maxlength="64"><br>12: <input name="M12" maxlength="64">
<br>13: <input name="M13" maxlength="64"><br>14: <input name="M14"
maxlength="64"><br>15: <input name="M15" maxlength="64"><br>16: <input
name="M16" maxlength="64"><br><br><i>
Use 0 for the default action instead of a macro</i><br>Boot Macro: <input
name="MB" type="number" min="0" max="16" required><br>Alexa On/Off Macros:
<input name="A0" type="number" min="0" max="16" required> <input name="A1"
type="number" min="0" max="16" required><br>Button short press macro: Macro:
<input name="MP" type="number" min="0" max="16" required><br>Long Press: <input
name="ML" type="number" min="0" max="16" required> Double press: <input
name="MD" type="number" min="0" max="16" required><br>Countdown-Over Macro:
<input name="MC" type="number" min="0" max="16" required><br>
Timed-Light-Over Macro: <input name="MN" type="number" min="0" max="16"
required><br>Time-Controlled Macros:<br><div style="display:inline-block"><table
id="TMT"></table></div><hr><button type="button" onclick="B()">Back</button>
<button type="submit">Save</button></form></body></html>)=====";
max="59" required><br><h3>Macro presets</h3><b>Macros have moved!</b><br><i>
Presets now also can be used as macros to save both JSON and HTTP API commands.
<br>Just enter the preset id below!</i> <i>
Use 0 for the default action instead of a preset</i><br>Alexa On/Off Preset:
<input name="A0" type="number" min="0" max="250" required> <input name="A1"
type="number" min="0" max="250" required><br>Button short press Preset: Macro:
<input name="MP" type="number" min="0" max="250" required><br>Long Press: <input
name="ML" type="number" min="0" max="250" required> Double press: <input
name="MD" type="number" min="0" max="250" required><br>Countdown-Over Preset:
<input name="MC" type="number" min="0" max="250" required><br>
Timed-Light-Over Presets: <input name="MN" type="number" min="0" max="250"
required><br><h3>Time-controlled presets</h3><div style="display:inline-block">
<table id="TMT"></table></div><hr><button type="button" onclick="B()">Back
</button><button type="submit">Save</button></form></body></html>)=====";
// Autogenerated from wled00/data/settings_sec.htm, do not edit!!
Expand Down
Loading

0 comments on commit 98e4ac6

Please sign in to comment.