Skip to content

Commit

Permalink
Merge branch 'filesystem' into 1m_ota
Browse files Browse the repository at this point in the history
  • Loading branch information
Aircoookie authored Nov 18, 2020
2 parents 77aa2b6 + 5119799 commit 6b942be
Show file tree
Hide file tree
Showing 39 changed files with 4,470 additions and 2,657 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,45 @@

### Development versions after the 0.10.2 release

#### Build 2011154

- Fixed RGBW saved incorrectly
- Fixed pmt caching requesting /presets.json too often
- Fixed deEEP not copying the first segment of EEPROM preset 16

#### Build 2011153

- Fixed an ESP32 end-of-file issue
- Fixed useRGBW not read from cfg.json

#### Build 2011152

- Version bump to 0.11.0p "Mirai"
- Increased max. num of segments to 12 (ESP8266) / 16 (ESP32)
- Up to 250 presets stored in the `presets.json` file in filesystem
- Complete overhaul of the Presets UI tab
- Updated iro.js to v5 (fixes black color wheel)
- Added white temperature slider to color wheel
- Add JSON settings serialization/deserialization to cfg.json and wsec.json
- Added deEEP to convert the EEPROM settings and presets to files
- Playlist support - JSON only for now
- New v2 usermod methods `addToConfig()` and `readFromConfig()` (see EXAMPLE_v2 for doc)
- Added Ethernet support for ESP32 (PR #1316)
- IP addresses are now handled by the `Network` class
- New `esp32_poe` PIO environment
- Use EspAsyncWebserver Aircoookie fork v.2.0.0 (hiding wsec.json)
- Removed `WLED_DISABLE_FILESYSTEM` and `WLED_ENABLE_FS_SERVING` defines as they are now required
- Added pin manager
- UI performance improvements (no drop shadows)
- More explanatory error messages in UI
- Improved candle brightness
- Return remaining nightlight time `nl.rem` in JSON API (PR #1302)
- Added gamma calculation (yet unused)
- Added LED type definitions to const.h (yet unused)
- Added nicer 404 page
- Removed `NP` and `MS=` macro HTTP API commands
- Removed macros from Time settings

#### Build 2011120

- Added the ability for the /api MQTT topic to receive JSON API payloads
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wled",
"version": "0.10.2",
"version": "0.11.0p",
"description": "Tools for WLED project",
"main": "tools/cdata.js",
"directories": {
Expand Down
14 changes: 9 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ build_flags_esp32 = ${common.build_flags} ${esp32.build_flags}

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

Expand Down Expand Up @@ -185,19 +187,20 @@ lib_extra_dirs = ./wled00/src
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
https://github.com/Aircoookie/ESPAsyncWebServer.git@~2.0.0
#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
#U8g2@~2.27.2
#For Dallas sensor uncomment following 2 lines
#OneWire@~2.3.5
#milesburton/DallasTemperature@^3.9.0
#For BME280 sensor uncomment following
#BME280@~3.0.0
lib_ignore =
Expand Down Expand Up @@ -241,7 +244,7 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABL
board = esp01_1m
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m0m}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA

Expand All @@ -261,6 +264,7 @@ upload_speed = 921600
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
monitor_filters = esp8266_exception_decoder

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

[env:travis_esp32]
extends = env:esp32dev
build_type = debug
; build_type = debug
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features}

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

## 💡 Supported light control interfaces
- 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)
- JSON and HTTP request APIs
- MQTT
- Blynk IoT
- E1.31, Art-Net and TPM2.net
- E1.31, Art-Net, DDP and TPM2.net
- [Hyperion](https://github.com/hyperion-project/hyperion.ng)
- UDP realtime
- Alexa voice control (including dimming and color)
Expand Down
8 changes: 8 additions & 0 deletions tools/cdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
method: "plaintext",
filter: "html-minify",
},
{
file: "404.htm",
name: "PAGE_404",
prepend: "=====(",
append: ")=====",
method: "plaintext",
filter: "html-minify",
},
{
file: "favicon.ico",
name: "favicon",
Expand Down
38 changes: 37 additions & 1 deletion usermods/EXAMPLE_v2/usermod_v2_example.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,43 @@ class MyExampleUsermod : public Usermod {
userVar0 = root["user0"] | userVar0; //if "user0" key exists in JSON, update, else keep old value
//if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!"));
}



/*
* addToConfig() can be used to add custom persistent settings to the cfg.json file in the "um" (usermod) object.
* It will be called by WLED when settings are actually saved (for example, LED settings are saved)
* If you want to force saving the current state, use serializeConfig() in your loop().
*
* CAUTION: serializeConfig() will initiate a filesystem write operation.
* It might cause the LEDs to stutter and will cause flash wear if called too often.
* Use it sparingly and always in the loop, never in network callbacks!
*
* addToConfig() will also not yet add your setting to one of the settings pages automatically.
* To make that work you still have to add the setting to the HTML, xml.cpp and set.cpp manually.
*
* I highly recommend checking out the basics of ArduinoJson serialization and deserialization in order to use custom settings!
*/
void addToConfig(JsonObject& root)
{
JsonObject top = root.createNestedObject("exampleUsermod");
top["great"] = userVar0; //save this var persistently whenever settings are saved
}


/*
* readFromConfig() can be used to read back the custom settings you added with addToConfig().
* This is called by WLED when settings are loaded (currently this only happens once immediately after boot)
*
* readFromConfig() is called BEFORE setup(). This means you can use your persistent values in setup() (e.g. pin assignments, buffer sizes),
* 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.
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
*/
void readFromConfig(JsonObject& root)
{
JsonObject top = root["top"];
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)
}


