Skip to content

Commit 6b942be

Browse files
authored
Merge branch 'filesystem' into 1m_ota
2 parents 77aa2b6 + 5119799 commit 6b942be

39 files changed

+4470
-2657
lines changed

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22

33
### Development versions after the 0.10.2 release
44

5+
#### Build 2011154
6+
7+
- Fixed RGBW saved incorrectly
8+
- Fixed pmt caching requesting /presets.json too often
9+
- Fixed deEEP not copying the first segment of EEPROM preset 16
10+
11+
#### Build 2011153
12+
13+
- Fixed an ESP32 end-of-file issue
14+
- Fixed useRGBW not read from cfg.json
15+
16+
#### Build 2011152
17+
18+
- Version bump to 0.11.0p "Mirai"
19+
- Increased max. num of segments to 12 (ESP8266) / 16 (ESP32)
20+
- Up to 250 presets stored in the `presets.json` file in filesystem
21+
- Complete overhaul of the Presets UI tab
22+
- Updated iro.js to v5 (fixes black color wheel)
23+
- Added white temperature slider to color wheel
24+
- Add JSON settings serialization/deserialization to cfg.json and wsec.json
25+
- Added deEEP to convert the EEPROM settings and presets to files
26+
- Playlist support - JSON only for now
27+
- New v2 usermod methods `addToConfig()` and `readFromConfig()` (see EXAMPLE_v2 for doc)
28+
- Added Ethernet support for ESP32 (PR #1316)
29+
- IP addresses are now handled by the `Network` class
30+
- New `esp32_poe` PIO environment
31+
- Use EspAsyncWebserver Aircoookie fork v.2.0.0 (hiding wsec.json)
32+
- Removed `WLED_DISABLE_FILESYSTEM` and `WLED_ENABLE_FS_SERVING` defines as they are now required
33+
- Added pin manager
34+
- UI performance improvements (no drop shadows)
35+
- More explanatory error messages in UI
36+
- Improved candle brightness
37+
- Return remaining nightlight time `nl.rem` in JSON API (PR #1302)
38+
- Added gamma calculation (yet unused)
39+
- Added LED type definitions to const.h (yet unused)
40+
- Added nicer 404 page
41+
- Removed `NP` and `MS=` macro HTTP API commands
42+
- Removed macros from Time settings
43+
544
#### Build 2011120
645

746
- Added the ability for the /api MQTT topic to receive JSON API payloads

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wled",
3-
"version": "0.10.2",
3+
"version": "0.11.0p",
44
"description": "Tools for WLED project",
55
"main": "tools/cdata.js",
66
"directories": {

platformio.ini

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ build_flags_esp32 = ${common.build_flags} ${esp32.build_flags}
138138

139139
ldscript_512k = eagle.flash.512k.ld ;for older versions change this to eagle.flash.512k0.ld
140140
ldscript_1m0m = eagle.flash.1m.ld ;for older versions change this to eagle.flash.1m0.ld
141+
ldscript_1m128k = eagle.flash.1m128.ld
142+
ldscript_2m512k = eagle.flash.2m512.ld
141143
ldscript_2m1m = eagle.flash.2m1m.ld
142144
ldscript_4m1m = eagle.flash.4m1m.ld
143145

@@ -185,19 +187,20 @@ lib_extra_dirs = ./wled00/src
185187
lib_compat_mode = strict
186188
lib_deps =
187189
188-
189-
https://github.com/Makuna/NeoPixelBus
190+
190191
191192
ESPAsyncUDP
192193
193-
https://github.com/Aircoookie/ESPAsyncWebServer
194194
195+
https://github.com/lorol/LITTLEFS.git
196+
https://github.com/Aircoookie/ESPAsyncWebServer.git@~2.0.0
195197
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
196198
#TFT_eSPI
197199
#For use SSD1306 OLED display uncomment following
198200
#U8g2@~2.27.2
199201
#For Dallas sensor uncomment following 2 lines
200202
#OneWire@~2.3.5
203+
#milesburton/DallasTemperature@^3.9.0
201204
#For BME280 sensor uncomment following
202205
#BME280@~3.0.0
203206
lib_ignore =
@@ -241,7 +244,7 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABL
241244
board = esp01_1m
242245
platform = ${common.platform_wled_default}
243246
platform_packages = ${common.platform_packages}
244-
board_build.ldscript = ${common.ldscript_1m0m}
247+
board_build.ldscript = ${common.ldscript_1m128k}
245248
build_unflags = ${common.build_unflags}
246249
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
247250

@@ -261,6 +264,7 @@ upload_speed = 921600
261264
board_build.ldscript = ${common.ldscript_4m1m}
262265
build_unflags = ${common.build_unflags}
263266
build_flags = ${common.build_flags_esp8266}
267+
monitor_filters = esp8266_exception_decoder
264268

265269
[env:heltec_wifi_kit_8]
266270
board = d1_mini
@@ -455,7 +459,7 @@ build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build
455459

456460
[env:travis_esp32]
457461
extends = env:esp32dev
458-
build_type = debug
462+
; build_type = debug
459463
build_unflags = ${common.build_unflags}
460464
build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features}
461465

readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control
2222
- Settings page - configuration over network
2323
- Access Point and station mode - automatic failsafe AP
2424
- Support for RGBW strips
25-
- 16 user presets to save and load colors/effects easily, supports cycling through them.
26-
- Macro functions to automatically execute API calls
25+
- Up to 250 user presets to save and load colors/effects easily, supports cycling through them.
26+
- Presets can be used to automatically execute API calls
2727
- Nightlight function (gradually dims down)
2828
- Full OTA software updatability (HTTP + ArduinoOTA), password protectable
2929
- Configurable analog clock + support for the Cronixie kit by Diamex
3030
- Configurable Auto Brightness limit for safer operation
31+
- Filesystem-based config for easier backup of presets and settings
3132

3233
## 💡 Supported light control interfaces
3334
- WLED app for [Android](https://play.google.com/store/apps/details?id=com.aircoookie.WLED) and [iOS](https://apps.apple.com/us/app/wled/id1475695033)
3435
- JSON and HTTP request APIs
3536
- MQTT
3637
- Blynk IoT
37-
- E1.31, Art-Net and TPM2.net
38+
- E1.31, Art-Net, DDP and TPM2.net
3839
- [Hyperion](https://github.com/hyperion-project/hyperion.ng)
3940
- UDP realtime
4041
- Alexa voice control (including dimming and color)

tools/cdata.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,14 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
386386
method: "plaintext",
387387
filter: "html-minify",
388388
},
389+
{
390+
file: "404.htm",
391+
name: "PAGE_404",
392+
prepend: "=====(",
393+
append: ")=====",
394+
method: "plaintext",
395+
filter: "html-minify",
396+
},
389397
{
390398
file: "favicon.ico",
391399
name: "favicon",

usermods/EXAMPLE_v2/usermod_v2_example.h

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,43 @@ class MyExampleUsermod : public Usermod {
103103
userVar0 = root["user0"] | userVar0; //if "user0" key exists in JSON, update, else keep old value
104104
//if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!"));
105105
}
106-
106+
107+
108+
/*
109+
* addToConfig() can be used to add custom persistent settings to the cfg.json file in the "um" (usermod) object.
110+
* It will be called by WLED when settings are actually saved (for example, LED settings are saved)
111+
* If you want to force saving the current state, use serializeConfig() in your loop().
112+
*
113+
* CAUTION: serializeConfig() will initiate a filesystem write operation.
114+
* It might cause the LEDs to stutter and will cause flash wear if called too often.
115+
* Use it sparingly and always in the loop, never in network callbacks!
116+
*
117+
* addToConfig() will also not yet add your setting to one of the settings pages automatically.
118+
* To make that work you still have to add the setting to the HTML, xml.cpp and set.cpp manually.
119+
*
120+
* I highly recommend checking out the basics of ArduinoJson serialization and deserialization in order to use custom settings!
121+
*/
122+
void addToConfig(JsonObject& root)
123+
{
124+
JsonObject top = root.createNestedObject("exampleUsermod");
125+
top["great"] = userVar0; //save this var persistently whenever settings are saved
126+
}
127+
128+
129+
/*
130+
* readFromConfig() can be used to read back the custom settings you added with addToConfig().
131+
* This is called by WLED when settings are loaded (currently this only happens once immediately after boot)
132+
*
133+
* readFromConfig() is called BEFORE setup(). This means you can use your persistent values in setup() (e.g. pin assignments, buffer sizes),
134+
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
135+
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
136+
*/
137+
void readFromConfig(JsonObject& root)
138+
{
139+
JsonObject top = root["top"];
140+
userVar0 = top["great"] | 42; //The value right of the pipe "|" is the default value in case your setting was not present in cfg.json (e.g. first boot)
141+
}
142+
107143

108144
/*
109145
* getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!).

wled00/FX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,7 +2726,7 @@ uint16_t WS2812FX::candle(bool multi)
27262726

27272727
//max. flicker range controlled by intensity
27282728
uint8_t valrange = SEGMENT.intensity;
2729-
uint8_t rndval = valrange >> 1;
2729+
uint8_t rndval = valrange >> 1; //max 127
27302730

27312731
//step (how much to move closer to target per frame) coarsely set by speed
27322732
uint8_t speedFactor = 4;
@@ -2763,9 +2763,9 @@ uint16_t WS2812FX::candle(bool multi)
27632763
}
27642764

27652765
if (newTarget) {
2766-
s_target = random8(rndval) + random8(rndval);
2766+
s_target = random8(rndval) + random8(rndval); //between 0 and rndval*2 -2 = 252
27672767
if (s_target < (rndval >> 1)) s_target = (rndval >> 1) + random8(rndval);
2768-
uint8_t offset = (255 - valrange) >> 1;
2768+
uint8_t offset = (255 - valrange);
27692769
s_target += offset;
27702770

27712771
uint8_t dif = (s_target > s) ? s_target - s : s - s_target;

wled00/FX.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
/* each segment uses 52 bytes of SRAM memory, so if you're application fails because of
5555
insufficient memory, decreasing MAX_NUM_SEGMENTS may help */
5656
#ifdef ESP8266
57-
#define MAX_NUM_SEGMENTS 10
57+
#define MAX_NUM_SEGMENTS 12
5858
#else
59-
#define MAX_NUM_SEGMENTS 10
59+
#define MAX_NUM_SEGMENTS 16
6060
#endif
6161

6262
/* How much data bytes all segments combined may allocate */
@@ -456,6 +456,7 @@ class WS2812FX {
456456
setRange(uint16_t i, uint16_t i2, uint32_t col),
457457
setShowCallback(show_callback cb),
458458
setTransitionMode(bool t),
459+
calcGammaTable(float),
459460
trigger(void),
460461
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t grouping = 0, uint8_t spacing = 0),
461462
resetSegments(),
@@ -489,6 +490,7 @@ class WS2812FX {
489490
//getFirstSelectedSegment(void),
490491
getMainSegmentId(void),
491492
gamma8(uint8_t),
493+
gamma8_cal(uint8_t, float),
492494
get_random_wheel_index(uint8_t);
493495

494496
int8_t

wled00/FX_fcn.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,8 @@ void WS2812FX::setRgbwPwm(void) {
965965
void WS2812FX::setRgbwPwm() {}
966966
#endif
967967

968-
//gamma 2.4 lookup table used for color correction
969-
const byte gammaT[] = {
968+
//gamma 2.8 lookup table used for color correction
969+
byte gammaT[] = {
970970
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
971971
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
972972
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
@@ -984,6 +984,17 @@ const byte gammaT[] = {
984984
177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
985985
215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };
986986

987+
uint8_t WS2812FX::gamma8_cal(uint8_t b, float gamma) {
988+
return (int)(pow((float)b / 255.0, gamma) * 255 + 0.5);
989+
}
990+
991+
void WS2812FX::calcGammaTable(float gamma)
992+
{
993+
for (uint16_t i = 0; i < 256; i++) {
994+
gammaT[i] = gamma8_cal(i, gamma);
995+
}
996+
}
997+
987998
uint8_t WS2812FX::gamma8(uint8_t b)
988999
{
9891000
return gammaT[b];

wled00/alexa.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void onAlexaChange(EspalexaDevice* dev)
4646
bri = briLast;
4747
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
4848
}
49-
} else applyMacro(macroAlexaOn);
49+
} else applyPreset(macroAlexaOn);
5050
} else if (m == EspalexaDeviceProperty::off)
5151
{
5252
if (!macroAlexaOff)
@@ -57,7 +57,7 @@ void onAlexaChange(EspalexaDevice* dev)
5757
bri = 0;
5858
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
5959
}
60-
} else applyMacro(macroAlexaOff);
60+
} else applyPreset(macroAlexaOff);
6161
} else if (m == EspalexaDeviceProperty::bri)
6262
{
6363
bri = espalexaDevice->getValue();

0 commit comments

Comments
 (0)