/*
* getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!).
Expand Down
6 changes: 3 additions & 3 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,7 @@ uint16_t WS2812FX::candle(bool multi)

//max. flicker range controlled by intensity
uint8_t valrange = SEGMENT.intensity;
uint8_t rndval = valrange >> 1;
uint8_t rndval = valrange >> 1; //max 127

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

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

uint8_t dif = (s_target > s) ? s_target - s : s - s_target;
Expand Down
6 changes: 4 additions & 2 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,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 Expand Up @@ -456,6 +456,7 @@ class WS2812FX {
setRange(uint16_t i, uint16_t i2, uint32_t col),
setShowCallback(show_callback cb),
setTransitionMode(bool t),
calcGammaTable(float),
trigger(void),
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t grouping = 0, uint8_t spacing = 0),
resetSegments(),
Expand Down Expand Up @@ -489,6 +490,7 @@ class WS2812FX {
//getFirstSelectedSegment(void),
getMainSegmentId(void),
gamma8(uint8_t),
gamma8_cal(uint8_t, float),
get_random_wheel_index(uint8_t);

int8_t
Expand Down
15 changes: 13 additions & 2 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@ void WS2812FX::setRgbwPwm(void) {
void WS2812FX::setRgbwPwm() {}
#endif

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

uint8_t WS2812FX::gamma8_cal(uint8_t b, float gamma) {
return (int)(pow((float)b / 255.0, gamma) * 255 + 0.5);
}

void WS2812FX::calcGammaTable(float gamma)
{
for (uint16_t i = 0; i < 256; i++) {
gammaT[i] = gamma8_cal(i, gamma);
}
}

uint8_t WS2812FX::gamma8(uint8_t b)
{
return gammaT[b];
Expand Down
4 changes: 2 additions & 2 deletions wled00/alexa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void onAlexaChange(EspalexaDevice* dev)
bri = briLast;
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
}
} else applyMacro(macroAlexaOn);
} else applyPreset(macroAlexaOn);
} else if (m == EspalexaDeviceProperty::off)
{
if (!macroAlexaOff)
Expand All @@ -57,7 +57,7 @@ void onAlexaChange(EspalexaDevice* dev)
bri = 0;
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
}
} else applyMacro(macroAlexaOff);
} else applyPreset(macroAlexaOff);
} else if (m == EspalexaDeviceProperty::bri)
{
bri = espalexaDevice->getValue();
Expand Down
6 changes: 3 additions & 3 deletions wled00/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void shortPressAction()
toggleOnOff();
colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
} else {
applyMacro(macroButton);
applyPreset(macroButton);
}
}

Expand Down Expand Up @@ -41,7 +41,7 @@ void handleButton()
{
if (!buttonLongPressed)
{
if (macroLongPress) {applyMacro(macroLongPress);}
if (macroLongPress) {applyPreset(macroLongPress);}
else _setRandomColor(false,true);

buttonLongPressed = true;
Expand All @@ -62,7 +62,7 @@ void handleButton()
else if (!buttonLongPressed) { //short press
if (macroDoublePress)
{
if (doublePress) applyMacro(macroDoublePress);
if (doublePress) applyPreset(macroDoublePress);
else buttonWaitTime = millis();
} else shortPressAction();
}
Expand Down
Loading

0 comments on commit 6b942be

Please sign in to comment.