Compare commits

..

1088 Commits

Author SHA1 Message Date
Damian Schneider
353868414a
Removed PS memory manager and some minor improvements (#4651)
* Removed memory manager from PS

- reverted all changes related to memory manager
- moved local buffer into effect data memory
- some RAM issues may occur on larger setups: tested on S3 it works fine up to 32x32 but runs into memory issues at 64x32

* fixed ifdef, improved readability, add optimize "o2" flags to improve speed

- added struct for x and y coordinates, thx to @blazoncek

* cleanup and minor improvements

- removed local buffer for ESP8266 in 1D system to save on RAM
- increased particle brightness in PS Impact
- minor tweak in collision binning (might improve speed)
- removed comments and some other unused stuff
- fixed a few compiler wranings

* fixed init sequence bug
2025-04-20 11:38:32 +02:00
Blaž Kristan
c661d8f5b7
Merge pull request #4627 from blazoncek/overlay-fix
Allow clock overlay to use LED beyond 255
2025-04-20 11:05:35 +02:00
Damian Schneider
02f14baad4
Updates to particle system (#4630)
* added Sonic Boom AR FX, some tweaks to Sonic Stream
* added white color option to Sonic Stream
* improvements to collisions (speed look-ahead)
* code prettified
* added "playful" mode to PS Chase plus some minor speed optimizations
* Adding new FX: PS Springy with many config options
2025-04-15 19:07:21 +02:00
netmindz
e979c58c98
Merge pull request #4609 from willmmiles/usermod-cfg-live
Use live cfg json instead of file for usermod settings page
2025-04-06 09:28:45 +00:00
Blaž Kristan
b941654a68 Allow clock overlay to use LED beyond 255 2025-03-29 23:39:47 +01:00
Will Miles
b0b3196e52
Merge pull request #4620 from gsieben/USERMOD-BME68X-Update-to-Version-1.0.2
Update USERMOD BME68X to version 1.0.2
2025-03-29 11:09:17 -04:00
Gabriel Sieben
7e87891701 Update USERMOD BME68X to version 1.0.2 2025-03-28 16:27:26 +01:00
Damian Schneider
e76e9a3e1f
Merge pull request #4594 from DedeHai/perlin_noise
Adding perlin noise replacement for fastled functions
2025-03-26 07:40:40 +01:00
Will Miles
36cb1cad36 settings_um: Use live config
Use json/cfg for the usermod settings page.  Should fix issues
with outdated content when a new firmware is loaded.
2025-03-23 15:20:16 -04:00
Will Miles
22e2b6f3c5 Have json/cfg return live config
Rather than reading the file off disk, have the json/cfg endpoint
return the live config from system state data.  This can improve
UI behaviour as it can never be out of date or include values that
do not apply to the current firmware install.
2025-03-23 15:18:08 -04:00
Will Miles
9c8f8c645e Rename 'doSerializeConfig' to 'configNeedsWrite'
Clarify the name and usage of this flag, as the function name has
changed out from underneath it.
2025-03-23 15:16:52 -04:00
Will Miles
e21a09cec9 Separate FS write from serializeConfig
Break the actual JSON assembly apart from the file writing code.  This
permits calling it in other contexts, allowing us to pull the live
config data even if the filesystem is out of date.
2025-03-23 15:15:52 -04:00
Will Miles
a0d1a8cbc4 Use enum class for json endpoint subtypes
Part of the ongoing quest to migrate macro definitions to typed
language constructs.  This actually yields a small improvement in
code size, likely from the byte->int conversion.
2025-03-23 15:08:12 -04:00
Blaž Kristan
86393e0b1d
Merge pull request #4608 from marcone/patch-2
Fix typo
2025-03-23 19:29:18 +01:00
marcone
f328713710
Fix typo 2025-03-23 11:11:34 -07:00
netmindz
ed6efe4c9e
Merge pull request #4551 from Brandon502/PinwheelRework
Pinwheel Rework
2025-03-23 09:29:54 +00:00
netmindz
befff2f034
Merge pull request #4605 from marcone/patch-1
Fix typo in build.yml
2025-03-22 17:55:15 +00:00
marcone
630315180d
Fix typo in build.yml 2025-03-22 10:28:38 -07:00
Blaž Kristan
a70bfa0c89 Merge pull request #4596 from Dschogo/patch-1
Fix wipe effect smoothness
2025-03-16 10:58:02 +01:00
Damian Schneider
d2b7e474d6 add legacy defines for compatibility, reverted test changes in rotozoomer 2025-03-14 06:48:18 +01:00
Damian Schneider
494b72c287 Merge remote-tracking branch 'upstream/main' into perlin_noise 2025-03-12 20:15:40 +01:00
Damian Schneider
229e7b940f added ranges, removed unused code 2025-03-12 19:58:32 +01:00
Damian Schneider
95dcb03f6d updated scaling 2025-03-12 06:56:33 +01:00
netmindz
a6d9a8220c
Merge pull request #4480 from willmmiles/usermod-libs
Convert usermods to static libraries
2025-03-11 22:37:36 +00:00
Will Tatam
0ba80ce61e Merge branch 'main' into usermod-libs 2025-03-11 22:31:52 +00:00
Will Tatam
7c23872e03 Add dmxInput.isConnected() 2025-03-11 22:31:19 +00:00
netmindz
507938be35
Update pr-merge.yaml - shell bash 2025-03-11 22:28:21 +00:00
netmindz
8bee304e4d
Merge pull request #4577 from DevJogger/main
Add apple-touch-icon Link Tag
2025-03-11 22:19:38 +00:00
netmindz
be239993f4
Update pr-merge.yaml 2025-03-11 22:15:48 +00:00
netmindz
f396dac1cc
Merge pull request #4266 from w00000dy/cdata
Migrate from inliner to web-resource-inliner
2025-03-11 22:14:03 +00:00
netmindz
ebba1f78ab
update secrets syntax for pr-merge action 2025-03-11 22:05:32 +00:00
netmindz
c8c3fc2bcc
Merge pull request #4591 from srg74/patch-4
Update README.md
2025-03-11 20:59:34 +00:00
srg74
14c6c05e00
Update README.md
Added record to change log according to latest update from @blazoncek
2025-03-11 16:24:55 -04:00
netmindz
3fbdd9635f
Merge pull request #4568 from blazoncek/multifix
Multifix
2025-03-11 08:34:23 +00:00
Blaž Kristan
d7be9c9a66 Address issues reported 2025-03-10 07:12:45 +01:00
Blaž Kristan
928c9fbacd Bugfix for #4590 2025-03-09 15:06:20 +01:00
Blaž Kristan
2b666ab9f7 Merge branch 'master' into multifix 2025-03-08 12:59:15 +01:00
Damian Schneider
4ecc531998 updated scaling, improved hashing, updated rotozoomer to not use a buffer 2025-03-08 12:48:27 +01:00
Blaž Kristan
b908384ba2
Merge pull request #4307 from blazoncek/compile-pin
Compile time lock PIN definition
2025-03-08 12:44:10 +01:00
Blaž Kristan
b27a4a94e4
Merge pull request #4529 from blazoncek/unlimited-bus
"Unlimited" buses
2025-03-08 12:43:25 +01:00
Damian Schneider
5e8073022b 3D works but needs finetuning to match old looks 2025-03-07 06:39:49 +01:00
Damian Schneider
9553425374 some speed improvements using better hash, scaling is still off...
needs a proper scaling analysis of all steps in all resolutions to minimize errors.
2025-03-04 07:55:41 +01:00
Damian Schneider
2012317bc9 initial version, basically working but repetitive patterns, work in progress 2025-03-03 06:57:16 +01:00
Will Miles
18a118bb7a Update platformio version
There is a necessary LDF fix in 6.1.17.
2025-03-01 20:53:43 +00:00
Will Miles
e00789f838 Merge remote-tracking branch 'upstream/main' into usermod-libs 2025-03-01 20:32:12 +00:00
Will Miles
20563e6306 usermod/Temperature: Update doc 2025-03-01 20:29:59 +00:00
Will Miles
580c2d8213 usermods/MY9291: Enable for ESP8266 2025-03-01 20:29:37 +00:00
DevJogger
c9b8789ea9 Reduce apple-touch-icon image size 2025-02-28 18:47:32 +00:00
Blaž Kristan
4271588ecd unique_ptr fix 2025-02-25 16:06:13 +01:00
Blaž Kristan
a5277ff4a0 Merge fix 2025-02-25 16:01:30 +01:00
Blaž Kristan
a66f5d660d Merge branch 'main' into unlimited-bus 2025-02-25 13:54:42 +01:00
Brandon502
80061e8d76 Pinwheel: Use sin/cos16_t 2025-02-24 21:51:49 -05:00
DevJogger
d07a057f04 Add an apple touch icon for better recognition on the home screen of Apple devices 2025-02-25 01:13:22 +00:00
netmindz
fa2949af7d
use npm ci 2025-02-22 17:39:00 +00:00
netmindz
a4680b7216
Update nightly.yml 2025-02-22 17:27:28 +00:00
netmindz
523eb910a6
Update nightly.yml 2025-02-22 16:43:09 +00:00
netmindz
2f21de79f7
Create test.yaml 2025-02-22 16:41:29 +00:00
netmindz
092d402ff8
Update nightly.yml 2025-02-22 16:38:18 +00:00
netmindz
12e8d6c4c6
Update nightly.yml 2025-02-22 15:20:23 +00:00
netmindz
8c1486d577
Update nightly.yml 2025-02-22 15:13:37 +00:00
netmindz
57e9199baa
Enable dispatch with PAT 2025-02-22 15:02:45 +00:00
netmindz
f4aac0bd8d
use onlyLastTag rather than hard coded lastTag 2025-02-22 14:49:01 +00:00
netmindz
664150811a
Generate changelog 2025-02-22 12:00:16 +00:00
netmindz
3cb4ae16ab
Create pr-merge.yaml 2025-02-22 10:21:19 +00:00
Damian Schneider
73fc9ea54d
Merge pull request #4543 from DedeHai/soap-FX-optimization
Soap FX optimization
2025-02-22 08:43:01 +01:00
Blaž Kristan
dd80919ed6
Merge pull request #4429 from blazoncek/use-bssid
Add ability to enter desired BSSID
2025-02-19 13:46:49 +01:00
Blaž Kristan
d7103cd75c
Merge pull request #4262 from blazoncek/large-ledmap
Large ledmap support
2025-02-19 13:43:52 +01:00
Blaž Kristan
29beee367c Cherry-pick fix 2025-02-19 12:27:10 +01:00
Blaž Kristan
d22fe9227b Prevent push transition if effect stays the same 2025-02-19 11:56:37 +01:00
Blaž Kristan
6ea9535463 Avoid shadowing global col[] 2025-02-19 11:54:03 +01:00
Blaž Kristan
bbd1b730b1 Add simulation modes (bugfix) 2025-02-19 11:52:58 +01:00
Blaž Kristan
6e138e4f79 Clarify use of index counter 2025-02-19 11:52:14 +01:00
Blaž Kristan
d6453bb53d Use constant CALL_MODE_INIT 2025-02-19 11:47:55 +01:00
Blaž Kristan
9bfd34e6b2 Rework color_from_palette()
- respect paletteBlend
- bugfix in ColorFromPaletteWLED()
2025-02-19 11:47:13 +01:00
Blaž Kristan
7b13771cfe Bugfix in settings 2025-02-19 11:42:00 +01:00
Blaž Kristan
b70b222f80 Replace magic with cosntant 2025-02-19 11:39:48 +01:00
Blaž Kristan
2ffc8dd228 W Hex entry bugfix & optiisation 2025-02-19 11:36:48 +01:00
Blaž Kristan
08d12f9ee6 Shifting bugfix & size tuning in fade_out 2025-02-19 11:35:51 +01:00
Blaž Kristan
7ce96c190f Manual advance playlist 2025-02-19 11:34:29 +01:00
Blaž Kristan
409b4b1963 Clear spaced segment
- also wait for strip before updating segment
2025-02-19 11:32:21 +01:00
Blaž Kristan
05cd7d753e Bugfix for color_blend 2025-02-19 11:26:51 +01:00
Blaž Kristan
7be460e8b1 Incorrect limit fix 2025-02-19 11:23:23 +01:00
Blaž Kristan
6dfbd07e86 retrun value fix 2025-02-19 11:21:17 +01:00
Blaž Kristan
7b56e53c47 Nested playlist 2025-02-19 11:19:59 +01:00
Blaž Kristan
a8cde3289a Minor speed & size tweaks
- new function fadeToSecondaryBy()
2025-02-19 11:13:52 +01:00
Blaž Kristan
f4e7202dd0 UI info 2025-02-19 11:12:12 +01:00
Damian Schneider
a2de3d33bf
intermediate fix for transition speedup (#4562)
- fixes FX speedup in fade transitions but its not a proper solution
2025-02-17 19:32:43 +01:00
Damian Schneider
46a3e3d353
Adding Particle System with many new FX (#4506)
* cleanup

* added collision handling back in

update from another commit that got lost

* reformat

* added latest version of functions

this somehow also got lost from an earlier commit

* Update platformio.ini

* updated particle box and firework effects

particle box now is more random in random mode (still a work in progress)
firework is now more configurable by sliders

* added preliminary functions and FX

* added particle attractor, added two new FX but still buggy

particle attractor animation does not work, somthing wrong with pointer allocation, it worked with static variables

* bugfixes, attracot now works

still unknown, why more than 256 particles are needed in memory allocation to not make it crash, but it works for now

* added angle emitter, added fireworks effect using it

* Added saturation to be set for each particle individually

at the expense of more ram usage, animations now have more options for color control (already used in fireworks now)

* bugfixes in impact animation

* added option to use fast color add, may improve performance a little

also fixed a bug in fire animation

* collision detection is now a function plus some improvements & fixes

* improved collision efficiency

improved efficiency for stackup (pushback), added code to correctly determine direction if particles meed (probably overkill but now its there)

* added fix for piling oscillations

untested, need to verify it works

* Improved collision handling (faster, less oscillations), changed variables to 32bit for faster calculation

32bit variables are faster on ESP32, so use them whenever a variable is used a lot, it saves one instruction per access.

* removed option for fastcolor add

it made very little difference in performance, but for ESP8266 it may matter so it is set permanently there. graphically the difference is also very small (sometimes a particle gets brighter or less saturated)

* Fixed some bugs in particle system, runs much smoother now

also tweaked some of the FX

* Bugfix in particle push, now piling is working again

particle pile-up did not work correctly, now fixed

* changed particle pile demo into waterfall plus some tweaks

* lots of bugfixes

* updated particle attractor animation parameters and added more user options to perlin noise

* removed TODOs

* added particle WrapUpdate function, added spray FX, some bugfixes

* fixed touch buttons for ESP32 S2 and S3

touch is implemented differently on S2 and S3, these changes make touch buttons work on S2 and S3

* some tuning for touch buttons on S2/S3

now better fits the default threshold value of 32

* updated rotating particle spray with more user options

* chaned rotating spray default parameters

* add todo

* Revert "some tuning for touch buttons on S2/S3"

This reverts commit d21ad8e7d1651a96f879d43ef1146a72a6ed8271.

* Revert "fixed touch buttons for ESP32 S2 and S3"

This reverts commit 09041551862361cd8c7444ca25403f5f96a9077b.

* removed comments, added comments

* cleanup

-removed wrap_update function, now integrated into move_update
-added more 'out of bounds' checking in fire functions, may speed it up a little

* cleanup session

-removed particle box 'rocking boat' (buggy) and replaced with random sloshing.
-removed comments
-changed some variables into 32bit for speed boost on ESP32
-added link to KB at the top of FX.cpp

* cleanup

removed / added comments

* added particle GEQ effect (untested)

* Particle GEQ fixes, it now actually works

* GEQ  FX parameter tuning

* added rotating GEQ, work in progress

-animation works but sliders are too sensitive. need to adjust the ranges

* FX update

- changed firework exhaust to low saturation
- updated rotating particle spray animation

* Cleanup & Bugfixes plus major improvements for ESP8266

-added particle reductions for ESP8266 for all FX
-Removed collisions from Particle Perlin Noise FX, slows things down and does not contribute to a better effect experience
-lots of optimizations for ESP8266, all FX now work (at least on 160MHz but still slow)
-Some bugfixes
-removed unused variables to make compiler happy

* Particle FX Rename, default parameter tuning, bugfix

-Now shorter names, 'PS' in front to filter the list
-Tuned default parameters to make them look better by default
-Bugfix in particle system (removed duplicate application of velocity)
-reduced PS fire RAM usage (less particles, less base flames, no noticeable difference)
-some variable renaming

* slight speed improvements in fire, like 1-2FPS

* Big update: lots of little fixes and big speed boost on fire animation

-fixed fire burning more on the left side
-fixed crash in particle attractor
-added many improvements for ESP8266
-improved particle rendering efficiency
-efficiency improvements in general
-changed the way fire is rendered, now more than 2x faster
-re-tuned fire to new rendering, also seperately tuned it for ESP8266
-changed all random8() to random16() as it runs faster on ESPs
-some reformating
-some renaming of effect stuff
-fine tuning on falling particle effect
-improvements to collision handling (faster and better)
-added a (temporary) function for speed tests, will be removed again

* bugfix

* updated PS Fireworks with many changes and fine-tuning of parameters

-removed spiral explosions
-added more versatility to circular explosions
-removed user selectable amount of rockets
-tuned explosion size of circular explosions to match random explosions (more or less, may need improvement)
-changed order of sliders in volcano animation

* put particle system in a class. work in progress.

another huge update to the particle system.
went through the whole code, rewrote many of the functions. many improvements over the previous code. fixed many bugs (and even an ancient one in rendering function). spent many hours optimizing the code for speed and usability.
still a work in progress, debugging is ongoing. more updates to come.

* many (many!) bugfixes, added fire FX back in (and improved it a lot) added local renderbuffer for huge speed boost

-lots of bugfixes in Particle system
-added local rendering buffer (renders to buffer in heap)
-added fast and accurate color-add function
-bugfixes in render function
-added improved 'sticky' particles in collision (unfinished business)
-added ballpit animation back
-lots of tweaks to fire FX and fire rendering functions, looks even better now (still unfinished)
-added palette render option to fire

still many debug print outputs around, needs cleanup at one point

* More Bugfixes, more converted FX

* more bugfixes, some animation tuning, added volcano back in

- fixed animation transitions with proper pointer setting in each FX call
- added color by age setting to particle system
- maybe fixed collision having a tendency to go to the left
- fixed bugs in fireworks FX
- added fire spread width as a slider
- changed max number of particles and sprays based on some ram calculations
- some other random fixes

* updated fire, added some functions to PS, ported attractor FX

- added turbulance to fire (after hours of fine-tuning) it now looks even more awesome
- added attractor animation back in and improved it with more functionality
- fixed the attractor function in the PS
- renamed FX: 'candy' is now called 'vortex'
- added new force function to apply a force immediately (and handle the timing in the FX)
- added update function to PS for size update to handle dynamic segment size change
- made waterfall width dynamic on segment width
- removed some debug stuff
- added #defines for maximum number of particles/sprays
- updated fire parameter to make it look better on ESP8266
- some little bugfixes

* another huge update, many improvements, fine-tune collision, fire and some other FX

-removed classic fire render as palette now looks much better
-tweaked fire parameters to more awesome
-added (optional) turbulence to fire using perlin-noise
-ported spray FX to use PS-class
-now definitely fixed asymmetrical collision issue: do not use bitshifts on negative numbers!
-changed piling behaviour of particles, full rework. looks way more natural now and works much better
-changed bouncing behavour: they now bounce at full diameter, making them stay fully in frame when laying on the floor
-replaced all relevant bitshifts with divisions for higher accuracy throughout the PS
-added new modes to particle box FX
-changed a lot of FX parameters (finetuning)
-changed all config strings to proper settings (matrix only)
-fixed newly introduced bugs
-added speedup/slowdown to vortex FX (aka candy, aka rotating sprays)
-some renaming
-fixed bugs… lots of bugs
-merged rendering functions, removed obsolete stuff

* Fixed Speed limit

limiting speed was incorrect, leading to overflows. fixed this.
also fixed bugs in GEQ, removed some debug stuff, added FPS limit to fire (just en experiment)

* work in progress, added motion blur and line attracto (non working)

* work in progress, added test function to increase particle size, also added wobbling test

* added more tests, non compiling at the moment

* in the middle of fixing FX to use new PS functions

* debugging going on

* bugfix in wrap function and firwork FX

* added local render blurring, boosting FPS, work in progress

- changed fast-add function to use pointers
- added fast-scaling function
- added simple (but fast) 2D blurring function
test shows that local blurring of full frame is almost double the speed (40FPS now is 80FPS).
lots of comments still there

* Bugfixes, improvements and added wall roughness setting

- fixed bug in PS fuzzy noise which made it asymmetric for some reason, seems to work better now
- added particle size option to attractor but had to remove speed setting (now fixed emit speed)
- some parameter tuning of FX
- improvements to code size in render function
- added smear option to blurring (not tested much, may be buggy without smear)
- speed improvement to caldForce_dv, added zero checking.

* removed zero inits

- removed zero initialisations in FX, segment.data is set to zero by alloc function

* added individual size particle rendering plus some fixes

- advanced particles can now be rendered to individual sizes. It is computationally intensive but it works well for up to 15 very large particles and more smaller ones
- added collision handling for individual sizes (walls and collisions)
- fixed bugs in particlebox
- fixed fire not transitioning properly (flickering) when frame skip is active
- removed 'wraparound' function as it can easily be done by casting to an unsigned and then modulo
- fixed ballpit particles wandering left and right very fast if wrapX is set

* Fixed some nasty memory bugs, fixed some FX parameters

- fixed memory alignment bug in PS pointer assignment by making sure only multiples of 4 are allowed for particles and sources
- added saturation back to particle struct, as it was aligned to 10 bytes anyway.
- fixed a bug where a null pointer could be accessed
- fixed rendering out of frame particles if buffer allocation failed
- improvements on ESP8266

* Replaced Ghost Rider FX with PS version

- new FX is kept close to original animation but added more user settings

* added walls to ghostride, fixed some bugs

* added 'perpetual' flag to particles

* Fixed another memory / pointer bug, but there is still one left...

-also some minor fixes

* Found and fixed crashes, it was wrongly assigned pointers

* Added advanced particle size control and new Blob FX

- advanced size control allows for growing, shrinking, wobbling
- render function updated to support asymmetric rendering
- various code improvements and bugfixes
- some FX parameter tuning
- bugfix: removed sli() sei() calls in render function that caused random flickering on S3/C3 (may add that back in but only for ESP8266 to reduce fragmentation)
- removed some debug / test stuff

* code cleanup, removed some unused stuff

* bugfix, sprayEmit() would not return and get stuck

- forgot default return value...

* remove esp_random() as it is not supported on ESP8266

* small bugfix for ESP32, cleanup / reformatting

* added WLED_DISABLE_PARTICLESYSTEM option, fixed volcano movement

use '-D WLED_DISABLE_PARTICLESYSTEM' to disable compiling

* a line got lost in the last commit

* - added WLED_DISABLE_PARTICLESYSTEM option & cleanup & bugfixes

- cleanup / reformatting
- fixed volcano movement
- small bugfix for ESP32 (random() does not work, using random16() )

* Added PS source option to emit more than one particle, addes AR to Blobs and Spray

* added center GEQ back in, changed AR behaviour of spray a little

center GEQ is a mix between the PS equalizer and vortex, tuned for AR. some more tuning may be needed, it can probably be extended and improved a little.

* Bugfix and minor improvements

- fixed bug in center GEQ
- added '2D washing machine' mode for particle box
- improved color-change rate in ghostrider
- added AR to attractor (experimental, may remove again)

* hacked in a 1D port of the 2D PS, untested code

* fixed first bugs in 1D system, added test FX

* fixed bug in wrapping (also was wrong for 2D system)

* fixed collisions, added bouncing ball replacement (work in progress)

* replaced more FX, some tweaks to 1D PS

- changed virtual particle size from 64 to 32, making them able to move faster
- added 'rolling balls' option to bouncing balls (i.e. no gravity plus some tweaks)
- added dancing shadows with PS (work in progress)
- temporarily removed native FX: bouncing balls, rolling balls, popcorn, dancing shadows
-and of course some bugfixes

* updated dancing shadows to more closely mimic original

* added drip FX, added #ifdefs, removed some common functions

#ifdefs to individually disable 1D and 2D system.

* fixed compile issue, removed replaced FX (again)

* added Fireworks1D replacement (unfinished)

also fixed a bug in `applyForce()` using uninitialized variable.

* added sparkler and hourglass (both work in progress) tried fixing 1D collisions

* many improvements in 1D collisions (fine tuned), hour glass FX is almost done

spent A LOT of time in fine-tuning collisions for best stacking without collipsing, ringing, oscillations or particle flips. still not perfect but probably as good as it can be with the limited time-resolution

* many bugfixes in PS and FX

* minor FX adjustments

* Improved 1D collisions, added 2 new 1D FX (work in progress)

* bugfixes

* added 'color by position' as a PS setting

 -made settings struct for 1D and 2D version to be different
 -added setting 'color by position' as that is used by multiple FX now

* added large size rendering to 1D PS, work in progress

* bugfix (forgot to free memory)

also: made random size a permanent option in 1D fireworks as it looks kind of cool

* Added PS based Chase, fixed some bugs

* minor update

* two new FX: Starburst and 1D GEQ

* Added more advanced (and proper) size handling in collisions, work in progress

 - copied and adapted some stuff from 2D system (out of bounds size rendering, dynamic collision detection distance, dynamic wall bounce distance)

* fixed some parameters in 1D FX

* added #ifndef to disable FX replaced by PS

- define DISABLE_1D_PS_REPLACEMENTS or DISABLE_2D_PS_REPLACEMENTS

* bugfixes

* default parameter change

* explicit cast to fix compile error

* Bugfixes

* added color-waves to PS chase, some parameter tuning plus bugfixes

* FX update and bugfixes

- fixed wall collisions on larger particle sizes
- update to bouncing balls:
 - added size setting
 - added proper updating on parameter change
 - bugfixes
added support for 'colorwaves' and 'pride' to PS Chase to save on code size. currently broken...

* minor update to rolling balls, fixed stuff in Chase, pride option still not working

* update on 'pride' now working again but needs finetuning

* SEGMENT -> SEGENV on data, aux0, aux1, step

also removed debug outputs

* added pride and colorwaves to 1D replacement list

* removed unused variables

* added variable to set number of particles if not all are required (saves ram) also fixed a nasty render bug

* added preliminary 1D fire function, unfinished

* added fractal FX test, fixed bugs in emit function

* tweaked 1D fire a little, still work in progress

* minor tuning on 1D fire to avoid 'oscillation' at start

* improved 1D particle fire, much more natural now.

* updated 2D fire, fixed init bug

- source init was wrong making fire init weirdly
- changed parameters on 2D fire making it look better and improving flame height for larger setups

* fixed 'nervours' fire

* slight improvements and some cleanup

* removed douplicate code for fire emit (tradeoff for some speed), removed unfinished fractal FX

- with the duplicate code removed, the fire particle emits are a bit slower but it saves on code. it is not really noticeable, its slower by about 1FPS

* Re-license from MIT to EUPL

* Started cleanup, speed improvement to rendering, renamed class

- removed 'smar' parameter in blur functions as smear is always used
- improved particle rendering (passing by reference, passing wrap parameters for faster access)
- renamed class to ParticleSystem2D
- removed some whitespaces
- some reformating, removed some comments
- minor tweaks
- removed non-working line-attractor function

* Optimization and bugfixes

- added out of bounds checking function
- fixed rendering at boundaries
- various small changes and cleanup
- bugfixes with comparing ints of different signeness
- fixed bounce radius

* Cleanup, bugfixes, speed improvements, refactoring

- lots of code refactoring / reformating
- fixed bug in fire particle update and improved speed a bit
- refactoring of pixel rendering
- removed 2D buffers, replaced with 1D buffer for faster access
- bugfix in blur2D
- many small improvements to 2D system

* Refactoring and cleanup of 1D PS, removed debug printouts

- code reformating for consistency and readability
- replaced "'?" operator with min / max (produces the same code, more readable)
- minor changes for speed (random16 used, can later be replaced with hardware random function)
- renamed PS Equalizer to PS 2D GEQ

* Cleanup and some refactoring of particle FX

- moved 2D / length check to PS initi
- code reformating
- removed some comments

* missed a spot

* minor tweaks to fast_color_add()

* Work in progress: update to fireworks, needs more testing & finetuning

also bugs fixed and some minor cleanup

* Work in Progress: added particle memory manager for transitions

- uses only one, persistant buffer to render all present particle systems
- Buffer for particles is shared for one segment (may allow interacitng systems in the future)
- updated some of the FX to handle the new transfer, 1D FX still not done
- updated parameters for particle impact FX

* work in progress: lots of changes & fixes, transitions now work correctly in 2D

- still fragile code with lots of cleanup to do

* added transitions for big-size rendering

- transitions now work with FX that use global large size rendering. this is done by handling the buffer correctly. to avoid creating a second buffer, it is transferred back and forth to the segment. this is a bit slow but a compromise solution.
- multiple segment handling is still untested

* speed improvement to  fast_color_add, added preliminary buffer transfer function

* merge fixes

* bugfix in setCurrentPalette, corrected order of 2D memory allocation, increased max particles/sources

- fixed timing for vortex

* fixed particle buffer handover, added 2D blur option, increased particle limits, various fixes

- fixed bug in memory watchdog, now works and also works when freezing segments
- fixed PS Box to work again with particle handover
- added smear blurring to waterfall
- added smear blurring to vortex, fixed color distribution, removed random color distribution option
- replaced all random() calls with hw_random()
- transitions now work but only if FX transitions are enabled and not when chaning segment size

* implemented correct 1D<->2D buffer handover+bugfixes

work in progress

* added smear to fuzzy noise, some cleanup

* added blurring option to PS 2D fireworks, work in progress in finding that nasty bug that crashes all

* BUGFIX: finally found and squased the memory bug, no more random crashes

also: removed debug outputs and minor cleanup

* minor cleanup and fixed a bug

1D system had a lot of crashes, some out of bounds memory issue. fixed it but I have no idea which change did that, maybe the order in 1D initialization

* BUGFIX: out of bounds checking was wrong, leading to crashes

* better handling of used particles in transitions

for FX that do not use all particles, transitions were constantly shifting the pointer, resulting in newly generated particles and weird particle flickering, this is not fixed by keeping the pointer constant once the number of used particles is reached.

* improved particle transition for low-count FX, updated 1D FX

now most 1D FX work again, still needs some fine-tuning

* Rework on Fireworks 1D, some minor fixes

- fireworks 1D now matches as closely as possible to the old FX
still not identical but as good as it gets.

* bugfix in PS Chase, increased brightness of 1D fireworks

* replaced sin16/cos16 with new versions

* bugfixes

* fixed hourglass init, rearranged PS FX init

* speed optimization

- moved out of bounds calculation to proper spot
- removed repeated allocation attempts if initial buffer alloc fails

* Added Sonic Stream FX, some cleanup, bugfix in emitter

* changed TTL to brightness calculation, added collision binning

- brightness is now doubled as some FX were really dim due to low TTL
- added binning in x-direction giving a huge speed advantage on larger matrix sizes

* collision binning bugfix, made particles less sticky, update to waterfall

- updated waterfall intensity and blurring

* WIP: fixed 1D system for over 1000 pixels, added collision binning for 1D

- making x coordinate 32bit allows for larger strips but uses a lot of ram due to struct memory alignment (12bytes instead of 8 bytes), this needs some more work to properly fix.
- adding collision binning significantly speeds things up, about a factor of 2 on most FX using collision
- there are still some bugs in FX or 1D memory handling (or both) on large setups

* moved particle flags to seperate array to save on RAM, refactoring

- moving the flags optimizes ram alignment, saving memory for each particle
- changed lots of parameters to `const`
- moved fire intensity to a variable instead of passing it to every render() call
- changed passing pointers to passing reference where possible
- saves a total of 340 bytes of flash

* removed todos after some checks, minor improvements

* inverted y axis in 2D render, 1D collision improvements, cleanup and fixes

- inverting the y-axis in the buffer instead of in buffer transfer fixes the FX flipping when transitiononing 1D<->2D
- improved particle binning for collisions
- added hard-pushing also when not using gravity so piles close to an edge dont collapse
- some improvments to "balance" FX
- renaming and cleanup

* FX fixes and minor tweaks

* increased min rockets

* fixed #ifdefs

* another fix

* revert unnecessary changes to base code

* merge fix

* minor tweak

* tweaked sparkler FX, some cleanup

* Fix in volcano FX, changed blurring of volcano and waterfall

* added ifdefs

* minor tweaks, increased 1D minsurfacehardness

* improved sparkler FX, made overlay possible (1D not yet), cleanup

* cleanup, now using new hsv2rgb/rgb2hsv, add overlay rendering to 1D

- new hsv2rgb is a tiny bit faster
- removed redundant code (using transferBuffer instead)
- tweked parameters in vortex, removed unneeded slider defaults

* fix for non or partially overlapping segments

- can not use overlay rendering if no segment clears the buffer, it will all add up to white eventually
- now additive transfer i.e. overlay mode is only activated if the segment is fully overlapping an underlying segment

* change got lost...

* increased sparkler intensity, some cleanup

* replaced #ifdefs, removed 1D replacements that have 2D version, removed notes

* cleanup, improvements to PS bouncing ball, replaced multicomet

- bouncing balls is now named pinball and has settings/parameters updated to be a replacement for multicomet

* cleanup, improvements, bugfixes

- large size rendering now works without framebuffer
- background adding is now done on buffer (if avilable) instead of segment
- fixed overflow bug in 2D large particle rendering (it worked only for powers of 2 size)

* potential bugfix, compiler warning fix

* removed colorwaves and pride option from chase (not worthy replacements)

* updated #defines, removed PS from 1M and 2M builds

* Adding Particle System and PS FX

Adding all 187 commits from particle system dev branch

* reverted some accidental changes

* reverted some accidental changes

* merge fixes

* changed replacement: multicomet instead of comet (lighthouse)

* changed replacement: multicomet instead of comet (lighthouse)

* disable 2D PS for ESP8266, some cleanup, improved pinball FX parameters, bugfixes

* Improved collision binning for large particles, improved pinball FX

* improved speed handling in pinball FX - rolling

* disable 2D PS for ESP8266, some cleanup, improved pinball FX parameters, bugfixes

* improved hourglass: millis instead of frame timing, better stacking. and cleanup.

* revert whitespaces

* simplified 1D collisions, improved binning for larger particles

- ran a lot of experiments with collisions in 1D, the new much simpler approach seems to be a good compromise with regards to stacking and normal collisions.

* Improved collision binning for large particles, improved pinball FX

* improved speed handling in pinball FX - rolling

* improved hourglass: millis instead of frame timing, better stacking. and cleanup.

* revert whitespaces

* prohibit use of 1D and 2D system simultaneously on ESP8266

* prohibit use of 1D and 2D system simultaneously on ESP8266

* update to handle blending styles

* fixed bugs, improved new transition handling

* updated 1D system to work with new transitions, replaced NULL with nullptr

* merge fixes

* added single pixel particle rendering for 2D system, adjusted FX to work with it

* improved collisions in 1D and 2D, some bugfixes in radius calculation, minor tweaks

- collisions are now also velocity based in 1D, there was a bug that prevented that from working well (wrong collision distance calculation)
- improvement and bugfix in 2D collision distance calculation
- added distance based pushing in 2D (instead of only using the dotproduct)
the combination of improved distance calculation and proper pushing make collisions a lot better in all tested FX

* minor fix

* fixed overlay detection, checking for partial overlay

if a PS FX is partially overlapping, it will render in overlay mode

* better blur range in PS Firworks

* minor code consolidation

* updated 1D collisions (yet again), improved 2D collision speed

- slight improvement to 2D collision code efficiency
- added faster "division" to C3/ESP8266 by using a right shift trick (biasing towards 0 also for negative numbers by applying proper rounding)

* minor tweak in PS balance
2025-02-17 18:32:12 +01:00
netmindz
756e27fb52
Disable notify - pending permissons fix 2025-02-16 14:02:06 +00:00
netmindz
1d6e5a2464
notify on nightly 2025-02-16 13:17:40 +00:00
netmindz
dc77428df4
Notify on daily 2025-02-16 13:17:03 +00:00
Will Tatam
b293356cec Revert "Disable changelog while fixing release update"
This reverts commit 1fd703aff9658ad3edeb548822f9fc4529d80137.
2025-02-16 10:53:19 +00:00
Will Tatam
1dc7647bb9 Merge branch 'main' into usermod-libs 2025-02-16 10:40:30 +00:00
netmindz
c3f6537a4d
Merge pull request #4558 from DedeHai/wifi_hardware_timing_fix
Bugfix for incorrect wifi-hardware timing
2025-02-16 10:33:52 +00:00
netmindz
70a3dc938a
Merge pull request #4560 from maxi4329/update-links
update links to point to the new repo
2025-02-16 10:29:05 +00:00
netmindz
1fd703aff9
Disable changelog while fixing release update 2025-02-16 10:21:38 +00:00
maxi4329
aa3fb7d165 update links to point to the new repo 2025-02-15 20:07:41 +01:00
netmindz
2b9ff3148c
Merge pull request #4556 from spiro-c/npm-check
Fix for: Build should stop if npm fails #4513
2025-02-15 15:09:46 +00:00
maxi4329
7f24269511
Fix for #4153 (#4253)
* fix for #4153

* only load touch/mouse events for touch/mouse devices

* undid formating changes

* undid more formating changes

* undid all formating changes

* use pointerover and pointerout eventlisteners
2025-02-15 15:14:52 +01:00
Damian Schneider
b34d65fce0 fix for incorrect hardware timing 2025-02-15 10:34:44 +01:00
SpiroC
778cecb512 Check if Node.js is installed and present in PATH 2025-02-15 14:43:08 +11:00
Brandon502
e7e0eb0f32 Pinwheel Rework
Optimized pinwheel algorithm. Math and memory optimizations by @DedeHai
2025-02-13 19:01:10 -05:00
Blaž Kristan
a0c55c6406
Merge pull request #4484 from blazoncek/parallel-I2S
WWA strip support & parallel I2S for S2/S3 (bumping outputs from 5/4 to 12)
2025-02-13 19:10:37 +01:00
Damian Schneider
aba736cb96 moved modulo 2025-02-10 20:26:34 +01:00
Damian Schneider
bdec873fed removed slider default 2025-02-10 08:42:22 +01:00
Damian Schneider
2cc73660bf bugfix (XY needs the modulo for zF/zD), updated amplitude for better range 2025-02-10 08:30:36 +01:00
Blaž Kristan
f3de45c6ad Remove reference to custom allocators 2025-02-09 21:43:35 +01:00
Blaž Kristan
386e2c6306
Merge pull request #4528 from blazoncek/ir-bugfix
Fix for "Send notifications on button press or IR" does not work when using "JSON remote" #4519
2025-02-09 20:36:44 +01:00
Blaž Kristan
2473065b98 Soap gap bugfix & aditional size tuning 2025-02-09 19:08:42 +01:00
Blaž Kristan
ed91c54654 Uninitialised _data bugfix 2025-02-09 18:24:10 +01:00
Damian Schneider
4d53e0adde
Fixes first pixel not being set in Stream FX (#4542)
* Fixes first pixel not being set
* added fix to Stream 2 as well
2025-02-08 16:45:33 +01:00
yangminglong
35f87365c9
Brightness follow sun (#4485)
* add usermod : Brightness Follow Sun
2025-02-08 10:11:14 +01:00
Damian Schneider
8e7d6d5dad cleanup and added Density slider
- moved local variables into function
- made coordinates an array
- amplitude can now be changed by user (default setting is a slight increase to original which cannot be avoided without complicated logic or default slider setting)
2025-02-08 10:06:29 +01:00
scourge411
95a10c692c
constexpr is invalid on is2D() (#4540)
* constexpr is invalid on is2D() (it does work on _V4 builds though)
2025-02-08 08:44:46 +01:00
Blaž Kristan
77d7082ffc Bugfix
- correct string length in strlcpy()
2025-02-07 16:56:16 +01:00
Blaž Kristan
c43d09c8b1 Move _data and allocation to derived class
- as suggested by @TripleWhy
- minimum length guard

Conflicts:
	wled00/bus_manager.cpp
	wled00/bus_manager.h
2025-02-07 16:18:53 +01:00
Damian Schneider
d92e60ee5f adding XY() lambda function back in
- slight increase in code size, speed is the same but better readability.
2025-02-07 15:23:44 +01:00
Damian Schneider
b9ceacb43d more optimizations and better readability 2025-02-07 11:14:13 +01:00
Damian Schneider
2fe809f15a consolidated double loops into function
- saves ~500 bytes of flash
- slight speed improvement
2025-02-07 09:46:06 +01:00
Will Miles
078a054dbd usermods/pixels_dice_tray: Fix BLE dependency 2025-02-07 04:12:07 +00:00
Will Miles
c57be77039 Fix sensor usermod globals
These can be static locals instead; allows these usermods to build and
link together.
2025-02-06 22:26:45 -05:00
Will Miles
e6910f732f Disable EleksTube_IPS usermod
For some reason, building it seems to consume 300kb of SRAM??
Probably there's still something wrong with the configuration.
2025-02-06 22:25:39 -05:00
Will Miles
d0b599781d Fix up BME280_v2 usermod
Minor compile correctness tweak
2025-02-06 22:24:53 -05:00
Will Miles
2431f2058b load_usermods: Split on any whitespace
This allows the common newline syntax in platformio
2025-02-06 22:23:12 -05:00
Blaž Kristan
8c717537c4 Lambda XY() 2025-02-06 15:12:04 +01:00
Damian Schneider
e088f4654a removed unnecessary changes 2025-02-06 11:32:33 +01:00
Damian Schneider
b363b6151c revert using color_fade() as it is slower
- ran a few more tests, it is 30% faster like it was originally so reverting. The conversion to 32bit color appears to be wasteful in resources.
2025-02-06 11:32:33 +01:00
Damian Schneider
3baa4f8223 improved speed and fixed issue
- fixed issue: blending was also done when color was on a key-index-color which is now skipped
- speed improvement: conversion is skipped if color is key-color
2025-02-06 11:32:33 +01:00
Damian Schneider
373f4cfefd removed unnecessary lambda function
performance is the same, the function just makes it a bit confusing.
2025-02-06 06:44:26 +01:00
Blaž Kristan
64a02b705a Blending style bugfix (wrong limit)
SoundSim bugfix (missing options)
2025-02-04 18:42:38 +01:00
Will Miles
f72b5d04e8 usermod/pixels_dice_try: Add missing dep
The "arduino-pixels-dice" library needs the ESP32 BLE subsystem, but
doesn't explicitly depend on it.
2025-02-03 19:35:12 +00:00
Will Miles
1688546519 Fix RTC usermod 2025-02-03 18:48:07 +00:00
Will Miles
2eff6b7a3a usermod/sensors_to_mqtt: Add explicit dep
This mod includes a header from the Adafruit Unified Sensor library
inherited by its target sensor libraries.  This isn't reliably
picked up by PlatformIO's dependency finder.  Add an explicit dep to
ensure build stability.
2025-02-03 17:57:09 +00:00
Woody
58962f8470
npm update 2025-02-01 22:56:06 +01:00
Woody
dfd7ff5b39
Merge branch 'cdata' of https://github.com/w00000dy/WLED into cdata 2025-02-01 22:54:20 +01:00
Woody
d56ded8c18
npm update 2025-02-01 22:52:31 +01:00
Woody
af3ebbb3c2
Merge branch 'main' into cdata 2025-02-01 22:51:02 +01:00
Blaž Kristan
1db3359b84 Replace unsigned with size_t 2025-02-01 12:07:31 +01:00
Will Miles
7a40ef74c6 Fix up PWM_fan
Use a custom setup script to check for the dependencies and pass along
the required compile flags to the module; also split the object
definitions for the target modules from their source so as to allow
#including them.
2025-01-31 23:59:37 +00:00
Damian Schneider
b64cd36468 fixes trail flickering randomly. thx @blazoncek for discovering 2025-01-31 14:14:23 +01:00
Will Miles
b3f9983f44 First half of usermod readme updates
Describe the new usermod enable process, and update sample
platformio_override.ini stubs.
2025-01-31 03:57:23 +00:00
Will Miles
070b08a9e6 Rename usermod EXAMPLE_v2 to EXAMPLE
It'd be better to not propagate the 'v2' suffix any further.  This is
the standard flavor of usermods now.
2025-01-31 03:54:17 +00:00
Will Miles
851e9ece03 Remove deprecated mqtt_switch_v2 usermod
...it's been 3 years, and it's easier than cleaning up the readme.
2025-01-31 03:52:59 +00:00
Will Miles
51db63dff7 load_usermods: Also search for mod_v2 2025-01-31 03:39:05 +00:00
Will Miles
a5b972d87e Merge remote-tracking branch 'upstream/main' into usermod-libs 2025-01-31 02:51:56 +00:00
Will Miles
4bc3408410 load_usermods: Don't cross usermod includes
Only include paths for the base system deps, not those of other
usermods.
2025-01-31 01:35:58 +00:00
Will Miles
5d392d89ce load_usermods: Improve include path assembly
Don't blast the path of any mentioned library - parse only the tree of
the actual build deps.
2025-01-31 01:33:34 +00:00
Will Miles
86f97614b0 platformio.ini: Fix esp32dev_V4 usermods 2025-01-31 01:32:34 +00:00
Blaž Kristan
5b7bab6752 Compile fixes 2025-01-30 20:46:26 +01:00
Blaž Kristan
70042db2de Allow "unlimited" virtual buses
- added config upload options
- number of buses it limited to 36 (0-9+A-Z identifiers)
- WRNING web server may not support that many variables
2025-01-30 19:41:44 +01:00
Blaž Kristan
bf69d37cbe Revert getBus() changes 2025-01-30 19:35:36 +01:00
Blaž Kristan
ee7ec20f29 Convert BusManager class to namespace
- use unique_ptr/make_unique for busses
2025-01-30 19:31:09 +01:00
Blaž Kristan
1e1ba9afa3 Fix for aircoookie/WLED#4519
- added JSON handling for irApplyToAllSelected
2025-01-30 19:19:27 +01:00
netmindz
32a75c1ff5
Merge pull request #4165 from willmmiles/esp8266-pwm-phase
Support PWM phase shifts on ESP8266
2025-01-27 19:05:46 +00:00
netmindz
61b99471a1
Merge pull request #4516 from willmmiles/aws-queue-0_16
Update AsyncWebServer and enable response queue
2025-01-26 16:15:24 +00:00
Will Tatam
e27fa882fa Move CONFIG_ASYNC_TCP_USE_WDT=0 to new esp32_all_variants 2025-01-26 16:12:08 +00:00
Will Tatam
7c05914e5a Merge branch 'main' into aws-queue-0_16 2025-01-26 16:07:15 +00:00
netmindz
daa438b349
Merge pull request #3835 from Aircoookie/gif
Image effect (GIF support)
2025-01-26 15:46:16 +00:00
Will Tatam
35624ab998 Merge branch 'main' into gif-fix 2025-01-26 15:19:56 +00:00
netmindz
2d6ad41ed4
Merge pull request #4430 from inverse/fix-devcontainers-config
Use proper devcontainers schema for vscode customisations
2025-01-25 08:20:38 +00:00
netmindz
8544bdd881
Merge pull request #4518 from zuckschwerdt/gh-add-gz-nightly
Nightly release - Add bin.gz artifacts
2025-01-25 07:48:21 +00:00
Christian W. Zuckschwerdt
a778ff01f6 Nightly release - Add bin.gz artifacts 2025-01-24 23:17:01 +01:00
Blaž Kristan
e7c0ce794b Merge conflict fix
- updated blending style constants
2025-01-24 10:10:14 +01:00
Will Miles
4c50119ac2 Merge remote-tracking branch 'upstream/main' into esp8266-pwm-phase 2025-01-23 19:39:01 -05:00
Will Miles
2181618357 stress_test: Add replicated index as a target
No locking contention, but a much larger target
2025-01-23 19:10:43 -05:00
Will Miles
bec7e54f7f Defer web requests if JSON lock contended
Use the web server's queuing mechanism to call us back later.
2025-01-23 19:10:43 -05:00
Will Miles
dc317220b3 Debug: Dump web server queue state
This can be helpful for debugging web handler related issues.
2025-01-23 19:10:43 -05:00
Will Miles
981750a48a Enable webserver queue and limits
Enable the new concurrent request and queue size limit features
of AsyncWebServer.  This should improve the handling of burst
traffic or many clients, and significantly reduce the likelihood
of OOM crashes due to HTTP requests.
2025-01-23 19:10:43 -05:00
Will Miles
1df717084b Update to AsyncWebServer v2.4.0
Includes update to use matching newer AsyncTCP on ESP32
2025-01-23 19:10:28 -05:00
Will Tatam
f2caf14d6a Fix missing hideDMXInput and hideNoDMXInput functions 2025-01-22 20:33:15 +00:00
Will Miles
c9672b35ce
Merge pull request #4511 from mlichvar/main
fix reproduction in game of life
2025-01-21 19:56:51 -05:00
Miroslav Lichvar
39512da74e fix reproduction in game of life
A typo caused broken counting of the most common color in neighbouring
cells and blocked reproduction in some directions.
2025-01-21 20:01:04 +01:00
Will Miles
0d44e7ec27 Usermods: Remove libArchive
This is now managed centrally.
2025-01-21 00:12:37 +00:00
Blaž Kristan
24082d169b
Merge branch 'main' into parallel-I2S 2025-01-20 22:19:49 +01:00
Blaž Kristan
3debaf0f41
Merge branch 'main' into use-bssid 2025-01-20 17:46:56 +01:00
netmindz
2448266d7c
Merge pull request #4158 from Aircoookie/blending-styles
Effect blending styles (recreated PR from #3877)
2025-01-20 11:30:57 +00:00
Blaž Kristan
3a426e258b
Merge branch 'main' into blending-styles 2025-01-20 11:19:43 +01:00
Blaž Kristan
b062d1ee3e
Merge branch 'main' into large-ledmap 2025-01-20 09:03:55 +01:00
Blaž Kristan
ebc171d405 Const update
- removed erroneous DEBUGFX
2025-01-20 08:59:35 +01:00
5chubrakete
4951be6999
Added some date and time formatting options to scrolling text effect. (#4195)
Updated to nonbreaking change and auto uppercasing according to review.
2025-01-20 06:24:10 +01:00
Ryan Ross
01a71132d5
connect the seven segment reloaded usermod to BH1750 usermod (#4503) 2025-01-20 06:12:12 +01:00
Damian Schneider
a421a90e0a
replacement for fastled sqrt16() (#4426)
* added bitwise operation based sqrt16

- replacement for fastled, it is about 10% slower for numbers smaller 128 but faster for larger numbers. speed difference is irrelevant to WLED but it saves some flash.

* updated to 32bit, improved for typical WLED use

- making it 32bits allows for larger numbers
- added another initial condition check for medium sized numbers
- increased the "small number" optimization to larger numbers: the function is currently only used to calculate sqrt(x^2+y^2) which even for small segments is larger than the initially used 64, so optimizing for 1024 makes more sense, although the value is arbitrarily chosen
2025-01-20 05:51:04 +01:00
Will Miles
1d558e8391 platformio.ini: Add extra flags for usermod test
Define a couple pins, leave a note where the usermod list comes from.
2025-01-19 22:25:34 +00:00
Will Miles
30a697e708 usermods/PWM_fan: Disable pending cross-mod check
A better solution for cross-module communication is required!
2025-01-19 22:19:30 +00:00
Will Miles
0233daeda2 usermods/sensors_to_mqtt: Fix char type 2025-01-19 22:19:30 +00:00
Will Miles
48372bcd91 platformio: Fix audioreactive usermod for ESP8266 2025-01-19 22:19:30 +00:00
Will Miles
44a1a1ebde usermods: Fix MQTT checks
- Check after including wled.h
- Use WLED_DISABLE_MQTT instead of WLED_ENABLE_MQTT
2025-01-19 22:19:30 +00:00
Will Miles
2b07be1d09 usermod mpu6050: Fix incorrect int type 2025-01-19 22:09:44 +00:00
Blaž Kristan
a98685d89e Remove numBusses, RMT idle bugfix
- experiment with std::unique_ptr
2025-01-19 21:37:34 +01:00
Blaž Kristan
1c4ba20646 Merge branch 'bus-improvements' into parallel-I2S 2025-01-19 12:41:17 +01:00
Blaž Kristan
d3954b94d3 Update NPB to 2.8.3
Remove logs form Git tracking
2025-01-19 12:19:06 +01:00
Blaž Kristan
7daea18907 Merge fixes & updates
- Segment::setName()
- S2 limits
- bus debug macros
- remove cctBlending from strip
2025-01-19 11:37:57 +01:00
Blaž Kristan
0c84235a95 Bus rework
- Implement vector in bus manager
- Memory calculation according to explanation from @Makuna
- Prefer 8 RMT before 8 I2S on ESP32 (fixes #4380)
- speed improvements in ABL
- verbose debugging
- get bus size from NPB (prototype)
- Parallel I2S output bugfix
- automatic selection of appropriate I2S bus (`X1xxxxxxMethod`)
- removed I2S0 on ESP32 (used by AudioReactive)
- renumbered internal bus numbers (iType)
- added buffer size reporting
2025-01-19 10:17:33 +01:00
Damian Schneider
aab29cb0ab consolidated colorwaves and pride into one base function
the two FX are almost identical in code with just a few lines difference.
2025-01-19 09:04:54 +01:00
Frank
566c5057f9 optimizations as per reviewer recommendations
* removed unneeded initializations in blur() and blur2D()
* remove check for _t in progress()
* code readability: if (_t) --> if(isInTransition())
* add `isInTransition()` checks to currentBri() and currentMode()
* added missing `_transitionprogress = 0xFFFFU` in stopTransition()
2025-01-19 07:35:46 +01:00
Frank
cd52d7bcf6 align some function declariations with their implementation
This is purely a "clean code" thing, no impact on function -  it helps to avoid confusion when reading the code.

C++ allows declaration and implementation to use different variable names.
2025-01-19 07:35:46 +01:00
Frank
ed3ec66d33 fix compile error
"const" was missing in the function implementation
2025-01-19 07:35:46 +01:00
Blaž Kristan
01c463c8e8 More tuning
- replaced POD new/delete with malloc/free
- some more SEGLEN <= 1
- some gnu::pure
- more const attributes
- some static attributes
2025-01-19 07:35:46 +01:00
Frank
872465df40 typo in comments 2025-01-19 07:35:46 +01:00
Frank
b6f74287d0 implement recommendations from reviewers
* simplified transition bugfix
* removed cast same type
* isIp parameter changed to pass-by-reference, to avoid copy constructor
2025-01-19 07:35:46 +01:00
Frank
013684b5ca making some parameters const, plus minor improvements
* changed some parameters to "pointer to const", so compiler can better optimize code size and performance -  because data behind a const pointer will never be modified by the called function.
* made setPixelColor `const`

* fixed a few potentially uninitialized local vars (the may have random values if not initialized)

* avoid shadowing "state" in handleSerial()
* plus a few very minor improvements
2025-01-19 07:35:46 +01:00
Frank
90c2955a71 avoid using keywords for variables: module, final
these are reserved names and future compilers may reject them.
2025-01-19 07:35:46 +01:00
Frank
7be868db12 bugfix: indexOf() returns -1 if string not found
... so we must use `int` instead of `unsigned`
2025-01-19 07:35:46 +01:00
Frank
703f84e5e1 code robustness improvements plus minor speedup
* make  XY() and _setPixelColorXY_raw() const (minor speedup)
* segment is a struct not a class: friend class Segment --> friend struct Segment
* fix missing braces around two macros
* use non-throwing "new" where possible
* improve robustness of transition code
2025-01-19 07:35:46 +01:00
Malachi Soord
c92dbb10ac
Use proper devcontainers schema for vscode customisations 2025-01-18 01:03:39 +01:00
netmindz
48f5099646
Merge pull request #4495 from netmindz/DMX-Input-AC
Add Wired DMX Input support
2025-01-17 19:31:25 +00:00
Kilrah
b9aeb19834
RF433 json usermod (#4234)
* RF433 remote usermod

---------

Co-authored-by: Kilrah <kilrah@kilrah.xyz>
2025-01-17 08:01:17 +01:00
Will Miles
193926c795 usermods: Remove #pragma once from cpps 2025-01-17 00:50:02 +00:00
netmindz
a4c3491f0c
Merge pull request #4428 from blazoncek/waterfall-fix
FX: Waterfall, Matripix & Dissolve fix
2025-01-16 15:52:21 +00:00
netmindz
ad65856b3d
Merge pull request #4018 from Brandon502/main
Added Cube Mapping Tool
2025-01-16 13:03:22 +00:00
netmindz
b2aac9f991
Merge pull request #4386 from DedeHai/ESPNow_glitchfix
Fix for ESPNow remote causing output glitches
2025-01-16 13:01:00 +00:00
Will Tatam
a582786655 Port over remaining WLEDMM part of DMX Input and adapt for AC 2025-01-16 12:48:36 +00:00
Will Tatam
953e994c88 Add DMX Input support to builds 2025-01-16 12:24:42 +00:00
Will Tatam
9a6e91d3e5 DMX Input - reinstate loggers for connection state change 2025-01-16 12:22:51 +00:00
Will Tatam
fc4e7a2dee Swap DMX port to 1, persist user choice of port, validate port vs UART count 2025-01-16 12:22:32 +00:00
Will Tatam
a56014bb66 Hide DMX port as just confusing to users 2025-01-16 12:20:37 +00:00
Will Tatam
ebfc438bd4 Tweak DMX settings UI 2025-01-16 12:20:15 +00:00
Will Tatam
3996f02dea Revert "Rename WLED_ENABLE_DMX to WLED_ENABLE_DMX_OUTPUT"
This reverts commit 7f9cc6751875dd4882f91bf58adcb820d76cab8c.
2025-01-16 12:19:25 +00:00
Arne
d637524bfc chore: remove outdated comments 2025-01-16 12:16:50 +00:00
Arne
8570922dcc chore: adapt code style 2025-01-16 12:16:39 +00:00
Arne
6598265f9b make compile after rebase 2025-01-16 12:15:58 +00:00
Arne
8f398dfd08 Move dmx_input into its own task on core 0.
This was necessary because otherwise it is not able to respond to rdm in time.
2025-01-16 12:15:49 +00:00
Arne
68e9d701de Do no longer disable dmx_input when cache is disabled.
No longer needed because missing ISR_ATTR have been added to esp_dmx.
2025-01-16 12:15:37 +00:00
Arne
67e8a00b6d rename initDmx() -> initDmxOutput() 2025-01-16 12:11:21 +00:00
Arne
11b48bc374 rename handleDMX() handleDMXOutput() 2025-01-16 12:10:13 +00:00
Arne
fa80c62b28 rename dmx.cpp -> dmx_output.cpp 2025-01-16 12:06:10 +00:00
Arne
7f9cc67518 Rename WLED_ENABLE_DMX to WLED_ENABLE_DMX_OUTPUT 2025-01-16 12:05:40 +00:00
Arne
84eb6fd460 Add dmx input port to configuration 2025-01-16 11:47:48 +00:00
Arne
2cc5a29b86 keep dmx rdm identify on if dmx disconnects.
Some rdm testers disconnect after setting it.
2025-01-16 11:42:35 +00:00
Arne
b178c08271 Support dmx rdm personality change 2025-01-16 11:42:16 +00:00
Arne
9a3b208ac5 comments and cleanup 2025-01-16 11:37:14 +00:00
Arne
2989155f05 handle rdm dmx address changes 2025-01-16 11:37:05 +00:00
Arne
50b56c64f5 extract creation of dmx config into own method 2025-01-16 11:36:58 +00:00
Arne
be3e331afb Monitor dmx personality and dmx start address for change and update rdm 2025-01-16 11:36:50 +00:00
Arne
9d8fdd0b20 extract test for rdm identify into own method 2025-01-16 11:36:44 +00:00
Arne
033c7abe62 add enable/disable methods for dmxInput 2025-01-16 11:36:36 +00:00
Arne
5525a21696 rename settings 2025-01-16 11:36:24 +00:00
Arne
aed03cd03b hack: disable dmx receiver while wifi is being activated
This fixes a crash in the dmx receiver. The dmx receiver cannot work while cache is disabled. For some reason activating wifi disables the cache. In theory, the driver is placed in iram and should work, but it doesn't. This might be a bug in the driver.
2025-01-16 11:35:04 +00:00
Arne
5a5661f136 handle dmx rdm identify 2025-01-16 11:32:49 +00:00
Arne
a3bcf92ea5 Turn dmx_into into class with state.
This is much nicer to read and in the future more state will be added to support all the rdm stuff.
2025-01-16 11:29:39 +00:00
Will Tatam
0ad31c90f6 fix merge error 2025-01-16 11:26:42 +00:00
Arne
789d68e80d Move globals to top of file and change scope to compile unit only.
Some minor cleanup changes
2025-01-16 11:21:52 +00:00
Arne
f06a1e8b49 Extract dmx_input from dmx.cpp into dmx_input.cpp.
This greatly improves readability because it gets rid of most of the
ifdefs.
2025-01-16 11:21:41 +00:00
Arne
a0ca243955 Move dmx_input pin allocations from wled.cpp to dmx.cpp 2025-01-16 11:20:19 +00:00
Arne
9e2268bd74 Adapt to new api of esp_dmx v3.1 2025-01-16 11:17:58 +00:00
Arne
702d085117 rename global dmx... variables to dmxInput...
This is the first step in supporting both dmx input and dmx output on different pins.
2025-01-16 11:16:39 +00:00
Damian Schneider
356a0d72c3
proper fix for existing C3 override envs 2025-01-16 12:11:38 +01:00
Damian Schneider
7fcc4a5283
fix for existing C3 overrides 2025-01-16 12:07:52 +01:00
Will Miles
15edfcd088 Fix usermod platformio integration
Should now work for new *and* old versions of PlatformIO!
2025-01-16 01:05:12 +00:00
Damian Schneider
278d204d1c
merge fix for Deep-Sleep UM 2025-01-15 20:36:53 +01:00
Damian Schneider
39b3e7e507
BUGFIX in oscillate FX (#4494)
effect was changed from int to uint but it relied on negative numbers. fixed by checking overflow and a cast.
2025-01-15 15:17:56 +01:00
Will Tatam
8487dd7cfd Disable build of usermods that are broken at the moment 2025-01-15 12:49:40 +00:00
Will Tatam
5d05d7936c Add usermod dependencies 2025-01-15 12:46:48 +00:00
Will Tatam
0afd2fe720 Destructor must be public 2025-01-15 12:46:06 +00:00
Will Tatam
59a79a30da Add deps for usermods/BME280_v2 2025-01-15 11:34:51 +00:00
Will Tatam
5da380e1b0 Update dependencies for sensors_to_mqtt 2025-01-15 11:28:38 +00:00
Will Tatam
2adf745d06 Update env:usermods to use V4 2025-01-15 11:22:33 +00:00
Will Tatam
ef2eb0764c Merge branch 'main' into usermod-libs 2025-01-15 11:00:52 +00:00
netmindz
9e37d7051c
Merge pull request #4492 from Aircoookie/V4
V4
2025-01-15 10:57:24 +00:00
netmindz
05098c3382
Merge pull request #4487 from netmindz/V4-tasmota
Swap to tasmota/platform-espressif32
2025-01-15 10:39:50 +00:00
Will Miles
32607ee74c Revert incorrect testing platformio.ini 2025-01-15 02:26:34 +00:00
Will Miles
30559cd2d3 Fix dependency for EleksTube_IPS usermod 2025-01-14 22:21:41 +00:00
Will Miles
8fd905215f Integrate usermods environment
Move the "all usermods" logic in to the platformio script, so the
'usermods' environment can be built in any checkout without extra setup
commands.
2025-01-14 22:21:26 +00:00
Will Miles
270d75afe2 Update usermod deps earlier
When processing usermods, update their include path properties before
the LDF runs, so it can see through wled.h.
2025-01-14 22:16:55 +00:00
Blaž Kristan
a65f97ac75 Merge branch 'main' into blending-styles 2025-01-14 22:39:20 +01:00
Will Tatam
53c1856038 Enable GIF support for all esp32 builds 2025-01-14 18:47:06 +00:00
Will Tatam
56b8af86d7 Swap to WLED_ENABLE_GIF 2025-01-14 18:40:41 +00:00
Christian Schwinne
e852df3179 Proper debug statements 2025-01-14 18:30:34 +00:00
Christian Schwinne
7c03f716a8 Include gif library for all esp32 variants 2025-01-14 18:29:30 +00:00
Christian Schwinne
d4ba603cf7 Update pio version 2025-01-14 18:27:30 +00:00
Will Tatam
deb0306347 Merge branch 'main' into gif-fix 2025-01-14 18:26:41 +00:00
Will Tatam
881da25e8c Add local defintion of lolin_s3_mini as missing from Tasmota platform 2025-01-14 18:06:51 +00:00
Will Tatam
a37b953e72 Set flash_mode to qio for esp32c3dev to maintain current behaviour 2025-01-14 12:44:40 +00:00
Will Tatam
bba5188594 Add the safe option of flash_mode for esp32c3dev, qio also possible 2025-01-14 12:43:06 +00:00
Will Tatam
7dc633581d Merge branch 'V4-tasmota' of github.com:netmindz/WLED into V4-tasmota 2025-01-14 12:29:19 +00:00
Will Tatam
bd00d012e2 Remove esp8266_2m_tasmota as not a V4 change and no suitable tasmota build using the currently used Arduino Core version of 3.1.2 2025-01-14 12:29:03 +00:00
Will Tatam
4f4476b79f Set new codename 2025-01-14 11:53:10 +00:00
Will Miles
0b8721c25e Fix usermod libArchive setting
Monkey-patch PlatformIO to intercept the build process after library
dependencies are loaded, but before the build is fully analyzed.  This
lets us enforce libArchive=False for usermods without making that
setting global across all libraries.

The rest of the fixup code is integrated at the same call site for
simplicity.
2025-01-14 02:48:00 +00:00
Will Tatam
869e275e48 typo in usermods/sensors_to_mqtt/library.json 2025-01-14 00:43:59 +00:00
Will Tatam
e4714870a4 typo in usermods/sensors_to_mqtt/library.json 2025-01-14 00:39:04 +00:00
Will Tatam
1dbd7066de Revert LOROL_LITTLEFS hack 2025-01-14 00:27:54 +00:00
Will Tatam
022e4986ee Revert "Update to Tasmota Arduino Core 2.0.18" - Frank says to stay on
2.0.9

This reverts commit b421f7ae87aa0c76da34b12ba49dd6fc493e26b1.
2025-01-14 00:24:37 +00:00
Will Tatam
2c9c413e79 Merge branch 'usermod-libs' into usermod-libs-migration 2025-01-14 00:22:07 +00:00
Will Tatam
b380d5e2c7 reinstate libArchive:false 2025-01-14 00:10:55 +00:00
Will Tatam
650853c177 Use flash_mode = dio 2025-01-13 21:09:05 +00:00
Will Tatam
ae698f988a Merge branch 'V4' into V4-tasmota 2025-01-13 21:04:11 +00:00
Will Tatam
f920fdecfe Add esp32dev back to default_envs 2025-01-13 21:02:28 +00:00
Will Tatam
4e4f823141 Update comment 2025-01-13 20:57:49 +00:00
Will Tatam
b421f7ae87 Update to Tasmota Arduino Core 2.0.18 2025-01-13 20:56:48 +00:00
Will Tatam
ca80d0489b Add env:esp8266_2m_tasmota 2025-01-13 20:30:10 +00:00
Will Tatam
1ed82426a1 Add esp32dev back to default_envs 2025-01-13 19:30:35 +00:00
Will Tatam
7e9f7d4101 set board_build.flash_mode to fix missing sdkconfig.h 2025-01-13 18:39:21 +00:00
Will Tatam
f240a33935 Remove platform_package override 2025-01-13 18:33:30 +00:00
Will Tatam
5bd0a26126 Remove platform_package override 2025-01-13 16:39:58 +00:00
Blaž Kristan
cc011e39ce Bus creation bugfix
- speed improvements in ABL
- verbose debugging
2025-01-13 17:27:33 +01:00
Will Tatam
29ee551b06 Swap to tasmota/platform-espressif32 2025-01-13 15:38:25 +00:00
Will Tatam
5b5e4157e3 Add esp32dev_v4 env 2025-01-13 11:12:14 +00:00
Will Tatam
3c19692312 Cleanup copy-paste of platform and platform_packages - use the proper common esp32_idf_V4 2025-01-13 10:58:32 +00:00
Will Tatam
24accf96a8 Remove now redundant build section from library.json 2025-01-13 10:53:24 +00:00
Will Miles
f2626b0fc0 Remove now-obsolete AR_build_flags 2025-01-12 17:09:33 +00:00
Will Miles
cc9e9b109c Fix usermod library builds
Manage include folders via a second platformio script, fixing builds and
removing all the extra boilerplate from usermod library.json files.
2025-01-12 17:07:36 +00:00
Blaž Kristan
adead9b578 Bus wrapper modifications
- NeoPixelBus update 2.8.3
- automatic selection of appropriate I2S bus (`X1xxxxxxMethod`)
- removed I2S0 on ESP32 (used by AudioReactive)
- renumbered internal bus numbers (iType)
- added buffer size reporting

Bus modifications
- WWA strip support
- bus initialisation rewrite
- optional parallel I2S (ESP32, S2 & S3)
2025-01-12 15:17:22 +01:00
Will Miles
8527d231e1 audioreactive: Move flags to library
Use a PlatformIO script to move the last of AR_buildflags in to the
module itself.
2025-01-12 13:12:12 +00:00
Will Tatam
4c19341279 Merge branch 'usermod-libs-migration' of github.com:netmindz/WLED into usermod-libs-migration 2025-01-12 01:40:45 +00:00
Will Tatam
075fd4da2d Defining more usermod dependencies 2025-01-12 01:38:48 +00:00
Will Tatam
52bee88ad2 fix word_clock_matrix naming 2025-01-12 00:36:08 +00:00
Will Tatam
52b784e0e5 fix env:usermods 2025-01-12 00:22:54 +00:00
Will Tatam
3521732597 fix env:userods 2025-01-12 00:22:22 +00:00
Will Tatam
d3eec72e45 Defining more usermod dependencies 2025-01-12 00:09:31 +00:00
Will Tatam
79bac912aa use bigger partitions for usermods env 2025-01-11 23:25:05 +00:00
Will Tatam
2381e323c1 Define dependencies for ADS1115 usermod 2025-01-11 22:54:28 +00:00
Will Tatam
d64cedd3fc Build custom_usermods = audioreactive auto_save animartrix 2025-01-11 22:38:57 +00:00
Will Tatam
c16d83fab0 Build custom_usermods = audioreactive auto_save animartrix 2025-01-11 22:36:06 +00:00
Will Tatam
cbed841414 Include basic usermods in CI 2025-01-11 22:12:36 +00:00
Will Tatam
67022beca0 Build all usermods 2025-01-11 22:07:03 +00:00
Will Tatam
6e76a72d78 Convert usermods from header to library 2025-01-11 21:42:41 +00:00
Will Tatam
a5575bc3a0 Fix naming of usermod files to match library name 2025-01-11 21:41:21 +00:00
Will Tatam
90b18158fc Convert usermods from header to library 2025-01-11 21:14:20 +00:00
Will Miles
71b0e8e937 Convert AnimARTrix usermod to library
Borrowed library definition from @netmindz's work on #4476.
2025-01-11 13:32:28 -05:00
Will Miles
4d5e0ca7a3 load_usermods: Expand name search
Look for 'usermod_v2_x' as well.  This could be removed later if we
clean up the folder names.
2025-01-11 13:31:20 -05:00
Will Miles
b8685f2c39 Convert usermods to static libraries
Redesign the usermod system so that usermods are implemented as
PlatformIO libraries instead of headers.  This permits them to call for
dependencies, and eliminates the compiler flags for enabling each one,
allowing the build cache to behave better.

The usermod list is built using some linker magic to construct a static
list in ROM memory.  This eliminates the need for wasting SRAM on
something fixed at build time.
2025-01-11 12:08:29 -05:00
Will Tatam
c4e697d797 Revert "Reapply "Set build version during nightly build" - doesn't work as source"
This reverts commit 2aab617c2e2d3f49ba786532b0e44508659f1fae.
2025-01-10 17:09:25 +00:00
Will Tatam
3502a39181 Revert "Set build version during nightly build"
This reverts commit 4a56c92e7b87703166e0ef6dfa3b54f68ffeb237.
2025-01-10 17:09:11 +00:00
Will Tatam
4a56c92e7b Set build version during nightly build 2025-01-10 16:59:08 +00:00
Will Tatam
2aab617c2e Reapply "Set build version during nightly build" - doesn't work as source
This reverts commit 471bd83eb2dd9fa3636d89b884378cb6a65e62ad.
2025-01-10 16:56:07 +00:00
Will Tatam
471bd83eb2 Revert "Set build version during nightly build" - doesn't work as source
files not yet checked out

This reverts commit ec7a7f4c2522f9958636ceca802b9f6ed24ff64a.
2025-01-10 16:53:20 +00:00
Will Tatam
ec7a7f4c25 Set build version during nightly build 2025-01-10 16:49:15 +00:00
Damian Schneider
bb0c0af189
added a delay after switching relay (#4474)
- helps to stabilize power on the LEDs before sending data
2025-01-09 22:41:45 +01:00
netmindz
709aeff9ea
Merge pull request #4435 from TripleWhy/TripleWhy/issue4425
palette effect overflow fix
2025-01-09 11:03:44 +00:00
netmindz
34f18122f5
Merge pull request #4295 from WouterGritter/mqtt-use-topic-buffer-len
FIX: "magic numbers" for MQTT topic buffer length in mqtt.cpp and button.cpp (use already defined MQTT_MAX_TOPIC_LEN)
2025-01-09 11:01:23 +00:00
netmindz
7208282431
Merge pull request #4424 from inverse/consistent-node
Use consistent node version for local, CI, and devcontainer setup
2025-01-09 10:58:36 +00:00
Will Miles
204e72e9eb
Merge pull request #4213 from willmmiles/static-class-to-namespace
Complete transition of UsermodManager and PinManager away from classes
2025-01-08 21:38:10 -05:00
Will Tatam
f626dfb7b7 Nightly release - add changelog since last release 2025-01-08 10:00:39 +00:00
Will Tatam
08b263bf4e Nightly release - add changelog 2025-01-08 09:55:52 +00:00
Will Tatam
d0e99923fd Nightly release - add changelog 2025-01-08 09:55:41 +00:00
Will Tatam
1750512477 Nightly release - add changelog 2025-01-08 09:50:54 +00:00
Will Tatam
5e3b4c3a11 Nightly release - swap action 2025-01-08 09:32:12 +00:00
Will Tatam
0c431d9746 Nightly release - fix release 2025-01-08 09:22:00 +00:00
Will Tatam
438c5d9909 Nightly release - fix filename 2025-01-08 09:05:28 +00:00
Will Tatam
7d29edf6f4 Nightly release - fix filename 2025-01-08 09:01:15 +00:00
Will Tatam
50d505b896 Nightly release 2025-01-08 08:50:33 +00:00
Frank
2e06f5b1e8
Merge pull request #4450 from adafruit/main
Add correct pin availability for ESP32 Mini modules
2025-01-06 22:33:31 +01:00
Damian Schneider
3adcbb7904
Playlist output glitchfix update: found it also happens on S3 (#4462)
* Fix output glitches when playlist changes preset update: glitches also happen on S3
2025-01-06 22:24:28 +01:00
netmindz
27e98147ef
Swap from dev to alpha for our current work in progress builds whilst working towards the next version 2025-01-05 18:49:51 +00:00
Frank
48958cc638
Merge pull request #4439 from dosipod/Upstream_PRs
Update readme.md for rgb-rotary-encoder usermod
2025-01-04 17:49:15 +01:00
Damian Schneider
ae4de2782a
DeepSleep usermod (#4190)
* DeepSleep Usermod

- sleep delay is now 1 by default, disabling sleep at powerup
- renamed bootup variable to powerup
- using delay counter for proper bootup
- changed power-up and bootup logic
- added fallback to always power-on at boot except at powerup
- fixed bug in settings page
2025-01-04 08:07:11 +01:00
ladyada
dcf89e0dbd simplify logic 2025-01-03 16:37:26 -05:00
ladyada
35d92f43c0 >sigh< https://github.com/espressif/arduino-esp32/issues/10683 2025-01-02 20:54:19 -05:00
ladyada
12db60885f try debug 2024-12-31 17:02:52 -05:00
ladyada
d637260dc3 typo fix 2024-12-31 16:42:49 -05:00
ladyada
0937064e18 fix pin availability calculations for ESP32-mini modules 2024-12-31 16:40:11 -05:00
Blaž Kristan
54264efb20 Fill SSID fix 2024-12-30 15:04:25 +01:00
Damian Schneider
6a1d3de75b
Fix output glitches when playlist changes preset (#4442)
same issue as with https://github.com/Aircoookie/WLED/pull/4386
waiting on bus to finish updating before file access fixes the glitches.
this issue is only present on S2 and C3, not on ESP8266 or dual-core ESPs, the fix is only applied for these two.
2024-12-30 12:58:38 +01:00
AlDIY
3fc8c7d560
Update readme.md
Updated the readme to use lennarthennigs/ESP Rotary@^2.1.1 as the old lib fail to compile
2024-12-29 15:46:49 +03:00
TripleWhy
56e1d577fd palette effect overflow fix 2024-12-27 11:19:24 +01:00
Blaž Kristan
272129f66c Add ability to enter desired BSSID
- add event handling (debug)
- fixes #2151
2024-12-25 15:54:50 +01:00
Blaž Kristan
0441ede229 Fix for #4401 2024-12-25 15:18:34 +01:00
Blaž Kristan
f001846e00
Merge branch 'main' into waterfall-fix 2024-12-25 10:51:34 +01:00
Blaž Kristan
0ac627dfbb FX: Waterfall and Matripix fix
- for Arc expansion
- or gaps
- or ledmaps with missing pixels
2024-12-25 10:46:14 +01:00
Malachi Soord
1a82a3bf7b
Fix devcontainer 2024-12-24 20:30:54 +00:00
Malachi Soord
a2d84886c0
Update .nvmrc 2024-12-24 13:55:10 +01:00
Malachi Soord
97e8382a41
Use consistent node version 2024-12-24 11:05:35 +01:00
Damian Schneider
88738327fd
Merge pull request #4419 from DedeHai/PWM_brightness_fix
BUGFIX PWM brightness discontinuity (fixes #4396)
2024-12-23 15:24:23 +01:00
Damian Schneider
0ad65f4748 fixed CIE brightness calculation for PWM outputs 2024-12-23 14:57:22 +01:00
Frank
9dad436f72
Merge pull request #4414 from shafingazi/main
fixing a typo in LED Preferences
2024-12-22 11:23:16 +01:00
shafingazi
ebdc38fff2
Merge pull request #1 from shafingazi/led-typo-fix
fixed typo in LED Preferences
2024-12-21 21:19:35 -08:00
shafingazi
97bbe6f305
fixed typo in LED Preferences
Changed "poweing" to "powering" within a text block of LED Preferences.
2024-12-21 21:18:57 -08:00
Frank
2f0dbef1e5
Merge pull request #4413 from wled-install/patch-2
Update usermods_list.cpp:  usermod_BH1750.h --> usermod_bh1750.h
2024-12-21 23:21:53 +01:00
wled-install
1711286ef0
Update usermods_list.cpp 2024-12-21 23:05:13 +01:00
Will Tatam
099d3f7b41 version bump 2024-12-20 18:15:12 +00:00
Damian Schneider
5f77478841
Replace PRNG with hardware RNG (#4225)
Both ESP8266 and ESP32 have a hardware random register. This update makes use of that. It is slightly faster than the fastled variants but mostly it is truly random, even when the timing limitations stated in the datasheet are disregarded. Also saves a bit on code size.

- Replaced all random8() and random16() calls with new hw_random() versions
- Not replaced in FX where PRNG is required
2024-12-20 19:12:29 +01:00
Damian Schneider
07cc3aa5c0
FX improvements and cleanup (#4145)
Improvements & merges of FX

- Scrolling Text: Gradient Palette support added
- Waving Cell: Improved with higher temporal resolution (smoother at lower speeds) and added additional mode setting and optional blurring
- Julia: added blur option
- Squared Swirl: added fade option

- Added smearing option to:
    - DNA
    - DNA Spiral
    - Drift
    - Drift Rose
    - Crazy Bees
    - Ripple
    - Colored Bursts
    - Frizzles
    - Lissajous
    - Sindots
    - Spaceships

- Added palette support to:
    - Crazy Bees
    - Polar Lights
    - Drift Rose

- Changed default palette handling (no more special treatment for some FX)
- Merged puddles and puddlepeak
- Merged Gravcenter, Gravcentric, Gravfreq and Gravimeter (saves 1.2k of flash)
- Merged meteor and meteor smooth
- Renamed police_base into mode_two_dots as that was just an alias
- Added 'Traffic Light' palette (originally defined in Polar Lights FX)
-  Firenoise: removed local palette, use fire palette -> slight change in looks (+bugfix)
- Some code cleanup (removed unused / commented stuff)
- Moved dev info for AR to the top so ist easier to find as a reference, also added link to KB there
2024-12-20 14:13:53 +01:00
Damian Schneider
ff26f54bfd
Merge pull request #4138 from DedeHai/0_15__speed_improvements
Speed improvements in many core functions
2024-12-20 09:45:56 +01:00
Damian Schneider
3323d2ed37 another merge fix 2024-12-20 09:37:41 +01:00
Damian Schneider
7b9b3f1ee2 merge fix 2024-12-20 09:12:20 +01:00
Damian Schneider
cae98451e3 Merge remote-tracking branch 'upstream/main' into 0_15__speed_improvements 2024-12-20 09:12:01 +01:00
Damian Schneider
83da7569f5
code consolidation in drawCircle() (#4302)
- saves about 600bytes of flash
- speed tradoff: drawing is now a tiny bit slower but insignificant in my tests
2024-12-19 20:19:42 +01:00
Damian Schneider
26397ee8ad
Optimization: color_blend() (#4245)
Removing the bool saves on code size and makes the function a tiny bit faster. Also this is a cleaner solution IMHO.

-updated blend function to optimized 8bit calculation
- efficient color blend calculation in fews operations possible
- omitting min / max checks makes it faster on average
- using 8bit for "blend" variable does not significantly influence the resulting color, just transition points are slightly shifted but yield very good results (and better than the original 16bit version using the old fastled math with improper rounding)
- updated drawCircle and drawLine to use 8bit directly instead of 16bit with a shift
2024-12-19 18:20:56 +01:00
Damian Schneider
dcfebcb973 allow for 0 value button code 2024-12-19 17:46:39 +01:00
Damian Schneider
fd3b47908b renamed functions, changed timeout to 24ms 2024-12-19 17:41:44 +01:00
Damian Schneider
217d2aeb7f
Merge pull request #4407 from DedeHai/fairy_FX_fix
BUGFIX for Fairy & Fairytwinkle FX
2024-12-19 09:24:27 +01:00
Damian Schneider
e57c701837 fix for repeating glitch
glitch appeared every 65s due to missing uint16_t overflow.
2024-12-19 09:21:57 +01:00
Blaž Kristan
b4aa8376de
Idle current bugfix (#4402) 2024-12-17 18:59:53 +01:00
Frank
d4976ac47a
Merge pull request #4398 from Aircoookie/4395-platformio_override
update platformio override example file (solves #4395)
2024-12-16 17:52:33 +01:00
Frank
b8a96d9a77 workaround for elekstube_ips compile error
the trick is to pin TFT_eSPI version 2.5.33
2024-12-16 15:46:59 +01:00
Frank
f75d582eee Merge branch 'main' into 4395-platformio_override 2024-12-16 15:27:12 +01:00
netmindz
18e0ec9a55
PRs to main now 2024-12-16 13:21:07 +00:00
Will Tatam
68b80cdadc Merge branch '0_15' 2024-12-16 13:12:38 +00:00
Frank
3d3c475d1b define board_build.partitions and build_unflags in standard envs
to ensure that build_unflags and board_build.partitions are always having a useful default value. Values can be overridden in custom buildenvs.

saves us a few lines lin platformio_override.sample.ini.
2024-12-15 22:20:52 +01:00
Frank
6668e72351 fix typo 2024-12-15 21:35:13 +01:00
Frank
b72695f01a added example environment for pico-D4 boards
this one is actually for https://github.com/srg74/WLED-ESP32-pico

Its a simple example how to configure WLED for a custom board with build-in microphone and special purpose pins.
2024-12-15 21:22:19 +01:00
Frank
65f98c1f30 esp32: use "extends"
directly inherits default platform from esp32
2024-12-15 21:07:01 +01:00
Frank
c6fd4c51cf fix outdated build options
* DEFAULT_LED_PIN --> DATA_PINS
* DEFAULT_LED_COUNT --> PIXEL_COUNTS
* DEFAULT_LED_TYPE --> LED_TYPES
* USERMOD_AUDIOREACTIVE --> ${esp32.AR_build_flags}
2024-12-15 21:02:45 +01:00
Frank
3c11c8441f fix errors in pltformio_override.ini (solves #4395)
* WLED_tasmota_1M not existing
* always use ${esp32.default_partitions}
* fix build error in wemos_shield_esp32
2024-12-15 20:54:16 +01:00
Damian Schneider
3261c5b071
replaced repeated progress() calculation calls with a variable (#4256)
progress() is called in setPixelColor(), calculating the transition progress for each pixel. Replaced that call with an inline function to get the new segment variable.
The progress is updated in service() when handleTransition() is called.
The new variable is in a spot where padding is added, so this should not use more RAM.
Result: over 10% increase in FPS on 16x16 matrix

* removed IRAM_ATTR: `updateTransitionProgress()` is called only once per frame, no need to put it in RAM.
* changed transitionprogress to static, private variable, this is now more aligned with other variables using the same logic
* added inline: the function is only used in one place
2024-12-15 13:46:18 +01:00
Soeren Willrodt
c8625c70dd
Merge pull request #4397 from lost-hope/fix_internal_temp_usermod_main 2024-12-14 20:22:56 +01:00
Soeren Willrodt
396e9d0c39
Fix "preset not found issue"
this comit fixes the issue reported by user orbitinstasis
2024-12-14 19:58:30 +01:00
Damian Schneider
e16d3bf040 Fix: output-glitching on ESPNow remote command reception
Processing of received button command is no longer processed in the callback, instead the value is saved to a variable and processed in the main loop.
The actual fix is to not access the file system while data is being sent out: even just trying to open a non-existing file causes glitches on the C3. Waiting for the bus to finish fixes this BUT it causes a frame-delay which is the lesser evil than random color flashes.
2024-12-13 07:40:04 +01:00
netmindz
2c58a87982
Merge pull request #4356 from blazoncek/json-cycle
Proper fix for #3605 & #4346
2024-12-12 15:53:03 +00:00
Will Tatam
a705ae5278 Merge branch '0_15' 2024-12-10 22:12:02 +00:00
netmindz
a426e93011
Merge pull request #4359 from blazoncek/reconnect
WiFi reconnect bugfix
2024-12-09 23:05:12 +00:00
Blaž Kristan
1c220d25ca WiFi reconnect bugfix
- additional debug info
2024-12-07 16:47:50 +01:00
Blaž Kristan
039858dca2 Incorrect limit fix 2024-12-07 10:14:11 +01:00
Blaž Kristan
4758b5efe8 Proper fix for #3605 & #4346
- allow incrementing/decrementing as specified in API
2024-12-07 10:11:25 +01:00
Frank
36e065ab4d
Merge pull request #4336 from willmmiles/4280-limiter-not-saving
settings_leds: always initialize current limiter field (partly solves #4280 )
2024-12-05 13:40:14 +01:00
Damian Schneider
076497e14d Fix update for #4193 (twinkle fox & cat)
- previous fix worked but there was still an overflow after some time passed. there were still missing roll-overs apparently: reverting these two variables back to 16bit/8bit should fix it for good.
2024-12-05 06:54:30 +01:00
Will Tatam
e8d9891d13 set version to dev 2024-12-04 18:57:32 +00:00
Damian Schneider
4902d7fb9e Fix for #4193 (twinkle fox & cat) 2024-12-04 17:10:44 +01:00
netmindz
a873ca6a3e
Merge pull request #4244 from MoonModules/framerate_ac015
Improved framerate control code - strip.show(), strip.service()
2024-12-04 07:48:19 +00:00
Will Miles
a86cb27cfe settings_leds: Init current limiter
Supersedes previous approach; this should use less space and be more robust to future changes.
2024-12-03 21:48:08 +00:00
Will Miles
d620930f10 settings_leds: Remove unused variables
Remove a couple of leftover variables from previous revisions.
2024-12-02 21:52:41 +00:00
Will Miles
8db8ecfef3 settings_leds: Fix quotes on LA value 2024-12-02 21:50:29 +00:00
Frank
a0f99393f5
Merge pull request #4341 from Aircoookie/hotfix_4335
Hotfix for #4335 - solves missed pixel problem in blends effect
2024-12-02 21:42:21 +01:00
Frank
ae8c3b02d0
blends FX - hotfix for black pixels
fixing an off-by-one error to solve #4335
2024-12-02 21:35:48 +01:00
netmindz
99427c2ef7
Merge pull request #4210 from 1Prototype1/dist-cpal
Added Distribute Horizontally for cpal
2024-12-01 19:09:34 +00:00
netmindz
334f16c0b6
Merge pull request #4203 from maxi4329/minor-webui-enhancements
minor webui enhancements
2024-12-01 19:03:36 +00:00
netmindz
7a80a772c1
Merge pull request #4270 from DedeHai/palette_code_crunch
Replaced single palette cases with an array to consolidate code
2024-12-01 19:02:28 +00:00
Will Miles
8b1d712e1e settings_leds: Initialize current limiter field
When adding a new bus, the numeric current limit field was not being
initialized; this was causing it to save 0 when saved instead of the
default 55mA value.
2024-12-01 13:00:37 -05:00
Will Miles
a121f5b61b
Merge pull request #4286 from blazoncek/xml-bugfix
xml comma bugfix + few string optimisations
2024-11-28 09:48:29 -05:00
Frank
251062170e
Merge pull request #4324 from dosipod/0_15
Update settings_sec.htm [Fix the  warning text and Backup presets button misalignment]
2024-11-28 12:22:46 +01:00
Damian Schneider
92e59af4d8
Merge pull request #4181 from DedeHai/0_15_trig_math
Added integer based `sin()/cos()` functions, changed all trig functions to wled_math
2024-11-27 22:27:56 +01:00
Damian Schneider
fa4c23b76e minor improvement 2024-11-27 22:23:48 +01:00
Damian Schneider
a0a46850f5 Merge remote-tracking branch 'upstream/0_15' into 0_15_trig_math 2024-11-27 22:22:50 +01:00
Damian Schneider
4cd0563a93 changed 90° offset to hex, fixed potential bug in FX using sin/cos with incrementing number
- sin/cos calls with incrementing numbers can lead to bad outcomes, the functions (_approx or original sinf/cosf) return bad values for very large float inputs
2024-11-27 21:53:32 +01:00
netmindz
b83f0f461c
Merge pull request #4263 from DedeHai/palette_FX_fix
fixed palette FX to more closely match original 1D version
2024-11-27 19:48:00 +00:00
netmindz
3668ede0ff
Merge pull request #4327 from willmmiles/4312-missing-clock
Fix missing clock setting introduce by #4312
2024-11-27 19:35:19 +00:00
netmindz
945584384a
Merge pull request #4328 from blazoncek/clarify
Fix for #4321 - unclear use of comma operator
2024-11-27 19:31:53 +00:00
Blaž Kristan
b1dd27b516 Fix for #4321 2024-11-27 16:08:10 +01:00
Will Miles
dcba1aad10 PolyBus: Clarify use of clock_kHz
While not used by most bus types, it's not an optional parameter.
2024-11-27 09:05:10 -05:00
Will Miles
acc8b9cdbc BusDigital::begin: Pass clock rate argument
Fixes bug introduced by #4312.
2024-11-27 09:00:25 -05:00
Will Tatam
6cbdd825eb Revert "Cache always misses for tags, so save space and do not save back"
This reverts commit cc55f6015dfff436cb4ff3f595ae53695393f8b3.
2024-11-27 10:59:23 +00:00
Will Tatam
cc55f6015d Cache always misses for tags, so save space and do not save back 2024-11-27 10:56:53 +00:00
Will Tatam
95718ab6ec Dedicated release workflow 2024-11-27 10:36:18 +00:00
Will Tatam
feab27295d workflow refactor to used shared build file 2024-11-27 10:36:18 +00:00
Will Tatam
ca176c7549 rename workflow ready for workflow refactor 2024-11-27 10:36:18 +00:00
netmindz
f8a7a0d6e8
Merge pull request #4326 from blazoncek/com-fix
Fix for #4300 - removal of color order override
2024-11-27 10:01:22 +00:00
Damian Schneider
0a05611e1d more improvements to setPixelColor
- code is a bit cleaner and faster as well
- chaning array access to pointer access in bus_manager makes it a few instructions faster
- changed getNumberOfPins and getNumberOfChannels to return 32bit values, saving the unnecessary 8bit conversion
2024-11-26 20:59:36 +01:00
Damian Schneider
1a8aaa3b26 Speed improvements, commented legacy _t trig functions
- speed improvement: by default M_TWOPI is treated as a double float
- directly calling sin16_t in cos_approx() saves a lot of overhead
2024-11-26 20:32:39 +01:00
Blaž Kristan
cd1c13b4b1 Fix for #4300 2024-11-26 19:35:15 +01:00
AlDIY
d87c5035dd
Update settings_sec.htm 2024-11-26 19:33:22 +03:00
netmindz
77967731d5
Merge pull request #4227 from ingDIY/pr_branch
fixed refs to removed usermod USERMOD_FOUR_LINE_DISPLAY
2024-11-26 09:15:31 +00:00
netmindz
0b54034470
Merge pull request #4284 from blazoncek/search-keep
Keep selected FX visible while searching
2024-11-26 09:10:14 +00:00
netmindz
8ad2583785
Merge pull request #4309 from netmindz/release-name-fix
Fix release name macro expansion
2024-11-25 23:00:56 +00:00
Will Tatam
dd533a9ab4 Update sample WLED_RELEASE_NAME 2024-11-25 23:00:31 +00:00
Blaž Kristan
7236589037 Allow pre-compiled OTA password 2024-11-25 22:57:21 +01:00
Blaž Kristan
2c583c3071 Allow editing WiFi settings 2024-11-25 22:56:22 +01:00
Frank
5b989adebc
Allow TV Simulator on single LED segments
I've checked the code - nothing preventing the effect to run with SEGLEN=1
2024-11-25 15:27:53 +01:00
Blaž Kristan
855e606163 Fix 1st use 2024-11-24 17:17:17 +01:00
Will Tatam
20f8d3c8a9 Builds without WLED_RELEASE_NAME should be called Custom 2024-11-24 15:26:30 +00:00
Will Tatam
0c77dbb7ea cleanup WLED_RELEASE_NAME only if present 2024-11-24 13:55:23 +00:00
netmindz
2448e2ae3b
Merge pull request #4312 from willmmiles/mixed-led-crash
Defer calling begin() on buses
2024-11-24 13:45:26 +00:00
Will Miles
d53d7aa2e2 Defer calling begin() on digital buses
NeoPixelBus requires that all parallel I2S bus members be constructed
before any of them call Begin().  Implement this by deferring the
call to the end of bus construction.

Fixes #4301.
2024-11-23 12:34:06 -05:00
Will Tatam
0be1df7ee8 Stip \" from WLED_RELEASE_NAME 2024-11-23 16:46:41 +00:00
Will Tatam
6aef0e145c Remove TOSTRING for releaseString and add quotes to WLED_RELEASE_NAME 2024-11-23 16:31:07 +00:00
Blaž Kristan
4f1965fbaa Add ability to configure settings PIN at compile time 2024-11-23 11:24:03 +01:00
Damian Schneider
32dc54ce72 reverted rotation scale, offset only on static rotation, inverted shift direction
- inverting the shift direction in signed int is computationally safe as it is cast into an uint8_t and it matches the original FX in 1D
2024-11-22 08:43:45 +01:00
Frank
548736f432
SparkFunDMX fix for possible array bounds violation in DMX.write
Align with code in espdmx.cpp
2024-11-21 22:50:55 +01:00
Frank
6790f8af08
Same MIN_FRAME_DELAY=3 for -C3 and -S2 2024-11-21 22:16:03 +01:00
netmindz
89d587e7dd
Merge pull request #4296 from WouterGritter/mqtt-fix-settings-input-maxlength
Introduce printSetInputMaxlength to properly set an inputs maxlength …
2024-11-21 18:25:26 +00:00
Wouter Gritter
5c8b2ebf7a maxlength -> maxLength to fix this attribute not being modified correctly 2024-11-21 12:04:01 +01:00
Wouter Gritter
5ac8ba9bae Revert "Introduce printSetInputMaxlength to properly set an inputs maxlength variable"
This reverts commit 49fb16e2c6528ddc98cccc352cc8f0d4a5f62a13.
2024-11-21 12:02:55 +01:00
Wouter Gritter
8f8afd98a5 Replace comment with compile-time error and warning 2024-11-21 11:20:42 +01:00
Wouter Gritter
49fb16e2c6 Introduce printSetInputMaxlength to properly set an inputs maxlength variable 2024-11-21 10:52:22 +01:00
Wouter Gritter
0db47a8586 Add comment warning about modification of MQTT_MAX_TOPIC_LEN 2024-11-21 09:51:13 +01:00
Wouter Gritter
cec8978886 Fix comment alignment 2024-11-20 12:45:39 +01:00
Wouter Gritter
0160e3fa87 Use MQTT_MAX_TOPIC_LEN in places where it was not used before to avoid buffer overflows when value is increased 2024-11-20 12:39:39 +01:00
Frank
545bfa6ef9
Merge pull request #4289 from willmmiles/exploding_fireworks_overrun
Fix array overflow in exploding_fireworks
2024-11-18 22:18:19 +01:00
Blaž Kristan
c596b5a17d Bugfix 2024-11-17 14:31:23 +01:00
Blaž Kristan
84dd26c1b7 Some more optimisations. 2024-11-17 10:47:09 +01:00
Will Miles
a765903a41 Fix array overflow in exploding_fireworks
Attempt to allocate enough room for the "minimum" sparks; and ensure
that we never overrun the allocated array size.

Fixes #4120
2024-11-16 17:10:30 -05:00
Blaž Kristan
25ab381916
Merge pull request #46 from w00000dy/search-keep-mod
Move selected to the bottom in search result
2024-11-16 22:54:11 +01:00
Woody
4d3df5d98f
Fix default/solid not being first 2024-11-16 20:12:29 +01:00
Woody
6fe2024542
move selected to the bottom in search result 2024-11-16 19:53:10 +01:00
maxi4329
7f69a0bc5e removed obsolete code as of #4267 2024-11-16 12:37:24 +01:00
maxi4329
5b829adedb Merge branch '0_15' of https://github.com/maxi4329/WLED into minor-webui-enhancements 2024-11-16 12:24:55 +01:00
netmindz
4cd4c13b2d
Merge pull request #4267 from w00000dy/space
Fix problem with spaces
2024-11-16 07:14:34 +00:00
Blaž Kristan
86be5df475 xml comma bugfix + few optimisations 2024-11-15 19:03:46 +01:00
Blaž Kristan
8c5e0cd4e9 Keep selected FX while searching 2024-11-15 16:01:58 +01:00
netmindz
a9b0b8adc8
Merge pull request #4229 from maxi4329/snodejsversion
specified required nodejs version
2024-11-13 09:20:27 +00:00
Will Miles
ba01cb82f7
Merge pull request #4271 from Aircoookie/4269-crashes-when-using-http-api-within-mqtt
Fix for #4269
2024-11-11 19:53:06 -05:00
Will Miles
223b97b884 handleSet: Fix incorrect response generation
Don't generate a response if there's no HTTP request.

Fixes #4269
2024-11-10 19:30:01 -05:00
Damian Schneider
d437027f26 Replaced single palette cases with an array to consolidate code
- all palettes are defined in palettes.h
- access to fastled palettes as an array to remove the switch cases
- palette createn in json.cpp in a loop instead of repeaded calls to save flash
2024-11-10 22:48:26 +01:00
Frank
9a564ee204
readme.md - link to multi-strip KB page 2024-11-10 14:45:55 +01:00
Will Miles
d37ee89e84 ESP8266PWM: Fix phase shift glitches
In some cases it was possible for the computed phase shift to skip
a cycle.  Update the shift calculation logic to prevent this.
2024-11-09 21:33:58 -05:00
Woody
5de86d3d91
fix problem with spaces 2024-11-09 23:55:09 +01:00
Woody
4b6041302e
fix #4166 2024-11-09 21:59:52 +01:00
Damian Schneider
536444f9d1 fixed palette FX to more closely match original 1D version
- rotation scale is now exactly 180° (divide slider input by 255 instead of 256)
- removed shift offset: offset is now zero at slider 0, to hit 128 on touch input devices is really hard
- added a 90° shift to input rotation, enabling to rotate from 0 to 180° instead of +90 to -90 (which is not useful in 1D)
- changed default settings values to more closely match the old 1D effect
2024-11-09 16:38:18 +01:00
Blaž Kristan
ba5ec57e4d Enumeration support. 2024-11-09 11:33:10 +01:00
Blaž Kristan
9fa53ccf05 Large ledmap support
- add filtering support for readObjectFromFile()
2024-11-09 11:22:38 +01:00
Blaž Kristan
5c2bac4b9d Merge branch '0_15' into 0_15__speed_improvements 2024-11-09 10:53:27 +01:00
Blaž Kristan
ef1e24cec2 Bugfix & code reduction
- correctly clear segment spacing change
- renamed Segment::setUp() to Segment::setGeometry()
- removed WS2812FX::setSegment()
- removed obsolete/unfunctional word clock usermod .cpp file
2024-11-09 10:42:49 +01:00
Frank
001e2ad287 adjust audioreactive for the new FRAME_DELAY logic
minor
2024-11-08 19:35:42 +01:00
Frank
0404ec9881 changes in response to feedback from @willmmiles
* MIN_SHOW_DELAY -> MIN_FRAME_DELAY
* allow up to 250 for target FPS
* minor cleanup
* added specific MIN_FRAME_DELAY for -S2
2024-11-07 23:15:39 +01:00
netmindz
6ff5c88ebf
List ESP32 first 2024-11-07 08:17:08 +00:00
Frank
1e761c31bd simpler hight FPS warning
* removed "use 0 for unlimited"
* added "high FPS mode is experimental" warning
* added "backup first!" warning
* added anchor #backup to sec page
2024-11-06 22:09:33 +01:00
Frank
ab7b2d729e use class="warn" for unlimited mode message 2024-11-05 12:24:20 +01:00
Damian Schneider
271a07a7d6
Merge pull request #4250 from DedeHai/FPS_calc_averaging
Fixed & improved FPS calculation
2024-11-05 08:52:42 +01:00
Frank
029293a086 simplify sheduler logic
* _frametime ensures that effects are not serviced too often
*  MIN_SHOW_DELAY is the minimum allowed FRAMETIME that can be requested by effects
2024-11-04 20:11:10 +01:00
Frank
cf1630a94a 0 FPS = unlimited 2024-11-04 19:49:43 +01:00
Damian Schneider
4634ace74e Added define for bitshift, removed dithering
dithering is not really needed, the FPS_MULTIPLIER is a much better option.
2024-11-04 19:33:42 +01:00
Damian Schneider
3733715184
bugfix
bitshift was still set from testing, forgot to update
2024-11-04 17:38:45 +01:00
Damian Schneider
bf37ac53a3 improved FPS calc resolution, added averaging & multiplier compileflags
Fixed point calculation for improved accuracy, dithering in debug builds only.
Averaging and optional multiplier can be set as compile flags, example for speed testing with long averaging and a 10x multiplier:

-D FPS_CALC_AVG=200
-D FPS_MULTIPLIER=10

The calculation resolution is limited (9.7bit fixed point) so values larger than 200 can hit resolution limit and get stuck before reaching the final value.

If WLED_DEBUG is defined, dithering is added to the returned value so sub-frame accuracy is possible in post-processingwithout enabling the multiplier.
2024-11-04 08:10:05 +01:00
Frank
50934e6840 adressing some review comments
* keep FRAMETIME_FIXED as a fixed value
* remove WLED_FPS_SLOW and FRAMETIME_FIXED_SLOW
* explicit test "(_targetFps != FPS_UNLIMITED)" for debug messages
* don't modify _lastServiceShow in show()
* test for "fps == FPS_UNLIMITED" explicitly, so we could pick a different
 magic number later
2024-11-02 18:16:51 +01:00
Frank
891ea48e11 Merge remote-tracking branch 'upstream/0_15' into framerate_ac015 2024-11-02 17:56:24 +01:00
Frank
70323b9477 rename delay -> frameDelay
Avoiding name collisions with the 'delay' function.
2024-11-02 17:50:30 +01:00
Frank
451cd4c74a Improved framerate control in strip.show(), strip.service()
* separate fps calculation (strip.show) from framerate control (strio.service)
* improved condition for early exit in strip.show
* make MIN_SHOW_DELAY depend on target fps
* strip.show consideres complete time for effect calculation + show; old code wrongly used the time between completion of last show and start of next effect drawing, causing unexpected slowdown
* add "unlimited FPS mode" for testing
* increase warning limits for "slow strip" and "slow effects"
2024-11-01 23:19:38 +01:00
Frank
7d0951a08a
Merge pull request #4243 from MoonModules/AC_0_15_S3-WROOM2
Add support for ESP32-S3 WROOM-2 (solves #4099)
2024-11-01 22:04:21 +01:00
Frank
d98ca9a202 show correct flash mode in WLED_DEBUG 2024-11-01 21:51:46 +01:00
Frank
3c2c5bedc5 LEDPIN --> DATA_PINS 2024-11-01 21:42:54 +01:00
Frank
749d34cd30 pinmanager support for S3 WROOM-2 (pin 33-37 reserved for flash) 2024-11-01 21:31:57 +01:00
Frank
1898be2fe1 S3 WROOM-2 buildenv
this chip has 16MB or 32MB flash, and requires .memory_type = opi_opi
2024-11-01 21:13:43 +01:00
Blaž Kristan
af34da4160
Merge pull request #4231 from Aircoookie/b7
WLED 0.15.0-b7 release
2024-10-30 20:59:00 +01:00
ingDIY
fa053b7e60
Update platformio_override.sample.ini
fixed back U8g2 version
2024-10-29 01:14:02 +01:00
Blaž Kristan
4588219e31 Update changelog 2024-10-28 12:42:53 +01:00
Blaž Kristan
6e89346f00 WLED 0.15.0-b7 release
- fix for #4172
- fix for #4230
- /json/live enabled when WS disabled
2024-10-27 18:47:10 +01:00
Damian Schneider
2703c9899a Bugfix in FX ripple_base() 2024-10-27 15:08:25 +01:00
maxi4329
d05c358fd2 version changed to 20 2024-10-27 11:13:56 +01:00
maxi4329
7c6bc5c421 indened formating 2024-10-26 21:07:17 +02:00
maxi4329
798c398f23 specified required nodejs ver 2024-10-26 20:33:38 +02:00
Blaž Kristan
4cc2cc4ad4 Multiple fixes
- increase WLED_MAX_BUSSES for C3 (fixes #4215)
- fix for #4228
- fix for very long running effect (strip.now, strip.timebase)
- C++ API change to allow `seg.setColor().setOpacity()`
2024-10-26 15:16:11 +02:00
ingDIY
dcfdca6351 cleaned up old references to USE_ALT_DISPlAY that aren't used anymore in the code/source files; fixed readme.md documents and updated instructions; removed referencies to old usermods; fixed invalid filenames; removed referencies to old usermods; checked cycle options; splitted and fixed platformio_override.sample.ini; 2024-10-25 12:14:37 +02:00
Svennte
832599b8c5
Fix alexa devices invisible/uncontrollable (#4214)
Fix for LED and Scenes uncontrollable using Alexa.
Weird behavior regarding to the device names and shared scenes fixed with this.

Seen in issue Aircoookie/Espalexa#228 and fixed from @ams-hh
Tested by myself and works just fine. Created second pull request here because the library seems to be a bit different from the official Espalexa repo.

---------
Co-authored-by: Frank <91616163+softhack007@users.noreply.github.com>
Co-authored-by: Blaz Kristan <blaz@kristan-sp.si>
2024-10-25 09:33:05 +02:00
Will Miles
c81ef2669e
Merge pull request #4223 from willmmiles/f-string-hygiene
Usermod F-string hygiene
2024-10-24 15:23:11 -04:00
Will Miles
19d837c222
Merge pull request #4222 from Aircoookie/esp8266-oappend-fix
Esp8266 oappend fix
2024-10-24 15:22:46 -04:00
Will Miles
4f48ddfaec Replace SET_F with F in usermods
Since oappend() is now strongly typed, pass the correct type.  This is a
step towards removing the extra shim logic on ESP8266.
2024-10-23 21:35:30 -04:00
Will Miles
2e01fe0b5b Revert "Replace SET_F with F in usermods"
This reverts commit 7d067d8c305c3c6f397b6863f6849659a0aadd24.
2024-10-23 21:34:35 -04:00
Will Miles
7d067d8c30 Replace SET_F with F in usermods
Since oappend() is now strongly typed, pass the correct type.  This is a
step towards removing the extra shim logic on ESP8266.
2024-10-23 21:28:21 -04:00
Will Miles
b3b326738c Fix incorrect SET_F calls
Replace with F() or PSTR() as appropriate.
2024-10-23 21:26:40 -04:00
Will Miles
2bb2caf2d2 Enable NON32XFER_HANDLER on ESP8266
This is a platform feature that asks forgiveness for PROGMEM misuse:
it adds a handler such that incorrectly used PROGMEM will work without
crashing, just really, *really* inefficiently.

Given that most of our real-world use cases for PROGMEM strings are
relatively infrequent text calls, we can err on the side of developer
convenience and address performance problems if and when they arise.
2024-10-23 20:01:42 -04:00
Will Miles
2a094883ad Better oappend shim on ESP8266
Detect IRAM pointers if we can't be sure.
2024-10-23 20:01:42 -04:00
Frank
6d1126b8aa
Update audioreactive readme.md
added `-D sqrt_internal=sqrtf` -> needed for good performance
2024-10-22 16:19:46 +02:00
Frank
26a47537f9 AR memory optimization - part 2
shorten strings in UI script - saves a few hundred bytes on RAM
2024-10-22 15:15:14 +02:00
Frank
01d43c69fb AR memory optimization - part 1
allocating FFT buffers late makes up to 16Kb heap available when audioreactive is not enabled.

Already tested in MM fork.
2024-10-22 14:45:32 +02:00
Frank
7db1989093 fix major performance regression in ArduinoFFT
since v2.0.0, we cannot override the internal sqrt function by #define --> moved to build_flags.

Average FFT time on esp32 : 4.5ms --> 1.8ms
2024-10-22 14:42:48 +02:00
Will Miles
32eee3365a PinManager: Make in to namespace
Namespaces are the C++ language construct for grouping global functions.
2024-10-20 11:11:23 -04:00
Will Miles
95b4bde918 UsermodManager: Make into namespace
Namespaces are the C++ language construct for grouping global functions.
2024-10-20 11:11:20 -04:00
Frank
0a97e28aab bugfix: prevent preset loading from resetting other errors
without this fix, any not-yet reported error - like filesystem problems at startup, or out-of-memory - was rest by successfully loading a preset.
2024-10-19 18:43:10 +02:00
1Prototype1
4fa8a3898a Added Distribute for cpal
Added a button to distribute the color markers in palette equally
2024-10-19 00:30:24 +05:30
maxi4329
caa997fff1 removed onkeydown tried to find a replacement for the nbsp 2024-10-18 18:43:41 +02:00
maxi4329
bd68b977d5 minor webui enhancements 2024-10-17 18:07:01 +02:00
Damian Schneider
98a6907976 cleanup and improvement to sin_appros()
-replaced all PI references with M_PI version
-there is no need to do the angle-modulo in float, casting it to an integer does the same BUT it has to be cast to an `int` first, see comment.
2024-10-16 19:53:58 +02:00
Christian Schwinne
e9d2182390
Re-license the WLED project from MIT to EUPL (#4194) 2024-10-16 00:07:19 +02:00
Damian Schneider
5e29f2c1b7 fixed atan2_t
approximation was incorrect, now doing it right.
also removed hypotf() from octopus, saving a little flash.
2024-10-15 20:11:33 +02:00
Damian Schneider
44e28f96e0 Fix for Octopus on ESP32 C3
Apparently the C3 can not convert negative floats to uint8_t directly, casting it into an int first fixes it.
2024-10-15 13:49:58 +02:00
Blaž Kristan
a0e81da8c5
WLED 0.15.0-b6 release (#4180)
* modified Improv chip & version handling
* Update build and changelog
2024-10-14 20:13:59 +02:00
Will Miles
85a7c3c60d
Merge pull request #4189 from dosipod/0_15
Extra comma in the network password fix
2024-10-13 14:41:01 -04:00
AlDIY
01e07ca0bc
Update xml.cpp 2024-10-13 20:34:18 +03:00
Frank
1468ee5fde
Merge pull request #4188 from LuisFadini/0_15_brt_timezone
Added BRT timezone
2024-10-13 11:01:05 +02:00
Blaž Kristan
49f044ecde Better fix for #4154 2024-10-13 10:43:56 +02:00
Luis
37f32ab197 Added BRT timezone 2024-10-12 10:56:40 -03:00
maxi4329
a60231ba59
Fixed the positioning of the "Download the latest binary" button (#4184)
* fixed the positioning of the download button

* fixed space after "Download the latest binary:" disapering after building

* fixed typo

---------

Co-authored-by: maxi4329 <maxi4329>
2024-10-09 22:10:59 +02:00
Blaž Kristan
c8dafede6d
Merge pull request #4183 from PaoloTK/autosegment_outputs_flag
Add WLED_AUTOSEGMENTS compile flag
2024-10-09 22:00:12 +02:00
Blaž Kristan
210191b251 Fix for realtime drawing on main segment 2024-10-07 20:19:07 +02:00
Blaž Kristan
7deea9eb75 Minor button & rover CSS tweak. 2024-10-07 17:52:36 +02:00
Blaž Kristan
5e9a46d54d Fix for #4154 2024-10-07 17:15:35 +02:00
Blaž Kristan
be64930ebb Indentation and shadowed variable. 2024-10-07 16:50:51 +02:00
PaoloTK
488974dd3e change flag 2024-10-07 10:39:45 +02:00
PaoloTK
5975b9125f add autosegment outputs compile flag 2024-10-06 22:56:30 +02:00
Damian Schneider
f301296f1e added rounding to sin8_t
thx to @softhack007
2024-10-06 21:27:58 +02:00
Blaž Kristan
407477dc68 Fix for #4168
- set min value to 0 for disabled ABL
2024-10-06 15:42:58 +02:00
Blaž Kristan
eb5ad232a0 Minor tweaks and whitespace 2024-10-05 23:31:31 +02:00
Blaz Kristan
1b0ce9a123 Fix for #4179 2024-10-05 15:00:58 +02:00
Damian Schneider
7b855c851d Added integer based sin()/cos() functions, changed all trig functions to wled_math
- `sin16_t() / cos16_t()` are faster and more accurate than fastled versions
- `sin_approx() / cos_approx()` are float wrappers for `sin16_t() / cos16_t()` and are accurate enough to replace `sinf()/cosf()`
- `atan2()` is used only in octopus to calculate center offset, new approximated version saves flash
- `tan(), atan(), asin(), acos(), floor(), fmod()` are used only for sunrise/sunset calculation, using wled_math version saves flash
- `beatsinx()` replacements are to make use of new `sin16_t()/sin8_t()` functions to reduce flash size
- Extensively tested surnise/sunset calculation: deviation is 1min. max
- Tested some of the relevant FX and found no visual difference: Julia, 2D Drift, Drift Rose, Ghost rider, Rotozoomer, Palette, Arc 1D expansion
- total flash savings: 7.4k
2024-10-05 12:32:41 +02:00
Damian Schneider
ca062140f3 removed todo. 2024-10-03 19:39:39 +00:00
Damian Schneider
a15c391e6c Improvement to setPixelColorXY and some flash optimisations
- changes to `setPixelColorXY` give an extra FPS, some checks and the loops are only done when needed, additional function call is still faster (force inlining it gives negligible speed boost but eats more flash)
- commented out the unused `boxBlur` function
- code size improvemnts (also faster) in `moveX()` and `moveY()` by only copying whats required and avoiding code duplications
- consolidated the `blur()` functions by enabling asymmetrical blur2D() to replace `blurRow` and `blurCol`
- compiler warning fixes (explicit unsigned casts)
2024-10-03 21:19:34 +02:00
Blaž Kristan
ba636b17a0
Merge pull request #4175 from Xevel/fix_polybus_canshow
fix Polybus canShow
2024-10-03 16:19:44 +02:00
Blaž Kristan
2a07eb84f6
Merge pull request #4174 from Xevel/0_15
Fixed Improv rejecting all properly formatted packets
2024-10-03 16:07:17 +02:00
Nicolas Saugnier
949b9fb10e Fixed Polybus.canShow always returning true on ESP32 2024-10-03 15:21:39 +02:00
Nicolas Saugnier
ae1b6af0d4 Indent formatting... 2024-10-03 11:07:58 +02:00
Nicolas Saugnier
dd27504d30 Fixed Improv rejecting all properly formatted packets. 2024-10-03 11:04:47 +02:00
Blaz Kristan
c30a08cfc5 Merge branch '0_15' of https://github.com/aircoookie/WLED into 0_15 2024-10-02 20:16:41 +02:00
Blaz Kristan
a4c49aa35e Fix for #4005 2024-10-02 20:15:58 +02:00
Blaz Kristan
ba3a61f623 Reduced code size by:
- removing WS2812FX::setMode()
- removing WS2812FX::setColor()
- removing floating point in transition
- color handling modification in set.cpp
- replaced uint8_t with unsigned in function parameters
- inlined WS2812FX::isUpdating()
- (MAY BE BREAKING) alexa & smartnest update
2024-10-02 20:14:25 +02:00
Frank
402fba734a
bugfix for holes in 2D DNA Spiral
Holes were visible at height > 32. Root cause: "lerp8x8" seems to be inaccurate --> replaced by a simple linear calculation.
2024-10-02 16:34:36 +02:00
Frank
262af0678f
colored burst effect bugfix (swapped XY dimensions)
fixing a bug where width and height got swapped (visible on non-square panels)
2024-09-30 18:35:14 +02:00
Frank
3765d558b6
akemi bugfix fix
map2 --> map
2024-09-30 18:26:00 +02:00
Frank
4ed8ded502
Akemi bugfix for panel width > 32
due to a math accident, Akemi did not show proper GEQ bands in its hands when width>32
2024-09-30 17:44:38 +02:00
Blaz Kristan
ee380c5377 Replace uint16_t with unsigned for segment data
swap if statements in color_fade
2024-09-30 16:35:40 +02:00
Frank
7fa25ca7ae pio update - flash size of non-standard boards
* adding missing flash size flags that were lost between 0.14 and 0.15
   (necessary if you don't flash using esptool)
* adding env:esp32dev_16M for 16MB flash (serg74 esp32-16M, twilightlord esp32 16M)
2024-09-30 11:25:58 +02:00
Frank
d3c401ed4e wu_pixel small optimization
5% faster
2024-09-29 19:29:12 +02:00
Will Miles
cb8dae1ddb PWM: Revert always apply dead time 2024-09-29 10:13:19 -04:00
Will Miles
59deebc961 Improve PWM on ESP8266
- Better phase updates without dropping samples
- Make second pin duty cycle always after first, even inverted
2024-09-29 10:00:27 -04:00
Blaz Kristan
0ae73296cf Update comment 2024-09-29 15:19:37 +02:00
Blaz Kristan
8e78fb4caa Merge branch '0_15' into 0_15__speed_improvements 2024-09-29 14:31:00 +02:00
Blaz Kristan
336da25463 Private global _colorScaled 2024-09-29 14:14:07 +02:00
Damian Schneider
ffbc8c5f70 Reverting addition of bool unScale, added new improvements and fixes
- Added pre-calculation for segment brightness: stored in _segBri. The impact on FPS is not huge but measurable (~1-2FPS in my test conditions)
- Removed `bool unScaled` from `setPixelColor()` function again (it has no/minimal impact on speed but huge impact on flash usage: +850 bytes)
- Removed negative checking in `setPixelColorXY()` and replaced it with a local typecast to unsigned, saves a few instructions (tested and working)
- Changed int8_t to int in `moveX()` and `moveY()`
- Removed a few functions from IRAM as they are now not called for every pixel but only once per segment update
- Removed a `virtualWidth()` call from `ripple_base()`
- Bugfix in `mode_colortwinkle()`
2024-09-29 13:55:00 +02:00
Blaz Kristan
10d8cfde85 Fix FX filter bug 2024-09-29 13:00:07 +02:00
Will Miles
3c7f83407b Save a little RAM 2024-09-28 23:16:26 -04:00
Will Miles
fe4b668107 Slightly reduce PWM jankiness 2024-09-28 23:12:03 -04:00
Will Miles
cc87b32206 Support PWM phase shifts on ESP8266
Use the phase-locked soft PWM from the Arduino core to implement the
same PWM phase management as ESP32s are using.  The soft PWM code is
vendored in, as it was previously, to add the NMI workaround from #4035.

Completes #4034
2024-09-28 23:07:28 -04:00
Blaz Kristan
9114867578 Fix compiler error 2024-09-28 18:48:43 +02:00
Frank
6f221852a2 partition file for 512Kb Filesystem, 1.7MB Program
the missing link between 256KB (very small FS) and 700KB (only 100KB extra program)
2024-09-28 18:25:16 +02:00
Blaz Kristan
c842994df5 Pre-calculate virtual
- move SEGCOLOR() to Segment class
- add SEG_H, SEG_W macros
- try to speed up virtualXxxxx()
- compile warning fixes
2024-09-28 18:14:43 +02:00
Damian Schneider
202901b09f bugfix, ESP32 compiler requires the color order to be identical 2024-09-28 15:38:41 +02:00
Damian Schneider
7c0fe1285a updated setPixelColor() and getPixelColor() functions
uint16_t to unsigned to make it consisten throughout the hand-down.
colorFromPaletteWLED now returns uint32_t which saves the conversion to CRGB and back to uint32_t (in most uses at least).
also added (preliminary) CRGBW struct. I tried to use it in place of uint32_t colors but it adds a lot of overhead when passing the struct so reverted to uint32_t in most places.
updated a few FX to use the CRGBW struct and also cleaned some code to improve flash useage.
2024-09-28 15:26:14 +02:00
Frank
6dc2c680c5
Merge pull request #4163 from willmmiles/fix-oappend-merge
Fix oappend merge on 8266 (SET_F to F)
2024-09-28 12:45:37 +02:00
Will Miles
9a4b56db6e Fix incorrect F-strings
A merge issue with end-oappend: some strings did not get correctly
converted from SET_F() to F(), which can cause crashes.
2024-09-27 21:06:21 -04:00
Christian Schwinne
8180f2c742 Bump build tool dependencies 2024-09-27 13:46:01 +02:00
Damian Schneider
a76a895f1d bugfix 2024-09-27 06:17:26 +02:00
Damian Schneider
b404458369 fixed one forgotten replacement of rgb2hsv_approximate 2024-09-26 18:29:31 +02:00
Damian Schneider
c44b9f8659 Merge remote-tracking branch 'upstream/0_15' into 0_15__speed_improvements 2024-09-26 18:07:33 +02:00
Damian Schneider
bef1ac2668 Added HSV2RGB and RGB2HSV functions for higher accuracy conversions
- also added a struct to handle HSV with 16bit hue better (including some conversions, can be extended easily)
- the functions are optimized for speed and flash use. They are faster and more accurate than what fastled offers (and use much less flash).
- replaced colorHStoRGB() with a call to the new hsv2rgb() function, saving even more flash (new function is untested!)
- the 16bit hue calculations result in an almost perfect conversion from RGB to HSV and back, the maximum error was 1/255 in the cases I tested.
2024-09-26 18:06:41 +02:00
Blaz Kristan
906f8fc2e7 Fix C3 compiler issue. 2024-09-25 18:49:10 +02:00
Blaž Kristan
c600c6da63 Bus length fix 2024-09-25 09:33:16 +02:00
Will Miles
e789a18553
Merge pull request #4152 from willmmiles/end_oappend_v2
End oappend v2
2024-09-24 16:56:51 -04:00
Blaz Kristan
3f3c986932 Merge branch '0_15' into end_oappend_v2 2024-09-24 21:43:47 +02:00
Blaz Kristan
3ccc5babc1 Remov superfluous #if 2024-09-23 20:39:16 +02:00
Blaz Kristan
fafb2eba69 Merge branch '0_15' into blending-styles 2024-09-23 20:36:08 +02:00
Blaz Kristan
33cf82a982 Indentations and a few optimisations
Restore addPixelColor() behaviour.
2024-09-23 18:03:17 +02:00
Blaz Kristan
bd7cd32f91 Add mandatory refresh capability to remove type dependency. 2024-09-22 13:56:14 +02:00
Damian Schneider
0a5400263b removed IRAM_ATTR from inlined function
when the function is inlined into a IRAM_ATTR function, it will also reside in IRAM. Forced inlining is recommended by Espressif if I understand this correctly: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/hardware-abstraction.html
2024-09-22 13:52:56 +02:00
Damian Schneider
17d59d3337 adding initialization to vStrip, added comment on padding bytes 2024-09-22 09:02:42 +02:00
Blaz Kristan
9cb3531e2d Remove erroneous file
Fix constant dependancy
2024-09-21 22:24:36 +02:00
Blaz Kristan
b50e6e0d90 Static PinManager & UsermodManager
- saves a few bytes of flash
2024-09-19 21:44:11 +02:00
Damian Schneider
a88436c620 revert removal of adding with saturation, renamed 'fast' to 'saturate'
- blurring now uses desaturated adding: it is faster most of the times and blurring adds scaled colors so should rarely (ever?) saturate, I saw no visual difference in tests.
- formatting
2024-09-19 08:49:18 +02:00
Will Miles
45cf90094a Rename destination for getSettingsJS
Use a name that makes it a bit clearer what the output is.  The new name
is applied consistently through most uses.
Usermods are not yet updated.
2024-09-18 23:35:36 -04:00
Blaz Kristan
ae1df20893 New names 2024-09-18 23:32:15 -04:00
Will Miles
71148740d4 Replace sappend and sappends
Use named functions to describe what's being printed.
2024-09-18 23:31:19 -04:00
Will Miles
4ef583c844 xml: Print optimization
Reduce the total number of calls by using printf_P and skipping atoi().
2024-09-18 23:27:42 -04:00
Will Miles
16f61ea96d Usermod: Implement shim for oappend
Use a static Print* to transform old oappend calls to print calls.
2024-09-18 23:18:52 -04:00
Will Miles
32f9616b6e Remove oappend
Remove the large stack buffer as we're just going to copy it in to a
heap buffer anyways.  Later we can refine the length estimation or use a
rope-style dynamic data structure like DynamicBufferList.
2024-09-18 23:18:51 -04:00
Will Miles
1346eb4f76 tools: Add all_xml fetch script
Useful for checking that I haven't broken anything.
2024-09-18 19:47:52 -04:00
Will Miles
d4268ba070 handleFileRead: Skip duplicate FS check
Since we validate the file existence ourselves, no need to have
AsyncWebServer do it again.
2024-09-18 19:47:51 -04:00
Damian Schneider
696290527a cleanup and improved color_add()
- optimized color_add() again: now it is as fast with preserved ratio scaling than the "fast" variant was before (if no scaling is needed, it is even faster). plus it saves 250 bytes of flash
- bugfix in `color_fade()`
- removed a lot of whitespaces
2024-09-18 22:10:27 +02:00
Damian Schneider
686866c6f9 Merge remote-tracking branch 'upstream/0_15' into 0_15__speed_improvements 2024-09-18 08:10:45 +02:00
Blaz Kristan
72455ccde1 Missing "not" 2024-09-17 19:47:24 +02:00
Blaz Kristan
88fb860568 SAVE_RAM bugfix introduced by #4137 2024-09-17 16:34:38 +02:00
Blaz Kristan
ceed494cf7 Introduce common.js in settings pages 2024-09-17 16:26:11 +02:00
Blaz Kristan
ac8f919304 Serial improvements (can RX, canTX)
PinManager bugfix for unsigned long long
2024-09-17 16:21:52 +02:00
Blaž Kristan
7f1ec4802d
Merge pull request #4137 from felddy/feature/toggle_pallet_sync
Add the ability to toggle the reception of palette synchronizations
2024-09-16 16:19:19 +02:00
Blaz Kristan
d5777b7bce Fix for missing WLED_NUM_PINS check 2024-09-15 20:34:05 +02:00
PaoloTK
e34f179a82 fix pin conflict check logic 2024-09-15 20:27:44 +02:00
Blaz Kristan
6a90b9a512 FX Temperature better ranges 2024-09-15 19:31:14 +02:00
Blaz Kristan
ce5ee65d60 Merge branch '0_15' into blending-styles 2024-09-15 11:05:16 +02:00
Blaz Kristan
65a8dbfe41 FX: Usermod Temperature effect 2024-09-15 11:04:02 +02:00
Blaz Kristan
1ff667b7ef AWS library fix 2024-09-15 10:59:50 +02:00
Blaž Kristan
0806c7fbdb
Merge pull request #4142 from willmmiles/fix-webserver-pin
Fix AsyncWebServer version pin
2024-09-14 22:51:19 +02:00
Blaz Kristan
5708d7a6b8 Build bump, changelog update 2024-09-14 22:30:56 +02:00
Will Miles
2264cc5d10 Use tag to pin AsyncWebServer version 2024-09-14 16:11:46 -04:00
Blaž Kristan
28cb3f9d0c
Merge pull request #4107 from PaoloTK/compile_different_busses
Configure different kinds of busses at compile
2024-09-14 22:02:56 +02:00
PaoloTK
f16ed4697f fix isReadOnlyPin() logic 2024-09-14 18:58:53 +02:00
Blaz Kristan
81e412fe5b Use refernece to avoid ctor/dtor
Use PinManager to determine reserved pins
2024-09-14 14:54:42 +02:00
Damian Schneider
f3137eb0a9 updated Segment::color_from_palette
- gamma correction only where needed
- paletteIndex should be uint8_t (it is only used as that)
note: integrating the new `ColorFromPaletteWLED()` into this would require  a whole lot of code rewrite and would result in more color conversions from 32bit to CRGB. It would be really useful only if CRGB is replaced with native 32bit colors.
2024-09-14 14:49:36 +02:00
Damian Schneider
0e5bd4ed74 remove test printout 2024-09-14 14:11:29 +02:00
Damian Schneider
6a37f25c5d memory improvement: dropped static gamma table
- there already is a method to calculate the table on the fly, there is no need to store it in flash, it can just be calculated at bootup (or cfg change)
2024-09-14 14:10:46 +02:00
Damian Schneider
2afff05014 minor tweak (break instead of continue in setPixelColorXY) 2024-09-14 11:45:27 +02:00
Blaz Kristan
e3d9417b84 Minor fixes
- rely on HAL for RO pins and max pins
- remove isPinDefined() and do clash check inline
- JS fix to use HAL max pins
2024-09-14 11:39:56 +02:00
Blaz Kristan
6a188033c6 Merge branch '0_15' into compile_different_busses 2024-09-14 09:27:37 +02:00
Blaž Kristan
df24fd7bf2
Merge pull request #4129 from Aircoookie/bus-config
Fetch LED types from Bus classes (dynamic UI)
2024-09-13 23:23:08 +02:00
Damian Schneider
d45b4ad134 fixes and consistency 2024-09-13 19:01:54 +02:00
Damian Schneider
ec938f254c removed old code 2024-09-12 21:25:08 +02:00
PaoloTK
fa82e759bd bug fix 2024-09-12 18:27:51 +02:00
PaoloTK
daf0bcfac3 bug fix on pin already defined check 2024-09-12 18:12:38 +02:00
Damian Schneider
09428dcade inlined getMappedPixelIndex, improved color_add, bugfix in colorFromPalette
inlining getMappedPixelIndex gets rid of function entry instructions (hopefully) so it should be faster.
also added the 'multi color math' trick to color_add function (it will not make much difference but code shrinks by a few bytes)
2024-09-12 16:34:55 +02:00
Blaz Kristan
49d51c5af8 Hot 2024-09-12 15:26:26 +02:00
Blaz Kristan
ec7f69d559 Merge branch '0_15' into bus-config 2024-09-12 15:22:56 +02:00
Blaz Kristan
a8c5bf2573 Ease IRAM 2024-09-12 15:22:37 +02:00
Blaz Kristan
f12de61d7f Merge branch '0_15' into bus-config 2024-09-12 15:08:10 +02:00
Blaz Kristan
71fcd6482d Fix CRLF in boblight 2024-09-12 15:07:49 +02:00
Blaz Kristan
e59b38a5d2 Fix unsigned long in debug printf 2024-09-12 15:04:10 +02:00
Damian Schneider
b07658b460 improved Segment::setPixelColorXY a tiny bit
uses less flash so it should be faster (did not notice any FPS difference though)
also cleaned code in ColorFromPaletteWLED (it is not faster, same amount of code)
2024-09-12 14:09:09 +02:00
Blaž Kristan
5b8d9d1510 Merge branch '0_15' into bus-config 2024-09-12 08:49:04 +02:00
Blaž Kristan
6169c458bf Remove void 2024-09-12 08:48:31 +02:00
Blaž Kristan
23400d0449 Conditional IRAM for gamma 2024-09-12 08:30:46 +02:00
Damian Schneider
992d11be10 Improvements in get/set PixelColor()
-calculations for virtual strips are done on each call, which is unnecessary. moved them into the if statement.
2024-09-12 08:28:30 +02:00
Damian Schneider
feac45fd0a improvement in color_add
its not faster but cleaner (and uses less flash)
2024-09-12 07:45:49 +02:00
Damian Schneider
934176818f more improvements to color_scale() now even faster.
tested and working, also tested video
2024-09-12 06:43:20 +02:00
PaoloTK
c5435ec1fa Merge remote-tracking branch 'AC/bus-config' into compile_different_busses 2024-09-11 23:04:37 +02:00
Damian Schneider
c3f472fbcb some improvements to consider
no real difference in FPS but code is faster.
also 160bytes smaller, meaning it is actually faster
2024-09-11 21:41:42 +02:00
Blaz Kristan
1cee1c3562 Merge branch '0_15' into blending-styles 2024-09-11 17:28:48 +02:00
Blaz Kristan
eae5a74a11 color_fade bugfix
impure void remove
optimisations: hot
2024-09-11 17:14:59 +02:00
Blaz Kristan
5df1a223c2 Pre-allocate COM vector 2024-09-11 16:45:39 +02:00
Blaž Kristan
81382a4bc0
Merge pull request #4131 from iammattcoleman/update-temperature-dependency
Temperature usermod: update OneWire to 2.3.8
2024-09-11 16:24:25 +02:00
Matt Coleman
750a429bd4 Temperature usermod: update OneWire to 2.3.8
OneWire 2.3.8 includes stickbreaker's and garyd9's ESP32 fixes:
blazoncek's fork is no longer needed
2024-09-11 06:35:09 -04:00
Matt Coleman
dbe78dff93 Temperature usermod: fix changelog formatting
This change ensures that the dates are displayed on their own lines.
Without the blank lines, many Markdown renderers will append the dates
to the previous bullet point.
2024-09-11 06:35:09 -04:00
PaoloTK
5869627b32 - More optimization on bus configuration logic.
- Renamed LEDPIN to DEFAULT_LED_PIN.
- Removed ability to override DEFAULT_LED_PIN, DEFAULT_LED_TYPE and DEFAULT_LED_COUNT. Use DATA_PINS, LED_TYPES and PIXEL_COUNTS instead.
2024-09-11 01:27:19 +02:00
Frank
5bc5ef0ae8 Update CONTRIBUTING.md - typo 2024-09-10 20:36:48 +02:00
Frank
2cfd2e1410
Update CONTRIBUTING.md - typo 2024-09-10 20:36:18 +02:00
Frank
cce5e8f811 Update CONTRIBUTING.md - adding a hint to avoid force-pushing 2024-09-10 20:34:43 +02:00
Frank
058e66c7fc
Update CONTRIBUTING.md - adding a hint to avoid force-pushing 2024-09-10 20:32:40 +02:00
Felddy
8ae09c3d02
Fix comment alignment 2024-09-10 18:16:00 +00:00
Felddy
83699bc5c3
Add support for toggle of palette sync 2024-09-10 18:02:29 +00:00
Blaz Kristan
3a5eb8c5d2 WLED 0.15.0-b5 release
- Audioreactive usermod always included
2024-09-10 16:07:37 +02:00
Blaz Kristan
fd00e5eaae LED settings text update 2024-09-10 15:23:27 +02:00
Blaz Kristan
20444ee7d5 Debug optimisations 2024-09-10 15:20:34 +02:00
PaoloTK
eb06e575c2 add check for pin reassigned conflict with pin defined for current bus 2024-09-10 01:03:19 +02:00
Blaz Kristan
b4315152e2 Add numPins() 2024-09-08 11:07:53 +02:00
Frank
340a9f8b76 better bugfix for seven-seg-reloaded
* only reject invalid ranges when array access will be actually performed
* fixed another stupid pointer arithmetic error

Hint: I AM NOT THE MAINTAINER of this usermod. I'm just fixing an obvious coding error without knowing what the usermod really does.
2024-09-06 20:09:25 +02:00
Frank
81cec6a25a
Update usermod_seven_segment_reloaded.h - prevent array bounds violation (solves #4121)
I'm not the maintainer of this usermod, but its obvious that the code might overrun array bounds, so fixing this.
2024-09-06 19:36:24 +02:00
Blaz Kristan
c5b31e2f63 Bugfix 2024-09-06 17:56:36 +02:00
Blaz Kristan
0642b17ab0 Bugfix 2024-09-06 17:54:36 +02:00
Blaz Kristan
ac689a9a2e Remove array, un-inline calculateCCT 2024-09-06 12:19:04 +02:00
Blaz Kristan
43cc4ec009 Increase oappend buffer on ESP8266 2024-09-05 22:18:50 +02:00
Blaz Kristan
9cc333b2bd Move LED types to individual bus type
- (credit @netmindz & @willmmiles)
Tuning.
2024-09-05 21:49:27 +02:00
Blaž Kristan
55d98ff935
Merge pull request #4126 from DedeHai/PWM-fixes
fixed offsets and inverted signal plus dead time
2024-09-05 17:26:28 +02:00
Blaz Kristan
dc90a4ed42 Mirroring bugfix. 2024-09-04 23:43:13 +02:00
Frank
ef80abd885 8266 compatibility builds for older chips (another attempt t o solve #3690 and #3685)
some users have reported that releases after 0.14.0 are not working reliably. So we add a few "compat" for 8266 that try to reproduce the buildenv of 0.14.0 as much as possible.

* platform and platform_packages from 0.14.0
* not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
* due to smaller IRAM, we had to move some functions back from IRAM to normal flash (may cause slowdown)
2024-09-04 23:42:58 +02:00
Blaz Kristan
b9080f9479 Mirroring bugfix. 2024-09-04 21:17:21 +02:00
Blaz Kristan
092a5a1ca3 Unsigned fix 2024-09-04 20:54:44 +02:00
Damian Schneider
d3c31c52a2 found a better way of deadTime subtraction, fixed inverted signals 2024-09-04 18:03:52 +02:00
PaoloTK
329173e145 added complete validation logic for pins and types 2024-09-04 13:28:43 +02:00
PaoloTK
8e4f8fcbc8 fix bug in reassignment logic 2024-09-04 13:27:04 +02:00
Frank
c1c707c77a 8266 compatibility builds for older chips (another attempt t o solve #3690 and #3685)
some users have reported that releases after 0.14.0 are not working reliably. So we add a few "compat" for 8266 that try to reproduce the buildenv of 0.14.0 as much as possible.

* platform and platform_packages from 0.14.0
* not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
* due to smaller IRAM, we had to move some functions back from IRAM to normal flash (may cause slowdown)
2024-09-04 11:38:03 +02:00
Blaz Kristan
b1e58dd10d Optimisations
- renamed variables
- some tuning
2024-09-03 22:28:21 +02:00
Damian Schneider
2cc0aceac7 Bugfixes
- fixed maxBri value
- fixed overflow in dead time subtraction
- deadtime and offset now also work if signals are inverted (_reversed)
2024-09-03 19:14:50 +02:00
PaoloTK
d79d5dbadd remove getReadOnlyPins() function 2024-09-03 17:29:38 +02:00
Blaz Kristan
ebd8a10cef Prevent styles on 1px segments 2024-09-03 17:20:16 +02:00
Damian Schneider
be7475fe66 bugfixes, removed debug printout 2024-09-02 22:06:46 +02:00
Damian Schneider
85e2f7eb34 fixed offsets and inverted signal plus dead time 2024-09-02 17:53:15 +02:00
PaoloTK
9bb979f2e8 bug fix 2024-09-01 21:46:30 +02:00
PaoloTK
c942345453 bug fix 2024-09-01 21:35:09 +02:00
PaoloTK
fcc344ba99 add read/only pin logic and check 2024-09-01 21:31:19 +02:00
Blaz Kristan
a3b28871c6 Dirty fix for newer framework 2024-09-01 12:27:41 +02:00
Blaz Kristan
2ca034bfa8 Remove ledc_set_duty_and_update
Add semaphoring
Determine CCT overlap
2024-09-01 11:43:22 +02:00
Blaz Kristan
0d035a08d6 Dithering support & bugfix in UI
Thanks to @dedehai & @zalatnaicsongor
2024-08-30 15:21:16 +02:00
PaoloTK
6655e2664e rebase to bus-config 2024-08-29 13:18:48 +02:00
Blaz Kristan
c51ce2eec7 Fix C/P error
Clarifications
2024-08-27 21:57:00 +02:00
Blaz Kristan
b2e00eb868 Introduce network type (previous virtual)
- phase shifting correction (limit to PWM CCT)
2024-08-27 14:11:56 +02:00
Blaz Kristan
820df0c596 PinManager update
- LEDC: allocate same timer for CCT PWM
- use SOC constants
BusManager update
- use allocateMultiplePins for BusPwm
2024-08-27 00:21:24 +02:00
Blaz Kristan
865e3dcd0c getNumberOfPins 2024-08-25 12:53:23 +02:00
Blaz Kristan
f55e2fc7b8 Merge branch '0_15' into bus-config 2024-08-25 12:41:16 +02:00
Blaž Kristan
cb22e1933e
Merge pull request #4111 from DedeHai/0_15_PWM_CIEbrightnesscalc
replaced PWM LUT with calculation
2024-08-25 12:36:23 +02:00
Blaz Kristan
8818a9e82a Remove erroneous debug 2024-08-24 11:41:23 +02:00
Blaz Kristan
dbb47d506c Bus manager rework
- move macros to constexpr methods
- introduce type capabilities for UI
- add phase shifting (POC) to PWM
- replace PWM CIE LUT with calculated curve
CIE & phase shifting credit @dedehai
2024-08-24 11:35:32 +02:00
Blaž Kristan
e4d5d77347
Merge pull request #4114 from ChuckMash/struct-def
Demystified some byte definitions of WiZmote ESP-NOW message
2024-08-23 07:13:48 +02:00
ChuckMash
dd52124765
Added some byte definitions to WiZmote ESP-NOW message 2024-08-22 20:24:03 -07:00
Blaz Kristan
6f3267aee9 Dynamic bus config
- provide LED types from BusManager for settings
Credit: @netmindz for the idea.
2024-08-22 17:15:12 +02:00
Blaz Kristan
0bbd6b7c4b Minor optimisation
- disable JSON live
- WS error string
- button irelevant check
2024-08-22 17:08:51 +02:00
Damian Schneider
1cc47b02cf use CIE brightness also for ESP8266 2024-08-21 08:06:32 +02:00
Damian Schneider
e7babc071d replaced PWM LUT with calculation 2024-08-20 20:15:17 +02:00
Blaž Kristan
d11ca2e159
Merge pull request #4110 from itCarl/usermod_battery_mqtt_update
Update usermod "Battery" improved MQTT support
2024-08-20 12:51:02 +02:00
Maximilian Mewes
2d6365dc6a Add HA-discovery as config option 2024-08-20 12:37:01 +02:00
Maximilian Mewes
cc24119a59 remove unnecessary comments 2024-08-19 22:22:46 +02:00
Maximilian Mewes
b8f15333d8 update readme.md 2024-08-19 22:12:21 +02:00
Maximilian Mewes
e5a426419c Improve mqtt support, add battery percentage and voltage 2024-08-19 22:07:08 +02:00
Blaž Kristan
8a1df1e700
Merge pull request #4093 from axlan/pixel-dice-usermod
Added a usermod for interacting with BLE Pixels Dice.
2024-08-19 05:39:35 +02:00
Blaž Kristan
cc298f56e2
Merge pull request #4081 from RobinMeis/0_15
Allow lower values for touch threshold
2024-08-18 13:49:03 +02:00
Robin Meis
665693a513 Remove minimum threshold according to https://github.com/Aircoookie/WLED/pull/4081#issuecomment-2295198219 2024-08-18 13:31:14 +02:00
Blaž Kristan
c35e82e59f
Merge branch '0_15' into pixel-dice-usermod 2024-08-18 13:20:45 +02:00
Blaž Kristan
72d38f4cff
Merge pull request #3539 from Liliputech/pov_display
Added POV image effect
2024-08-18 13:15:34 +02:00
Blaz Kristan
f6c47ac19c Fix some compiler warnings 2024-08-18 10:45:16 +02:00
Blaz Kristan
0430dc5a1f Merge branch '0_15' into blending-styles 2024-08-17 20:55:56 +02:00
Blaž Kristan
27bec89386
Merge pull request #4106 from srg74/patch-1
correct spelling error xml.cpp
2024-08-17 20:54:58 +02:00
srg74
79b3ce141c
correct spelling error xml.cpp 2024-08-17 14:42:44 -04:00
Blaz Kristan
011afd0910 Merge branch '0_15' into blending-styles 2024-08-17 15:24:20 +02:00
Blaz Kristan
8d00e4d31d Save some tiny amounts of RAM
- use `-D WLED_SAVE_RAM`
2024-08-17 15:09:41 +02:00
Blaž Kristan
8688777ae1
Merge pull request #4103 from netmindz/FX-cleanup
Remove repeating code to fetch audio data
2024-08-16 17:39:49 +02:00
Frank
198aceee07
Merge pull request #4104 from FreakyJ/Fix-Bug-#3809
Fixes #3809 Loxone JSON parser doesn't handle lx=0 correctly
2024-08-16 02:04:00 +02:00
FreakyJ
ee1bf1c221
#3809 Loxone JSON parser doesn't handle lx=0 correctly 2024-08-15 20:18:06 +02:00
Will Tatam
24ecf1a166 Move getAudioData to static 2024-08-15 17:58:19 +01:00
Frank
5cb49c86a0
Merge pull request #4090 from willmmiles/ino-to-cpp
Rename wled00.ino to wled_main.cpp
2024-08-15 18:23:53 +02:00
Blaz Kristan
9940d2590b Arc expansion getPixelColor fix. 2024-08-15 17:22:59 +02:00
Blaz Kristan
577fce69e2 MQTT unification and cleanup 2024-08-15 16:18:34 +02:00
Will Tatam
e68375a71e Remove repeating code to fetch audio data 2024-08-15 09:08:57 +01:00
Blaž Kristan
fe7fb6c7a9
Merge pull request #4092 from Aircoookie/sm16825
SM16825 support
2024-08-14 22:21:01 +02:00
Blaz Kristan
cec67d8eff Const and 2D box blur
- added 2D blur
2024-08-14 22:15:48 +02:00
Frank
2443e2ec7c wled00 -> wled_main 2024-08-14 11:16:46 +02:00
Frank
bcf862044a Update wled00.cpp
* added #include <Arduino.h> - this is basically what the preprocessing tool (wled.ino -> wled00.ino.cpp) does
* added a comment that Arduino IDE is not supported, use platformIO.
2024-08-13 22:21:21 +02:00
jdiamond
b73f049484 Clean up addEffect() changes. 2024-08-13 04:40:59 +00:00
jdiamond
cde5314d41 Add "dice" to environment names, and add more information about fitting in a 4MB partition. 2024-08-11 01:23:41 +00:00
Arthur Suzuki
ed5eb28228
Added POV image effect
Setup is really easy, after first boot and WiFi/LEDs setup:
go to wled.local/edit and upload a couple image to WLed's filesystem.
Only PNG is supported right now, further support for GIF is planned.
The image should be as wide as the 1D segment you want to apply to.

When done, go to the Effect page on the UI, select "POV Image" effect.

You could also update the image with a post to the JSON-API like this:
curl -X POST http://[wled]/json/state -d '{"seg":{"id":0,"fx":114,"f":"/axel.png"}}'

The segment should move at around 120RPM (that's 2revolutions per seconds) for an image to showup.
More informations and pictures here : https://lumina.toys
2024-08-10 00:03:55 +02:00
Frank
db5e66a9b0 playing with Fire2012
* speedup: add functions to only blur rows or columns (50% faster)

* fire2012: tinkering with bur options. Vertical blur only when slider < 64 (faster); extra blur for  slider values >192 (bush burn)
2024-08-09 12:53:41 +02:00
Blaz Kristan
77723b615f Fix compiler warning 2024-08-08 21:10:27 +02:00
jdiamond
96c7716d3e Added a usermod for interacting with BLE Pixels Dice. 2024-08-08 03:13:33 +00:00
Blaz Kristan
ea80c1ed83 Swap WW & CW 2024-08-07 22:39:31 +02:00
Blaž Kristan
7d7b7c1e25
Merge pull request #4088 from willmmiles/stress-testing-scripts
Add stress testing scripts
2024-08-05 21:05:42 +02:00
Blaž Kristan
9d860c265c
Merge pull request #4089 from willmmiles/improved-locking
Improve jsonBufferLock management
2024-08-05 21:04:24 +02:00
Blaz Kristan
d234b4b0f1 SM16825 support
- add WW & CW swapping
2024-08-05 20:56:12 +02:00
Blaz Kristan
e1598a9966 Merge branch '0_15' into blending-styles 2024-08-05 16:47:25 +02:00
Blaz Kristan
e82f38e277 Tuning 2024-08-05 16:42:21 +02:00
Will Miles
1d27aa2f18 Move .ino to .cpp
This fixes platformio continually recompiling this file.
2024-08-04 15:47:02 -04:00
Will Miles
113dbbdf94 Use DEBUG_PRINTF_P for jsonBufferLock
Tiny code space usage reduction.
2024-08-04 15:27:23 -04:00
Will Miles
e701b5b5eb util: Print locking module when JSON lock fails
For debugging, also log who was trying to lock when it was contended.
2024-08-04 15:27:23 -04:00
Will Miles
6f01896d04 requestJSONBufferLock: Fix locking implementation
On ESP8266, it isn't permissible to call delay() in system context;
ensure this is legal before waiting.

On ESP32, use an operating system mutex to ensure consistent variable
state in a multicore environment, and manage the wait without needing
to loop.
2024-08-04 15:27:18 -04:00
Will Miles
5582bbac60 stress_test: Add code for logging responses 2024-08-04 13:47:37 -04:00
Blaž Kristan
d2401a212a
Merge pull request #4082 from PaoloTK/fix_esp32c3_pwm_bit_depth
Fix incorrect PWM bit depth on Esp32 with XTAL clock
2024-08-04 17:10:21 +02:00
Blaz Kristan
52548542d2 Remove clock/max bit overrides
Move contants into bus manager
2024-08-04 17:05:47 +02:00
Will Miles
509cbdf476 Add UDP test code
Courtesy of @_tvk_ on Discord
2024-08-04 09:57:01 -04:00
Will Miles
5a6ebd6657 stress_test: Allow replication argument 2024-08-04 09:57:01 -04:00
Will Miles
541d3f286a stress_test: Make it worse
Read 40 copies!
2024-08-04 09:57:01 -04:00
Will Miles
0191af412b stress_test: Add small JSON target
Good for measuring quick response performance
2024-08-04 09:57:01 -04:00
Will Miles
abcd2a2d01 tools/stress_test: Allow command line target spec 2024-08-04 09:57:01 -04:00
Will Miles
91efcb910b stress_test: Add a larger JSON target 2024-08-04 09:57:01 -04:00
Will Miles
e9b7320d1c Add preliminary web stress test script 2024-08-04 09:57:01 -04:00
PaoloTK
779744bd8e typo in comment 2024-08-03 15:56:29 +02:00
PaoloTK
1123d85fd2 removed float math and log(), added max bit width 2024-08-03 15:54:39 +02:00
PaoloTK
5c247d2833 first implementation 2024-08-01 20:25:18 +02:00
Robin Meis
17fdb4f5c9 Allow lower values for touch threshold 2024-08-01 19:49:47 +02:00
Blaž Kristan
365c1987ed Missing clipping fix
- small speed optimisations
2024-08-01 10:24:40 +02:00
Blaz Kristan
c03422ee37 Push variants 2024-07-30 17:26:50 +02:00
Frank
ef8f23ce90
Merge pull request #4073 from axlan/devcountainer-runargs
Add example runArgs to devcountainer to access serial port (for firmware upload) directly from the devcontainer.
2024-07-30 12:45:16 +02:00
jdiamond
050f7ebddf Add note for Windows. 2024-07-29 18:00:46 +00:00
jdiamond
10fdf46410 Clarify security implicatations. 2024-07-29 17:34:10 +00:00
Blaž Kristan
49976ae35a
Merge pull request #4078 from apanteleev/fire-blur-control
Add a parameter for blur amount in the Fire 2012 effect
2024-07-29 07:31:33 +02:00
Frank
21afb05409
Merge pull request #4077 from adrianschroeter/0_15
2DGEQ: Getting same sized bar width on 32x32 display, and better distribution of bar width in general.
2024-07-28 17:35:08 +02:00
Alexey Panteleev
0af1ec3bde Added a parameter for blur amount in the Fire 2012 effect. 2024-07-27 12:33:59 -07:00
Adrian Schröter
343d766ddd
2DGEQ: Getting same sized bar width on 32x32 display
before a x=32 (n times of 16) had not equal sized bars, but first was
a single pixel and later a bar had 3 pixel width. This solves it to
have always 2 pixel sized bars.

I have to admit that I did not test with other pixel dimensions.
2024-07-27 12:44:16 +02:00
jdiamond
02cae2e61e Add example runArgs to devcountainer to access serial port. 2024-07-25 04:47:44 +00:00
Blaz Kristan
1975c9c34a Merge branch '0_15' into blending-styles 2024-07-24 14:18:16 +02:00
Frank
42decbddd9
Merge pull request #4060 from DedeHai/0_15_bootdelay
boot-up delay to fix wifi not starting in some setups

use
`-D WLED_BOOTUPDELAY=500` (or some other delay you want, in milliseconds)
in platformio env definition to add 500ms of delay before hardware init.
2024-07-22 11:25:00 +02:00
Blaz Kristan
d88bb3c668 Merge branch '0_15' into blending-styles 2024-07-18 20:26:51 +02:00
Blaz Kristan
b71467b9be LED settings remove output bugfix 2024-07-17 22:24:08 +02:00
Damian Schneider
ac503ef72e adding boot-up delay define
use
-D WLED_BOOTUPDELAY=500
in platformio env definition to add 500ms of delay before hardware init.
2024-07-17 18:54:33 +02:00
Frank
ea608cecb0
Merge pull request #3962 from gaaat98/esp8266-audioreactive-sync
ESP8266 audioreactive UDP sound sync ported from MoonModules/WLED - receive only
2024-07-13 10:16:07 +02:00
Frank
2e266ec945 use fixes-size stack buffer
... protected against array overflow due to previous "if (packetSize <= UDPSOUND_MAX_PACKET)"
2024-07-13 09:55:59 +02:00
Blaž Kristan
bec1adf7ad
Merge pull request #4035 from willmmiles/esp8266_pwm_fix 2024-07-13 07:13:09 +02:00
Will Miles
2fc2f47d06 ESP8266PWM: Annotate sources
Add additional clarification as to the original source URL and the
specific local patches.
2024-07-12 19:16:31 -04:00
Frank
3a8e19d1b4 audiosync receive improvements (maintainer edit)
* fixed a few typo's in comments
* fixed 8266 specific warning about 'comparison of integer expressions of different signedness'

based on recommendations made by @willmmiles:
* make sure that audioSyncPacket is the same size  (44bytes) on all platforms
* use static buffer for receiving (avoids heap fragmentation)
* copy receive buffer to local audioSyncPacket struct - avoids alignment problems
* esp32 only: to stay in sync with UDP, Udp.flush() is needed when Udp.parsePacket() is _not_ followed by Udp.read()
2024-07-12 22:09:52 +02:00
gaaat98
cc9db0220c
removed audioreactive usermod build flag 2024-07-12 16:59:08 +02:00
Blaz Kristan
13ed78be96 Merge branch '0_15' into blending-styles 2024-07-11 21:30:10 +02:00
Blaz Kristan
cd1ede38a7 Size & speed optimisations 2024-07-11 21:22:58 +02:00
Blaž Kristan
1ec68c428a
Merge pull request #4051 from Nickbert7/patch-1
Fix typo in "Battery" usermod (Build Failed)
2024-07-11 18:52:30 +02:00
Niklas Fäth
f6ed3bc9db
Fix typo in "Battery" usermod (Build Failed) 2024-07-11 13:56:33 +02:00
Blaz Kristan
34cdda2e28 Merge branch '0_15' of https://github.com/aircoookie/WLED into 0_15 2024-07-10 15:08:34 +02:00
Blaž Kristan
4ab2c907f5
Merge pull request #4048 from willmmiles/mpu6050-crash-fix
Mpu6050 usermod crash fix
2024-07-10 06:31:41 +02:00
Will Miles
8632d99341 MPU6050: Fix crash when enabling
Avoid reconfiguring the device during web server context, which can
trigger a yield().  Instead defer the device initialization to loop().
2024-07-09 18:49:53 -04:00
Blaz Kristan
efa32ed4f6 Size optimisations 2024-07-09 21:50:27 +02:00
Blaz Kristan
551b8af76d Hide 2D effects on 1D segments 2024-07-09 19:00:32 +02:00
Blaz Kristan
887254f5da Bugfixes
- LED memory calculation (not UI)
- potential fix for #4040
- compiler warning in FX
2024-07-07 14:18:51 +02:00
Blaz Kristan
0275bd1d45 On/Off blending respected 2024-07-05 21:23:59 +02:00
Blaz Kristan
f3891c305d Merge branch '0_15' into blending-styles 2024-07-05 21:22:29 +02:00
Blaz Kristan
5874b78349 Bugfixes
- FX: Breathe, Meteor
- IR: use Segment
- UI: palette search, LED settings
2024-07-05 21:22:05 +02:00
Blaž Kristan
a812fc07f2
Merge pull request #4033 from adamsthws/0_15_internal_temp_usermod_improvement_new
Usermod Updated: Internal Temperature V2
2024-07-03 07:12:52 +02:00
Adam Matthews
78e7312adf Update usermod internal temperature
Enabled the storing the currently active preset or playlist for it to be restored later
2024-07-01 00:26:03 +01:00
Blaz Kristan
593970ed6d Merge branch '0_15' into blending-styles 2024-06-30 10:45:54 +02:00
Blaz Kristan
693bf4816b Minor tweaks. 2024-06-30 10:44:25 +02:00
Blaz Kristan
b8b11880b0 Merge branch 'main' into 0_15 2024-06-29 20:27:37 +02:00
Blaz Kristan
0ff4016250 WLED 0.15.0-b4 release
- LED settings update (limit to available outputs)
- minor fixes
2024-06-29 20:22:47 +02:00
Blaz Kristan
e753f3849e Revert "WLED 0.15.0-b4 release"
Messed FX_fcn.cpp CRLF conversion
2024-06-29 20:18:30 +02:00
Blaz Kristan
7b248c8fb2 WLED 0.15.0-b4 release
- LED settings update (limit to available outputs)
- minor fixes
2024-06-29 16:36:27 +02:00
Blaž Kristan
f0e4dd90ee
Merge pull request #4013 from wesleygas/0_15
Add LD2410 sensor usermod
2024-06-29 16:21:21 +02:00
Blaž Kristan
c540ec5417
Update readme.md 2024-06-29 16:17:46 +02:00
Blaž Kristan
3615ab535b
Merge pull request #4028 from Aircoookie/dependabot/pip/urllib3-1.26.19
Bump urllib3 from 1.26.18 to 1.26.19
2024-06-29 16:11:39 +02:00
Blaž Kristan
b8d6ebe882
Merge pull request #4023 from Aircoookie/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-06-29 16:11:26 +02:00
Blaž Kristan
1f27872294
Merge pull request #3995 from Aircoookie/dependabot/pip/requests-2.32.0
Bump requests from 2.31.0 to 2.32.0
2024-06-29 16:10:58 +02:00
Adam Matthews
3815516022 Fixes to feature update for Internal Temperature usermod
Simplified the code by removing an unnecessary function definition and instead using direct assignment in the place where the function was previously called.
2024-06-28 16:12:56 +01:00
Adam Matthews
a1dfdced31 Fixes to feature update for Internal Temperature usermod
- Updated all doubles to floating-point literals by adding explicit `f` suffix

- Removed all remaining html from readme markdown documentation.
2024-06-28 15:47:54 +01:00
Will Miles
ff39a8db3f Fix PWM crashes on ESP8266
Vendor in the ESP8266 Arduino core PWM library, with a fix for a nasty
NMI crash bug.  Sometimes the NMI return instruction seems to fail,
resulting in an infinite loop as the PC gets stuck.  Work around this
by backing up and restoring the PC if needed.
2024-06-27 21:30:05 -04:00
Adam Matthews
9877e899e0 Fixed images in readme
Github flavoured markdown didn't work as expected.
2024-06-27 17:52:41 +01:00
Adam Matthews
bc4a6138b1 Fixes to feature update for Internal Temperature usermod
Applied various fixes as advised by @blazoncek

Thankyou for the advice!

- Updated float: 95.0 > 95.0f

- Updated type: const > constexpr

- Comments clarified

- Preset setting: `-1` > `0`
2024-06-27 17:33:37 +01:00
Adam Matthews
f825cab54a Usermod Updated: Internal Temperature V2
# Added high temperature indicator/action...

- A configurable preset is activated when the internal temperature raises above a configurable threshold temperature.

- When the internal temperature falls back below the threshold, the previously active preset is re-activated.

- To prevent frequent toggling between states when the temperature is close to the threshold, the reset threshold is slightly lower than the activation threshold to provide a small buffer.

- Reset threshold is automatically calculated to be two degrees lower than whatever the activation threshold is set to.

- To prevent the user setting the loop interval too low, a minimum allowable interval has been added.
2024-06-26 20:27:53 +01:00
Blaž Kristan
57b01c2711
Merge pull request #4030 from rorosaurus/0_15
add ETH support for LILYGO-POE-Pro
2024-06-26 12:01:36 +02:00
Blaž Kristan
5f3e3d7796
Merge pull request #4017 from xkvmoto/patch-2
Update usermod_sn_photoresistor.h
2024-06-26 11:56:15 +02:00
Blaz Kristan
bee75a4508 Hide 2D blending styles on non-2D set-up 2024-06-23 14:14:26 +02:00
Blaz Kristan
a4ac444bda Merge branch '0_15' into blending-styles 2024-06-23 14:10:43 +02:00
Blaz Kristan
d13b8c8421 Move LED_BUILTIN handling to BusManager class
- reduce max panels
2024-06-23 14:09:18 +02:00
Blaz Kristan
0af3063127 Enhancements
- edit WiFi TX power (ESP32)
- keep current ledmap ID in UI
- limit outputs in UI based on length
- wifi.ap addition to JSON Info
- relay pin init bugfix
- file editor button in UI
2024-06-23 14:08:18 +02:00
Rory Hayes
17e1975dd8 add ETH support for LILYGO-POE-Pro
Also includes minor spelling corrections for CONTRIBUTING.md
2024-06-18 16:07:46 -07:00
dependabot[bot]
166eeacab9
Bump urllib3 from 1.26.18 to 1.26.19
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.18 to 1.26.19.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/1.26.19/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.18...1.26.19)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 01:26:00 +00:00
Blaz Kristan
296df2660a Merge branch '0_15' into blending-styles 2024-06-16 18:22:21 +02:00
dependabot[bot]
017169f1a1
Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-16 12:12:05 +00:00
Blaz Kristan
ed0e73803f Minor tweaks for ESP8266
- update was restarting device on some occasions
- a bit of throttling in UI
2024-06-14 22:12:09 +02:00
Blaz Kristan
f4475b9d2a Dynamic parallel I2S output
- update NeoPixelBus to v2.8.0
- use single/mono I2S + 4x RMT for 5 outputs or less
- use parallel x8 I2S + 8x RMT for >5 outputs (limit of 300 LEDs per output)
2024-06-12 18:00:00 +02:00
Brandon502
b9849da66e Added Cube Mapping tool 2024-06-08 13:16:56 -04:00
xkvmoto
8a1df9afee
Update usermod_sn_photoresistor.h
Allow to configure the analog input pin for the Photoresistor.
2024-06-07 19:50:45 +02:00
wesleygas
9cfb56d9c6 Add LD2410 sensor usermod 2024-06-04 21:39:31 -03:00
Blaz Kristan
25ade86994 Filter/sort bugfix 2024-06-04 17:05:11 +02:00
Blaz Kristan
da484b07f5 Use transition style for palette and color change
- as requested by @willmmiles & @tkadauke
2024-06-02 21:30:44 +02:00
Blaz Kristan
20c0916adc Merge branch '0_15' into blending-styles 2024-06-02 21:25:24 +02:00
Blaz Kristan
c10ec2962b Fix custom palette reorder on search 2024-06-02 21:25:05 +02:00
Blaz Kristan
de5632b1cf Merge branch '0_15' into blending-styles 2024-06-01 17:54:57 +02:00
Blaž Kristan
1bb06106fd
Merge pull request #4001 from DevilPro1/smartnest
Fixed code of Smartnest and updated documentation
2024-06-01 17:52:55 +02:00
Blaž Kristan
bc18cdbeea
Merge pull request #4010 from cstruck/fix_esp32_s3_zero_wifi_not_working
fix: esp32 s3 zero rev v0.2 wifi not working
2024-06-01 14:43:33 +02:00
Christian Struck
67df5d6dcc
fix: ESP32-S3 rev v0.2 seems to need the wifi fix 2024-06-01 09:09:01 +02:00
Blaz Kristan
68a7282b27 Speed and size optimisations in FX.cpp
- replace uint8_t and uint16_t with unsigned
- replace in8_t and int16_t with int
- reduces code by 1kB
- WARNING may break effects that rely on overflow/narrow width (most fixed)
2024-05-31 15:58:18 +02:00
Blaz Kristan
5732b66c5a Add UI error description. 2024-05-31 15:50:10 +02:00
devilpro1
f1cce8ef46
Update readme.md 2024-05-29 20:14:12 +02:00
devilpro1
e47932c9aa
Update usermod_smartnest.h 2024-05-29 20:13:37 +02:00
Blaž Kristan
3a70fb0e15
Merge pull request #3897 from muebau/fix_usermod_tetisai
reset usermod TetrisAI back to initial version
2024-05-27 20:22:26 +02:00
muebau
d5da84dcb2 add more information of the partition table to readme 2024-05-27 18:36:48 +02:00
muebau
1bd051d703 fixed link to partition table 2024-05-27 18:15:39 +02:00
muebau
abb55f8e4b center the canvas if the segment exceeds the maximum width or height 2024-05-27 13:29:03 +02:00
muebau
46f6a257d0 fixed another throw statement 2024-05-26 22:08:01 +02:00
muebau
97e4eec5be avoid exceptions to stay compatible with ESP8266
add limitaion information to readme
2024-05-26 21:00:13 +02:00
muebau
69b99abb7d improved readme 2024-05-26 15:46:23 +02:00
devilpro1
08f6d5a683
Add files via upload 2024-05-26 12:46:45 +02:00
devilpro1
627bea30ed
Delete usermods/smartnest directory 2024-05-26 12:46:34 +02:00
muebau
caf0a5bbe8 changed the last double variables and values to float and add more hints to readme 2024-05-26 11:01:57 +02:00
Blaz Kristan
501f988b0f ESP-NOW usermod hook 2024-05-25 20:01:38 +02:00
muebau
5f0c6fce74 fixed static or global variables
use of strip.now instead of millis()
use float instead of double
respond to changes in segment size
make effect usable with multible segments
2024-05-23 18:51:55 +02:00
muebau
78089107b7 Merge remote-tracking branch 'upstream/0_15' into fix_usermod_tetisai 2024-05-23 16:15:35 +02:00
Blaž Kristan
f3b0906cea
Merge pull request #3993 from gsieben/0_15
Update wled.h regarding OTA Password
2024-05-21 21:22:35 +02:00
Blaž Kristan
9f581c6181
Merge pull request #3994 from gsieben/0_15-Usermod-BME68X-Pull-Request
Usermod BME68X Sensor Implementation rebased for WLED 0.15
2024-05-21 21:20:47 +02:00
Blaž Kristan
31b232d3f3
Merge pull request #3977 from LordMike/feature/aht10_usermod
Add a usermod for AHT10, AHT15 and AHT20 temperature/humidity sensors
2024-05-21 21:20:03 +02:00
Blaž Kristan
77e6a6de61
Revert .gitignore 2024-05-21 18:23:25 +02:00
Blaž Kristan
85702a8142
Merge branch '0_15' into feature/aht10_usermod 2024-05-21 18:21:16 +02:00
Blaž Kristan
0bcdc9641d
Merge pull request #3968 from adamsthws/0_15_battery_usermod_readme
Update Battery usermod documentation
2024-05-21 18:17:08 +02:00
Blaž Kristan
bfd1bdfc64
Merge branch '0_15' into 0_15-Usermod-BME68X-Pull-Request 2024-05-21 18:14:23 +02:00
Blaž Kristan
c1fed6d469
Merge pull request #3986 from LordMike/feature/ina226_usermod
Add INA226 usermod for reading current and power over i2c
2024-05-21 18:12:03 +02:00
Gabriel Sieben
79ffe021e4
Update usermod_bme68x.h
One error message was in German
2024-05-21 11:41:57 +02:00
dependabot[bot]
a1c348b365
---
updated-dependencies:
- dependency-name: requests
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 05:40:22 +00:00
Gabriel Sieben
904b1f114b
Merge branch 'Aircoookie:0_15' into 0_15 2024-05-20 22:30:28 +02:00
Gabriel Sieben
63f481d498
Update wled.h
Accidentally included changes removed.
2024-05-20 22:09:20 +02:00
Gabriel Sieben
fc5c19788e
Update usermod_bme68x.h 2024-05-20 14:49:05 +02:00
Gabriel Sieben
56e0bde8ab Rebase of the user mode BME68X sensor in WLED 0.15 2024-05-20 14:45:01 +02:00
Gabriel Sieben
db2cdca71b Revert "First implementation of the user mods for the BME68X sensor in WLED 0.15"
This reverts commit faa2fba6b94ba86a48cd374a4090112f39b3bb6d.
2024-05-20 14:25:08 +02:00
Gabriel Sieben
faa2fba6b9 First implementation of the user mods for the BME68X sensor in WLED 0.15 2024-05-20 14:10:25 +02:00
Gabriel Sieben
f727ea2874 Update wled.h
OTA_PASS
2024-05-20 13:13:40 +02:00
Blaž Kristan
4a7ef07089 Fix for #3991 2024-05-20 12:24:26 +02:00
Michael Bisbjerg
0df726cdab Add note to platformio override sample 2024-05-18 15:52:01 +02:00
Blaz Kristan
2f6f0d2f3e WLED 0.14.4 2024-05-18 15:17:08 +02:00
Blaz Kristan
fae5938b0a Build bump, changelog update 2024-05-18 13:01:28 +02:00
Blaz Kristan
2ec3639900 Merge branch 'main' into 0_15 2024-05-18 11:24:18 +02:00
Blaz Kristan
4513404629 Fix for #3987 2024-05-18 11:15:16 +02:00
Blaz Kristan
13bfda56ef Auto segment creation bugfix
- additional debug
- minor optimisation
2024-05-18 11:11:40 +02:00
Michael Bisbjerg
075c164407 Fix bug in triggered measurements 2024-05-17 15:03:56 +02:00
Michael Bisbjerg
dcb5049f97 Move to individual settings for samples and conversion time 2024-05-17 14:36:27 +02:00
Michael Bisbjerg
d24cf14009 Triggered & continuous modes 2024-05-17 14:36:27 +02:00
Michael Bisbjerg
3d34802ab2 Initial ina226 2024-05-17 14:36:27 +02:00
Blaz Kristan
2aec21a6d0 Palette loading optimisation
- fixes #3978
- FX: Firenoise can use selected palette
2024-05-16 06:23:15 +02:00
Adam Matthews
19ccff9ff1
Merge branch '0_15' into 0_15_battery_usermod_readme 2024-05-15 22:15:18 +01:00
Michael Bisbjerg
1dd9c6754c Cleanup unecessary struct 2024-05-15 21:32:08 +02:00
Michael Bisbjerg
f9467ceaf1 Fix state issue on change reporting, add override sample ini 2024-05-15 21:26:30 +02:00
Blaz Kristan
ccce0f2d3b Merge branch '0_15' into blending-styles 2024-05-15 20:59:41 +02:00
Michael Bisbjerg
f51da4f0c4 Change reporting to be on significant changes 2024-05-15 18:56:45 +02:00
Michael Bisbjerg
2eff389fff Handle feedback
- Reduce some strings
- Use an unnamed struct to pack the bitfield instead
2024-05-15 18:44:36 +02:00
Blaz Kristan
77ca2ec0e9 Compiler warning fix 2024-05-15 15:35:14 +02:00
Blaz Kristan
77e6ea8a6f Palette loading optimisation
- fixes #3978
- FX: Firenoise can use selected palette
2024-05-15 15:34:53 +02:00
Frank
e33299bbd7
Merge pull request #3961 from Brandon502/0_15
Added Pinwheel Expand 1D ->2D effect mapping mode
2024-05-15 14:22:10 +02:00
Michael Bisbjerg
74e273274c Replace 5 booleans with 1 byte flags field 2024-05-14 23:15:59 +02:00
Michael Bisbjerg
02bf5902f0 Add MQTT and HASS support for AHT10 2024-05-14 22:57:19 +02:00
Blaž Kristan
5f41de8938
Merge pull request #3966 from LordMike/feature/bme280_changeable_i2c
Add changeable i2c address to BME280 usermod
2024-05-14 19:39:42 +02:00
Michael Bisbjerg
f71d839009 Address comments 2024-05-14 18:02:39 +02:00
Brandon502
3cb6b17316 Pinwheel fix 2024-05-14 11:46:52 -04:00
Brandon502
c0cb677a4c Pinwheel cleanup 2024-05-14 11:30:33 -04:00
Frank
a5a6a8eaee pinwheel : fix holes on large matrix, minor code cleanup
there were still two holes in my 52x52 setup --> added "XL" size for bigger than 50x50 - achieves 18fps on 52x52
2024-05-14 11:30:25 +02:00
Frank
ecb861de56 pinwheel code cleanup
reducing code duplication between sPC and gPC
2024-05-14 10:36:50 +02:00
Brandon502
1d20f18d3f Pinwheel bugfix
Fixed getPixelColor.
2024-05-13 17:43:31 -04:00
Michael Bisbjerg
68f6b3452e Initial implementation of the AHT10/AHT15/AHT20 sensors 2024-05-13 23:12:57 +02:00
Michael Bisbjerg
60075f6e8c Avoid storing the settings of bme280 globally 2024-05-13 20:22:31 +02:00
Frank
1d7789f544 pinwheel bugfixing
* setPixelColor: ensure that 0/0 is used
* getPixelColor: accuracy improvements

unfortunately, "scrolling" audioreactive effects are still not working properly - they end after 1/4 of the circle. Could be due to limited resolution of getPixelColor.
2024-05-13 19:27:41 +02:00
Michael Bisbjerg
bd10a9aa26 Change BME280I2C to be reused between configs 2024-05-13 18:35:13 +02:00
Blaz Kristan
1ceeed38bc Another fix for fix :rolleyes: 2024-05-13 14:30:30 +02:00
Brandon502
2e1e917952 Merge branch '0_15' of https://github.com/Brandon502/WLED into 0_15 2024-05-12 17:46:52 -04:00
Brandon502
9e0b91ac17 Pinwheel changes.
Jump distance for odd rays fixed. Removed holes on rectangular matrices.
2024-05-12 17:46:42 -04:00
Frank
ea83ec496b pinwheel - parameter tuning to fix some holes
fixing holes that appeared during testing
* at 52x52 (big 296 -> 304)
* at 24x32 (medium 192 -> 208)
* at 12x16 (small 72 -> 82)

... there is still one hole at 14x16 ... well wtf
2024-05-12 23:05:58 +02:00
Frank
f26bb26ffa Update FX_fcn.cpp
* minor cleanup, moved prevRay into setPixelColor
* removed experimental code (too slow)
* comments cleanup
2024-05-12 22:35:33 +02:00
Frank
28348f919b Merge branch '0_15' into pr/3961 2024-05-12 21:30:59 +02:00
Brandon502
c84d4c637d Pinwheel Expand 1D Optimization
Changed method for drawing odd numbered rays.
2024-05-12 11:52:31 -04:00
Blaz Kristan
04706cfa9c JS fix & warning 2024-05-12 16:34:07 +02:00
Frank
3078bea7cc Pinwheel optimization: do nor repaint "same" pixels in a line
avoids back to back duplicates within the same line
2024-05-12 13:29:04 +02:00
Frank
c91e0fc988 Merge branch '0_15' into pr/3961 2024-05-12 13:25:46 +02:00
Blaž Kristan
5183af4e8a Typo. 2024-05-12 11:30:57 +02:00
Blaž Kristan
1ff5cb0596 Experimental parallel I2S support for ESP32
- increased outputs to 17
- increased max possible color order overrides
- use WLED_USE_PARALLEL_I2S during compile

WARNING: Do not set up more than 256 LEDs per output when using parallel I2S with NeoPixelBus less than 2.9.0
2024-05-12 11:12:13 +02:00
Blaž Kristan
f441ce9c17 Merge branch '0_15' into blending-styles 2024-05-12 08:12:58 +02:00
Blaž Kristan
522e5e7957
Merge pull request #3964 from adamsthws/0_15_battery_usermod_init_improvement
Update Usermod: Battery
2024-05-11 21:11:26 +02:00
Brandon502
9e468bd059 Pinwheel Expand 1D Optimizations
Added small pinwheel size. Adjusts medium and large values.
2024-05-11 13:57:21 -04:00
Frank
ecc9443677 (0_14 branch only) adding compatibility for building with upstream arduinoFFT 2.xx
support compilation with new arduinoFFT versions 2.x
2024-05-11 14:45:42 +02:00
Adam Matthews
6b8d8bf735 Update Battery usermod documentation
Improved wiring, installation and calibration instructions.

Example screenshots added.

Minor grammar improvements.

Heading visual consistency improved.

Improved vertical separation between sections
(separator lines added).

Thankyou!
2024-05-11 13:34:35 +01:00
Michael Bisbjerg
43d024fe42 Make BME280 usermod i2c address changeable 2024-05-11 12:23:53 +02:00
Blaž Kristan
c016dedea4
Merge pull request #3965 from LordMike/bugfix/usermod_bme280 2024-05-11 07:42:09 +02:00
Michael Bisbjerg
b9ca2cfe90 Fix missing conversions of bme280 values
The BME280 usermod uses a multiply-round-divide approach to cap the temperature/humidity/pressure values to some number of decimals. But the divide-part was missing in a few instances.
2024-05-10 22:44:46 +02:00
Brandon502
d3492b5b6c Pinwheel Expand 1D Bug Fix
Removed holes on 31x31 and 32x32 grids.
2024-05-10 16:06:37 -04:00
Blaž Kristan
3682cd6a5e
Merge pull request #3913 from Aircoookie/tm1914
Tm1914 chip support
2024-05-10 21:44:40 +02:00
Blaz Kristan
b209b1e481 Peek on/off fix 2024-05-10 16:01:47 +02:00
Blaz Kristan
4afed48f58 Use libc trigonometric functions on ESP32 by default
- use custom (space saving) functions on ESP8266
2024-05-10 15:59:11 +02:00
Brandon502
6a18ce078e Pinwheel Expand1D changes
cosf/sinf changed to cos_t/sin_t. int_fast32_t and int_fast_16_t changed to int.
2024-05-09 20:38:41 -04:00
Adam Matthews
bc5aadff7d Update Usermod: Battery
Issue:
When taking the initial voltage reading after first powering on, voltage hasn't had chance to stabilize so the reading can be inaccurate, which in turn may incorrectly trigger the low-power preset. (Manifests when the user has selected a low read interval and/or is using a capacitor).

Resolution:
A non-blocking, fixed 10 second delay has been added to the initial voltage reading to give the voltage time to stabilize.

This is a reworked version of the (now closed) PR here:
https://github.com/Aircoookie/WLED/pull/3959

- Rebased the update for 0_15.

- Added a constant so the delay can be modified via my_config.h.

- Small adjustments to make the PR compatible again after the recent restructuring in this PR: (https://github.com/Aircoookie/WLED/pull/3003).

Thankyou!
2024-05-09 23:09:45 +01:00
Blaz Kristan
de89b516dc Merge branch '0_15' of https://github.com/aircoookie/WLED into 0_15 2024-05-10 00:04:43 +02:00
Blaz Kristan
4dbe9a7015 Antialiased line & circle 2024-05-10 00:02:28 +02:00
Blaz Kristan
a320f16404 Real math fix 2024-05-09 23:58:58 +02:00
gaaat
cec7241986 removed commented variables 2024-05-08 15:42:41 +02:00
gaaat
6de77293ad Merge branch '0_15' of https://github.com/Aircoookie/WLED into esp8266-audioreactive-sync 2024-05-08 15:36:10 +02:00
gaaat
0ac53d8353 initial port of MoonModules/WLED/pull/60 and related commit 2024-05-08 15:33:51 +02:00
Brandon502
da79b93387 Added Pinwheel Expand 1D Effect 2024-05-07 18:04:29 -04:00
Frank
b88c300d04 audioreactive: workaround for ArduinoFFT bug 93
This fix works around a problem that was solved in upstream ArduinoFFT 2.0.2
2024-05-07 23:38:19 +02:00
Blaz Kristan
88372cd516 Brighter peek (ignore strip brightness) 2024-05-07 16:34:15 +02:00
Blaž Kristan
b3206121cc
Merge pull request #3942 from gaaat98/audioreactive-analog
Enabled some audioreactive effects for single pixel strips/segments
2024-05-07 07:35:46 +02:00
gaaat98
5bccb5fc42
removed commented checks 2024-05-07 00:31:37 +02:00
Blaž Kristan
47e1cbdaff
Merge pull request #3003 from itCarl/usermod-battery-update2023
Usermod Battery 🔋 Added Support for different battery types, Optimized file structure
2024-05-06 20:41:00 +02:00
Maximilian Mewes
52020cbe26 CP fix 2024-05-06 17:46:26 +02:00
Maximilian Mewes
d33651c25b Update setup method 2024-05-06 17:45:02 +02:00
Maximilian Mewes
18e9f9c304 Rename Battery classes 2024-05-06 17:39:40 +02:00
Frank
2607c44fbb make objdump work
Script update based on latest version from Tasmota
* add support for all esp32 variants
* add "-C" : Decode (demangle) low-level symbol names into user-level C++ names.
2024-05-06 11:00:41 +02:00
gaaat
c8a7d44f55 Merge branch '0_15' of https://github.com/Aircoookie/WLED into audioreactive-analog 2024-05-06 00:09:43 +02:00
Frank
a6e536189c output_bin.py : fix for mapfile copy
The build script was not looking into the right place, so there was never a .map file dropped into build_output/map/

Builds with the newer arduino-esp32 v2.0.x framework actually generate a .map file that is placed directly next to firmware.bin
2024-05-05 21:56:01 +02:00
Frank
3f9a6cae53 AR: fix for arduinoFFT 2.x API
in contrast to previous 'dev' versions, the storage for windowWeighingFactors is now managed internally by the arduinoFFT object.
2024-05-04 14:34:23 +02:00
Frank
cd5494fdd2 AR pin config: SCK == 1 --> PDM microphone 2024-05-04 14:12:44 +02:00
Blaž Kristan
5ab1b14d6b
Merge pull request #3946 from freakintoddles2/0_15
Adds an API parameter to allow the user to skip to the next preset in a playlist at any time
2024-05-03 23:25:36 +02:00
Todd Meyer
379f181362 Further simplification 2024-05-03 11:51:47 -07:00
Todd Meyer
dd19aa63d0 Forgot F[], added it 2024-05-03 08:47:14 -07:00
Todd Meyer
6df3b417a9 Updated based on more feedback 2024-05-03 08:30:37 -07:00
Blaz Kristan
fa76431dd6 Changelog update 2024-05-03 16:08:20 +02:00
Blaz Kristan
6504fb68b6 Minor MQTT optimisation. 2024-05-03 15:46:16 +02:00
Blaz Kristan
2ff49cf657 Fix for #3952
- included IR optimisations & code rearrangement
2024-05-03 15:45:15 +02:00
Blaž Kristan
fa1aa1fe80
Merge pull request #3944 from paspiz85/pas4
Using brightness in analog clock overlay
2024-05-03 09:56:14 +02:00
Blaž Kristan
85b95a2940
Merge pull request #3945 from w00000dy/Webpage-shortcuts
Add Webpage shortcuts and Fix resizing bug
2024-05-03 09:53:00 +02:00
Todd Meyer
5e38039c4d Updated based on more feedback 2024-05-02 14:36:18 -07:00
Blaz Kristan
4df936a437 Fix for unfortunate prior CRLF coversion. 2024-05-02 10:33:10 +02:00
Blaz Kristan
736a8b1b80 Fix for rotating tablet into PC mode. 2024-05-02 10:31:50 +02:00
Pasquale Pizzuti
22f6128bc4 using global brightness 2024-05-02 09:05:37 +02:00
freakintoddles2
db475b6998
Update playlist.cpp 2024-05-01 10:09:17 -07:00
freakintoddles2
6daf7f6322
Update wled.cpp
reworked based on PR feedback
2024-05-01 10:07:52 -07:00
freakintoddles2
16086c0961
Update wled.h
reworked based on feedback from original PR
2024-05-01 10:05:26 -07:00
freakintoddles2
e88c81ad0d
Update set.cpp
reworked based on feedback
2024-05-01 10:04:02 -07:00
freakintoddles2
a2b9aed40d
Update playlist.cpp
reworked approach based on feedback
2024-05-01 10:03:16 -07:00
freakintoddles2
caa4fe1ec4
Update json.cpp
reworked approach based on feedback
2024-05-01 10:02:27 -07:00
freakintoddles2
25fb878e54
Update fcn_declare.h
reworked approach based on feedback
2024-05-01 10:01:30 -07:00
freakintoddles2
a1d6ffadad
Update json.cpp
adds support for np boolean parameter to skip to next preset
2024-04-30 16:49:52 -07:00
freakintoddles2
3b89814b69
Update set.cpp
added new NP command to API to allow user to skip to next preset in a playlist. Example use is win&NP in a preset.
2024-04-30 16:33:30 -07:00
freakintoddles2
071e0be445
Update fcn_declare.h
Updated to add the optional skipNext bool to handlePlaylist() which allows people to skip to the next preset when desired
2024-04-30 16:23:43 -07:00
freakintoddles2
bed364d75e
Update playlist.cpp
Updated to allow a user to optionally skip to the next preset in the playlist anytime they desire.
2024-04-30 16:21:40 -07:00
Woody
d2984e9e16
add Webpage shortcuts, resolves #2362 2024-04-30 18:57:53 +02:00
Maximilian Mewes
05a8c692f2 read initial voltage correctly 2024-04-30 18:11:18 +02:00
Pasquale Pizzuti
fd9570e782 using color_fade 2024-04-30 17:52:35 +02:00
Maximilian Mewes
35d26afcb4 Merge remote-tracking branch 'upstream/0_15' into usermod-battery-update2023 2024-04-30 17:12:08 +02:00
Maximilian Mewes
2245ee6fce bugfixes 2024-04-30 17:02:57 +02:00
Woody
ff10130176
Fix resizing bug
The bug was that when resizing the window, it always jumped to the Colors tab instead of staying on the currently selected tab.
2024-04-30 16:53:47 +02:00
Maximilian Mewes
a13f1a9bee bug fixes 2024-04-30 15:24:02 +02:00
Maximilian Mewes
3cc60fa4d4 Merge branch 'main' into usermod-battery-update2023 2024-04-30 15:01:23 +02:00
Maximilian Mewes
bd69c24231 intermediate update 2024-04-30 14:54:53 +02:00
Pasquale Pizzuti
c7d292a716 using brightness in analog clock overlay 2024-04-30 14:09:12 +02:00
gaaat
74bc159a52 enabled some audioreactive effects for single pixel strips/segments 2024-04-29 20:19:10 +02:00
Frank
9f99a1896d presets.json PSRAM caching: consider cacheInvalidate
* trying to make the caching mechanism bulletproof.
`cacheInvalidate` is changed when
- autosave usermod updates presets
- a file was upload
* (coding style) fixed some unitialized variables
2024-04-29 16:51:27 +02:00
Blaž Kristan
8110259d1c
Merge pull request #3892 from askask/pollreply 2024-04-28 09:32:04 +02:00
Frank
1048bf993a
use lolin_s3_mini for esp32-S3 4MB buildenv 2024-04-27 23:34:35 +02:00
Blaž Kristan
3eba0f4e0d
Merge pull request #3933 from gaaat98/0_15
Improved brightness change via long button presses
2024-04-27 12:53:56 +02:00
gaaat98
d7e0b364d1
fixed wrong comment 2024-04-27 12:25:34 +02:00
Blaz Kristan
25dd43b949 Bugfix for bugfix
- thanks @softhack007
2024-04-26 23:49:34 +02:00
Blaz Kristan
8e8ffa30a6 Merge branch '0_15' into blending-styles 2024-04-26 20:45:26 +02:00
Blaz Kristan
69da2f4b23 Merge branch '0_15' into tm1914 2024-04-26 20:41:56 +02:00
Blaz Kristan
d48bab02a1 Speed & size optimisations using native sized variables 2024-04-26 20:11:46 +02:00
Blaz Kristan
886120fe9f Bugfix
- getPixelColor() for analog
- RMT channel (#3922)
2024-04-26 20:07:27 +02:00
gaaat98
bdd4d9f3ff
set buttonBriDirection as local static 2024-04-26 18:23:34 +02:00
gaaat
6276c2f1f5 improved brightness change via long button presses 2024-04-26 16:39:32 +02:00
Blaž Kristan
b3acc97d03
Merge pull request #3920 from Suxsem/relay-3-states
Relay open drain output (allow esp32 to drive 5v relay modules)
2024-04-26 07:06:03 +02:00
Suxsem
24bd1db4fc "X" span near to the number input field 2024-04-26 00:29:48 +02:00
Blaz Kristan
e83d3cb4a3 Fix for #3878 2024-04-24 16:04:54 +02:00
Blaz Kristan
674481f0d1 Multiple fixes
- several compile warning fixes
- multipin LED compile config
- release info (update page, JSON "info")
- WiFi scan fix if no networks found
- UI glitch when no presets are found fix

With multipin LED config it is now possible to assign GPIO to PWM RGB outputs.
Achieved by having length of DATA_PINS be divisble by lengt of PIXEL_COUNTS.
2024-04-23 19:05:49 +02:00
Blaz Kristan
5d271d21bc INI cleanup
added 8M ESP32 and 16M ESP32-S3
2024-04-23 18:55:36 +02:00
Frank
4e4493e627
Merge pull request #3902 from Aircoookie/arduino_2_0_9
update esp32 platform to arduino-esp32 v2.0.9
2024-04-23 15:56:08 +02:00
Frank
1154905818 upgrading WROVER to use new platform 2024-04-23 15:49:39 +02:00
Frank
0d3ea848c2 "big partition" added - 300KB FS and coredump support(from WLEDMM) 2024-04-23 15:27:44 +02:00
Frank
8ffe1e65fd
audioreactive: arduino-esp32 up to 2.0.14 still has the swapped-channel-bug 2024-04-23 15:07:08 +02:00
Blaž Kristan
127ea7e351 Fix for #3926 2024-04-23 13:04:17 +02:00
Suxsem
34b16f1919 optimizations 2024-04-21 20:02:00 +02:00
Suxsem
fa32faf759 feat(new): relay open drain output 2024-04-21 13:37:07 +02:00
Blaz Kristan
6f3d7e76c9 Fix for #3919 2024-04-19 22:54:25 +02:00
Frank
57665e8964
audioreactive readme - removed UM_AUDIOREACTIVE_USE_NEW_FFT
The customized library is not needed / supported any more in 0_15.
2024-04-18 12:16:04 +02:00
Blaz Kristan
5c502b1fe4 Bump arduinoFFT, organise partitions 2024-04-17 22:49:33 +02:00
Blaz Kristan
6d1410741d Fix 8266 compile 2024-04-17 19:00:16 +02:00
Blaz Kristan
3e20724058 ArduinoFFT update
shadow variables
2024-04-17 18:52:35 +02:00
Blaž Kristan
197f47befe
Merge pull request #3905 from w00000dy/main
Set stale lable to 'stale' and increase operations-per-run in stale.yml
2024-04-16 20:31:16 +02:00
Blaž Kristan
d126611e87
Merge pull request #3904 from DedeHai/FX_fcn_improvements
added improvements to color scaling and blurring
2024-04-16 17:41:20 +02:00
Blaž Kristan
1b75be5710
Update FX_2Dfcn.cpp
Undo indent
2024-04-16 17:37:48 +02:00
Woody
6272969983
Set stale-pr-label & stale-issue-label to 'stale' in stale.yml
Hopefully this fixes the error messages that were thrown the last time the action was executed
2024-04-16 15:07:12 +02:00
Damian Schneider
084fc2fcd1 bugfix & code formatting, removed color_scale
also replaced scale8_video with 32bit calculation in color_fade for consistency and speed.
2024-04-16 10:43:06 +02:00
Woody
b2e68db380
Increase operations-per-run in stale.yml again 2024-04-15 22:56:38 +02:00
Damian Schneider
459156fe57 added improvements to color scaling and blurring
-changes save roughly 600bytes of flash
-made blurring faster by not writing the color and then reading it back but keeping it as a variable: on a C3, FX black hole goes from 55FPS to 71FPS
-added optional parameter to blur (smear) that can be used in combination with SEGMENT.clear(), blurring the frame without dimming the current frame (repeated calls without clearing will result in white). this is useful to blur without 'motion blurring' being added
-scale8 is inlined and repeated calls uses flash, plus it is slower than native 32bit, so I added 'color_scale' function which is native 32bit and scales 32bit colors (RGBW).
2024-04-15 21:20:45 +02:00
Blaz Kristan
7abfe68458 Add support for TM1914 chip 2024-04-15 16:13:13 +02:00
Frank
442d7a7226 arduino-esp32 v2.0.9 2024-04-15 14:08:28 +02:00
Blaž Kristan
80ebcb2c28
Merge pull request #3901 from w00000dy/main
Increase operations-per-run in stale.yml
2024-04-14 15:47:31 +02:00
Blaz Kristan
9735d1c6f3 Merge branch '0_15' into blending-styles 2024-04-14 15:41:08 +02:00
Blaz Kristan
ef017fd343 Revert FX.cpp 2024-04-14 15:34:59 +02:00
Woody
cd928bc586
Increase operations-per-run in stale.yml
Because of this we don't need to run this action 3 times a day
2024-04-14 13:14:03 +02:00
dependabot[bot]
d2b4d25317
Bump idna from 3.4 to 3.7 (#3895)
Bumps [idna](https://github.com/kjd/idna) from 3.4 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](https://github.com/kjd/idna/compare/v3.4...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-13 19:38:03 +02:00
Woody
a418cd2a2a
Activate stale (#3898)
* Update stale.yml

Update pr text
Schedule action 3 times a day

* Delete old .github/stale.yml

* Set exempt-all-milestones to true in stale.yml
2024-04-13 19:37:49 +02:00
Blaz Kristan
94cdd88474 Version bump B3
- fix for #3896
- fix WS2815 current
- conditional AA setPixelColor()
2024-04-13 18:25:25 +02:00
muebau
1bdf3876fc reset usermod TetrisAI back to initial version 2024-04-12 12:00:15 +02:00
Blaž Kristan
8358272b9a
Merge pull request #3876 from w00000dy/main
Create new stale.yml
2024-04-10 19:42:52 +02:00
Andreas Kling
c3787af29d Send ArtnetPollReply for Art-Net proxy universe 2024-04-09 20:00:00 +02:00
Blaz Kristan
b3810a16cc Merge branch '0_15' into blending-styles 2024-04-09 16:39:29 +02:00
Blaz Kristan
a3a8fa1cef Remove conditional fade/blend
- transitions always enabled (use delay 0 to disable)
- optimisation in on/off fade
- fix for palette/color blend when blending style is not fade
- various tweaks and optimisations
2024-04-08 16:24:27 +02:00
Blaz Kristan
c6805271e9 Merge branch '0_15' into blending-styles 2024-04-08 15:28:57 +02:00
Blaz Kristan
00f5471270 Build bump, changelog udate 2024-04-04 21:59:41 +02:00
Blaz Kristan
f5199d2b73 Fix compile. 2024-04-03 20:55:59 +02:00
Blaz Kristan
0c8d9d5614 Mode blending styles
- alternative to #3669
2024-04-03 18:38:06 +02:00
Will Miles
bff6697690 Update to AsyncWebServer v2.2.1 2024-04-03 18:23:50 +02:00
Woody
02405b4856
Create stale.yml 2024-04-03 12:32:18 +02:00
Blaz Kristan
6d278994ec WLED 0.14.3 release
- Fix for transition 0 (#3854, #3832, #3720)
- copyright year update
- updated AsyncWebServer to v2.2.0
2024-03-29 20:05:56 +01:00
Christian Schwinne
247de600af Fix missing GIF enable macros 2024-03-17 22:57:15 +01:00
Christian Schwinne
3e60d3d96e Working GIF support 2024-03-17 22:24:55 +01:00
Christian Schwinne
b2afac8914 GIFs work again in principle 2024-03-10 21:36:13 +01:00
Christian Schwinne
3ad56ea103 GIF testing 2024-03-10 14:34:15 +01:00
Christian Schwinne
1f25edc737
Merge pull request #3805 from Aircoookie/0_15
update gif with new changes
2024-03-09 19:44:42 +01:00
Maximilian Mewes
a9d6a15924 Update Classes 2023-09-09 21:50:30 +02:00
Maximilian Mewes
b8c61b5236 Move battery types to a separate folder 📁 2023-09-09 21:01:55 +02:00
Maximilian Mewes
b77e1eb94b Merge remote-tracking branch 'origin/main' into usermod-battery-update2023 2023-09-08 23:17:23 +02:00
Maximilian Mewes
f78f8b6b12 Exposing the Battery state to JSON API - Part 2 2023-01-21 01:44:50 +01:00
Maximilian Mewes
f97b79bc16 Exposing the Battery state to JSON API - Part 1 2023-01-21 00:39:51 +01:00
Maximilian Mewes
42c8a77755 Merge branch 'main' into usermod-battery-update2023 2023-01-20 23:25:13 +01:00
Maximilian Mewes
bb82bf762f Update Readme, my_config type config options with examples 2023-01-12 21:50:46 +01:00
Maximilian Mewes
d16f9efeec Added forgotten file 😥 2023-01-06 19:09:12 +01:00
Maximilian Mewes
8ba5dfe447 Another Bugfx 🧑‍🔧 2023-01-06 19:07:39 +01:00
Maximilian Mewes
3759071449 Fix previous bug again 🐛, Add Type Dropdown to config page 2023-01-06 17:00:29 +01:00
Maximilian Mewes
85d59945a0 runtime exception fix 🐛 2023-01-06 00:19:16 +01:00
Maximilian Mewes
4c8b490c89 minor changes 2023-01-05 20:38:55 +01:00
Maximilian Mewes
8dd1745149 Add base battery 🔋 class, Add Lipo, Lion class 2023-01-05 19:48:53 +01:00
334 changed files with 26368 additions and 13755 deletions

View File

@ -2,12 +2,7 @@
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
ARG VARIANT="3"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
# [Option] Install Node.js
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
FROM mcr.microsoft.com/devcontainers/python:0-${VARIANT}
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/

View File

@ -5,41 +5,54 @@
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
"VARIANT": "3",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*"
"VARIANT": "3"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
// To give the container access to a device serial port, you can uncomment one of the following lines.
// Note: If running on Windows, you will have to do some additional steps:
// https://stackoverflow.com/questions/68527888/how-can-i-use-a-usb-com-port-inside-of-a-vscode-development-container
//
// You can explicitly just forward the port you want to connect to. Replace `/dev/ttyACM0` with the serial port for
// your device. This will only work if the device is plugged in from the start without reconnecting. Adding the
// `dialout` group is needed if read/write permisions for the port are limitted to the dialout user.
// "runArgs": ["--device=/dev/ttyACM0", "--group-add", "dialout"],
//
// Alternatively, you can give more comprehensive access to the host system. This will expose all the host devices to
// the container. Adding the `dialout` group is needed if read/write permisions for the port are limitted to the
// dialout user. This could allow the container to modify unrelated serial devices, which would be a similar level of
// risk to running the build directly on the host.
// "runArgs": ["--privileged", "-v", "/dev/bus/usb:/dev/bus/usb", "--group-add", "dialout"],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"platformio.platformio-ide"
],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
"extensions": [
"ms-python.python",
"platformio.platformio-ide"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
"postCreateCommand": "bash -i -c 'nvm install && npm ci'",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"

View File

@ -80,7 +80,7 @@ body:
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Aircoookie/WLED/blob/master/CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/wled-dev/WLED/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

20
.github/stale.yml vendored
View File

@ -1,20 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- keep
- enhancement
- confirmed
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Hey! This issue has been open for quite some time without any new comments now.
It will be closed automatically in a week if no further activity occurs.
Thank you for using WLED!
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

82
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,82 @@
name: WLED Build
# Only included into other workflows
on:
workflow_call:
jobs:
get_default_envs:
name: Gather Environments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Get default environments
id: envs
run: |
echo "environments=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT
outputs:
environments: ${{ steps.envs.outputs.environments }}
build:
name: Build Environments
runs-on: ubuntu-latest
needs: get_default_envs
strategy:
fail-fast: false
matrix:
environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }}
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio/.cache
~/.buildcache
build_output
key: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-${{ hashFiles('wled00/**', 'usermods/**') }}
restore-keys: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Build firmware
run: pio run -e ${{ matrix.environment }}
- uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.environment }}
path: |
build_output/release/*.bin
build_output/release/*_ESP02*.bin.gz
testCdata:
name: Test cdata.js
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm test

47
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Deploy Nightly
on:
# This can be used to automatically publish nightlies at UTC nighttime
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
# This can be used to allow manually triggering nightlies from the web interface
workflow_dispatch:
jobs:
wled_build:
uses: ./.github/workflows/build.yml
nightly:
name: Deploy nightly
runs-on: ubuntu-latest
needs: wled_build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Show Files
run: ls -la
- name: "✏️ Generate release changelog"
id: changelog
uses: janheinrichmerker/action-github-changelog-generator@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: v0.15.0
- name: Update Nightly Release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Nightly Release $$'
prerelease: true
body: ${{ steps.changelog.outputs.changelog }}
files: |
*.bin
*.bin.gz
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
repository: wled/WLED-WebInstaller
event-type: release-nightly
token: ${{ secrets.PAT_PUBLIC }}

16
.github/workflows/pr-merge.yaml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Notify Discord on PR Merge
on:
pull_request:
types: [closed]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Discord notification
shell: bash
env:
DISCORD_WEBHOOK_BETA_TESTERS: ${{ secrets.DISCORD_WEBHOOK_BETA_TESTERS }}
if: github.event.pull_request.merged == true
run: |
curl -H "Content-Type: application/json" -d '{"content": "Pull Request #{{ github.event.pull_request.number }} merged by {{ github.actor }}"}' $DISCORD_WEBHOOK_BETA_TESTERS

35
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: WLED Release CI
on:
push:
tags:
- '*'
jobs:
wled_build:
uses: ./.github/workflows/build.yml
release:
name: Create Release
runs-on: ubuntu-latest
needs: wled_build
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: "✏️ Generate release changelog"
id: changelog
uses: janheinrichmerker/action-github-changelog-generator@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: v0.15.0
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
draft: True
files: |
*.bin
*.bin.gz

30
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
days-before-stale: 120
days-before-close: 7
stale-issue-label: 'stale'
stale-pr-label: 'stale'
exempt-issue-labels: 'pinned,keep,enhancement,confirmed'
exempt-pr-labels: 'pinned,keep,enhancement,confirmed'
exempt-all-milestones: true
operations-per-run: 1000
stale-issue-message: >
Hey! This issue has been open for quite some time without any new comments now.
It will be closed automatically in a week if no further activity occurs.
Thank you for using WLED! ✨
stale-pr-message: >
Hey! This pull request has been open for quite some time without any new comments now.
It will be closed automatically in a week if no further activity occurs.
Thank you for contributing to WLED! ❤️

13
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,13 @@
on:
workflow_dispatch:
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
repository: wled/WLED-WebInstaller
event-type: release-nightly
token: ${{ secrets.PAT_PUBLIC }}

View File

@ -1,94 +1,11 @@
name: WLED CI
on: [push, pull_request]
on:
push:
branches:
- '*'
pull_request:
jobs:
get_default_envs:
name: Gather Environments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Get default environments
id: envs
run: |
echo "environments=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT
outputs:
environments: ${{ steps.envs.outputs.environments }}
build:
name: Build Enviornments
runs-on: ubuntu-latest
needs: get_default_envs
strategy:
fail-fast: false
matrix:
environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }}
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
- run: npm ci
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio/.cache
~/.buildcache
build_output
key: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-${{ hashFiles('wled00/**', 'usermods/**') }}
restore-keys: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Build firmware
run: pio run -e ${{ matrix.environment }}
- uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.environment }}
path: |
build_output/release/*.bin
build_output/release/*_ESP02*.bin.gz
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
draft: True
files: |
*.bin
*.bin.gz
testCdata:
name: Test cdata.js
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- run: npm ci
- run: npm test
wled_build:
uses: ./.github/workflows/build.yml

3
.gitignore vendored
View File

@ -15,10 +15,11 @@ wled-update.sh
/build_output/
/node_modules/
/logs/
/wled00/extLibs
/wled00/LittleFS
/wled00/my_config.h
/wled00/Release
/wled00/wled00.ino.cpp
/wled00/html_*.h
/wled00/html_*.h

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
20.18

View File

@ -1,5 +1,140 @@
## WLED changelog
#### Build 2410270
- WLED 0.15.0-b7 release
- Re-license the WLED project from MIT to EUPL (#4194 by @Aircoookie)
- Fix alexa devices invisible/uncontrollable (#4214 by @Svennte)
- Add visual expand button on hover (#4172)
- Usermod: Audioreactive tuning and performance enhancements (by @softhack007)
- `/json/live` (JSON live data/peek) only enabled when WebSockets are disabled
- Various bugfixes and optimisations: #4179, #4215, #4219, #4222, #4223, #4224, #4228, #4230
#### Build 2410140
- WLED 0.15.0-b6 release
- Added BRT timezone (#4188 by @LuisFadini)
- Fixed the positioning of the "Download the latest binary" button (#4184 by @maxi4329)
- Add WLED_AUTOSEGMENTS compile flag (#4183 by @PaoloTK)
- New 512kB FS parition map for 4MB devices
- Internal API change: Static PinManager & UsermodManager
- Change in Improv chip ID and version generation
- Various optimisations, bugfixes and enhancements (#4005, #4174 & #4175 by @Xevel, #4180, #4168, #4154, #4189 by @dosipod)
#### Build 2409170
- UI: Introduce common.js in settings pages (size optimisation)
- Add the ability to toggle the reception of palette synchronizations (#4137 by @felddy)
- Usermod/FX: Temperature usermod added Temperature effect (example usermod effect by @blazoncek)
- Fix AsyncWebServer version pin
#### Build 2409140
- Configure different kinds of busses at compile (#4107 by @PaoloTK)
- BREAKING: removes LEDPIN and DEFAULT_LED_TYPE compile overrides
- Fetch LED types from Bus classes (dynamic UI) (#4129 by @netmindz, @blazoncek, @dedehai)
- Temperature usermod: update OneWire to 2.3.8 (#4131 by @iammattcoleman)
#### Build 2409100
- WLED 0.15.0-b5 release
- Audioreactive usermod included by default in all compatible builds (including ESP8266)
- Demystified some byte definitions of WiZmote ESP-NOW message (#4114 by @ChuckMash)
- Update usermod "Battery" improved MQTT support (#4110 by @itCarl)
- Added a usermod for interacting with BLE Pixels Dice (#4093 by @axlan)
- Allow lower values for touch threshold (#4081 by @RobinMeis)
- Added POV image effect usermod (#3539 by @Liliputech)
- Remove repeating code to fetch audio data (#4103 by @netmindz)
- Loxone JSON parser doesn't handle lx=0 correctly (#4104 by @FreakyJ, fixes #3809)
- Rename wled00.ino to wled_main.cpp (#4090 by @willmmiles)
- SM16825 chip support including WW & CW channel swap (#4092)
- Add stress testing scripts (#4088 by @willmmiles)
- Improve jsonBufferLock management (#4089 by @willmmiles)
- Fix incorrect PWM bit depth on Esp32 with XTAL clock (#4082 by @PaoloTK)
- Devcontainer args (#4073 by @axlan)
- Effect: Fire2012 optional blur amount (#4078 by @apanteleev)
- Effect: GEQ fix bands (#4077 by @adrianschroeter)
- Boot delay option (#4060 by @DedeHai)
- ESP8266 Audioreactive sync (#3962 by @gaaat98, @netmindz, @softhack007)
- ESP8266 PWM crash fix (#4035 by @willmmiles)
- Usermod: Battery fix (#4051 by @Nickbert7)
- Usermod: Mpu6050 usermod crash fix (#4048 by @willmmiles)
- Usermod: Internal Temperature V2 (#4033 by @adamsthws)
- Various fixes and improvements (including build environments to emulate 0.14.0 for ESP8266)
#### Build 2407070
- Various fixes and improvements (mainly LED settings fix)
#### Build 2406290
- WLED 0.15.0-b4 release
- LED settings bus management update (WARNING: only allows available outputs)
- Add ETH support for LILYGO-POE-Pro (#4030 by @rorosaurus)
- Update usermod_sn_photoresistor (#4017 by @xkvmoto)
- Several internal fixes and optimisations
- move LED_BUILTIN handling to BusManager class
- reduce max panels (web server limitation)
- edit WiFi TX power (ESP32)
- keep current ledmap ID in UI
- limit outputs in UI based on length
- wifi.ap addition to JSON Info (JSON API)
- relay pin init bugfix
- file editor button in UI
- ESP8266: update was restarting device on some occasions
- a bit of throttling in UI (for ESP8266)
#### Build 2406120
- Update NeoPixelBus to v2.8.0
- Increased LED outputs one ESP32 using parallel I2S (up to 17)
- use single/mono I2S + 4x RMT for 5 outputs or less
- use parallel x8 I2S + 8x RMT for >5 outputs (limit of 300 LEDs per output)
- Fixed code of Smartnest and updated documentation (#4001 by @DevilPro1)
- ESP32-S3 WiFi fix (#4010 by @cstruck)
- TetrisAI usermod fix (#3897 by @muebau)
- ESP-NOW usermod hook
- Update wled.h regarding OTA Password (#3993 by @gsieben)
- Usermod BME68X Sensor Implementation (#3994 by @gsieben)
- Add a usermod for AHT10, AHT15 and AHT20 temperature/humidity sensors (#3977 by @LordMike)
- Update Battery usermod documentation (#3968 by @adamsthws)
- Add INA226 usermod for reading current and power over i2c (#3986 by @LordMike)
- Bugfixes: #3991
- Several internal fixes and optimisations (WARNING: some effects may be broken that rely on overflow/narrow width)
- replace uint8_t and uint16_t with unsigned
- replace in8_t and int16_t with int
- reduces code by 1kB
#### Build 2405180
- WLED 0.14.4 release
- Fix for #3978
- Official 0.15.0-b3 release
- Merge 0.14.3 fixes into 0_15
- Added Pinwheel Expand 1D->2D effect mapping mode (#3961 by @Brandon502)
- Add changeable i2c address to BME280 usermod (#3966 by @LordMike)
- Effect: Firenoise - add palette selection
- Experimental parallel I2S support for ESP32 (compile time option)
- increased outputs to 17
- increased max possible color order overrides
- use WLED_USE_PARALLEL_I2S during compile
WARNING: Do not set up more than 256 LEDs per output when using parallel I2S with NeoPixelBus less than 2.9.0
- Update Usermod: Battery (#3964 by @adamsthws)
- Update Usermod: BME280 (#3965 by @LordMike)
- TM1914 chip support (#3913)
- Ignore brightness in Peek
- Antialiased line & circle drawing functions
- Enabled some audioreactive effects for single pixel strips/segments (#3942 by @gaaat98)
- Usermod Battery: Added Support for different battery types, Optimized file structure (#3003 by @itCarl)
- Skip playlist entry API (#3946 by @freakintoddles2)
- various optimisations and bugfixes (#3987, #3978)
#### Build 2405030
- Using brightness in analog clock overlay (#3944 by @paspiz85)
- Add Webpage shortcuts (#3945 by @w00000dy)
- ArtNet Poll reply (#3892 by @askask)
- Improved brightness change via long button presses (#3933 by @gaaat98)
- Relay open drain output (#3920 by @Suxsem)
- NEW JSON API: release info (update page, `info.release`)
- update esp32 platform to arduino-esp32 v2.0.9 (#3902)
- various optimisations and bugfixes (#3952, #3922, #3878, #3926, #3919, #3904 @DedeHai)
#### Build 2404120
- v0.15.0-b3
- fix for #3896 & WS2815 current saving
- conditional compile for AA setPixelColor()
#### Build 2404100
- Internals: #3859, #3862, #3873, #3875
- Prefer I2S1 over RMT on ESP32
@ -17,6 +152,11 @@
- Fix for #3889
- BREAKING: Effect: modified KITT (Scanner) (#3763)
#### Build 2404040
- WLED 0.14.3 release
- Fix for transition 0 (#3854, #3832, #3720)
- Fix for #3855 via #3873 (by @willmmiles)
#### Build 2403280
- Individual color channel control for JSON API (fixes #3860)
- "col":[int|string|object|array, int|string|object|array, int|string|object|array]
@ -33,7 +173,7 @@
- v0.15.0-b2
- WS2805 support (RGB + WW + CW, 600kbps)
- Unified PSRAM use
- NeoPixelBus v2.7.9
- NeoPixelBus v2.7.9 (for future WS2805 support)
- Ubiquitous PSRAM mode for all variants of ESP32
- SSD1309_64 I2C Support for FLD Usermod (#3836 by @THATDONFC)
- Palette cycling fix (add support for `{"seg":[{"pal":"X~Y~"}]}` or `{"seg":[{"pal":"X~Yr"}]}`)

View File

@ -14,7 +14,21 @@ A good description helps us to review and understand your proposed changes. For
### Target branch for pull requests
Please make all PRs against the `0_15` branch.
Please make all PRs against the `main` branch.
### Updating your code
While the PR is open - and under review by maintainers - you may be asked to modify your PR source code.
You can simply update your own branch, and push changes in response to reviewer recommendations.
Github will pick up the changes so your PR stays up-to-date.
> [!CAUTION]
> Do not use "force-push" while your PR is open!
> It has many subtle and unexpected consequences on our github reposistory.
> For example, we regularly lost review comments when the PR author force-pushes code changes. So, pretty please, do not force-push.
You can find a collection of very useful tips and tricks here: https://github.com/wled-dev/WLED/wiki/How-to-properly-submit-a-PR
### Code style
@ -28,7 +42,7 @@ You are all set if you have enabled `Editor: Detect Indentation` in VS Code.
#### Blocks
Whether the opening bracket of e.g. an `if` block is in the same line as the condition or in a separate line is up to your discretion. If there is only one statement, leaving out block braches is acceptable.
Whether the opening bracket of e.g. an `if` block is in the same line as the condition or in a separate line is up to your discretion. If there is only one statement, leaving out block brackets is acceptable.
Good:
```cpp
@ -37,6 +51,11 @@ if (a == b) {
}
```
```cpp
if (a == b) doStuff(a);
```
Acceptable - however the first variant is usually easier to read:
```cpp
if (a == b)
{
@ -44,12 +63,9 @@ if (a == b)
}
```
```cpp
if (a == b) doStuff(a);
```
There should always be a space between a keyword and its condition and between the condition and brace.
Within the condition, no space should be between the paranthesis and variables.
Within the condition, no space should be between the parenthesis and variables.
Spaces between variables and operators are up to the authors discretion.
There should be no space between function names and their argument parenthesis.
@ -89,4 +105,4 @@ Good:
There is no hard character limit for a comment within a line,
though as a rule of thumb consider wrapping after 120 characters.
Inline comments are OK if they describe that line only and are not exceedingly wide.
Inline comments are OK if they describe that line only and are not exceedingly wide.

307
LICENSE
View File

@ -1,21 +1,294 @@
MIT License
Copyright (c) 2016-present Christian Schwinne and individual WLED contributors
Licensed under the EUPL v. 1.2 or later
Copyright (c) 2016 Christian Schwinne
EUROPEAN UNION PUBLIC LICENCE v. 1.2
EUPL © the European Union 2007, 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
This European Union Public Licence (the EUPL) applies to the Work (as
defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Work is provided under the terms of this Licence when the Licensor (as
defined below) has placed the following notice immediately following the
copyright notice for the Work:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Licensed under the EUPL
or has expressed by any other means his willingness to license under the EUPL.
1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work: the work or software distributed or communicated by the
Licensor under this Licence, available as Source Code and also as Executable
Code as the case may be.
- Derivative Works: the works or software that could be created by the
Licensee, based upon the Original Work or modifications thereof. This
Licence does not define the extent of modification or dependence on the
Original Work required in order to classify a work as a Derivative Work;
this extent is determined by copyright law applicable in the country
mentioned in Article 15.
- The Work: the Original Work or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which
is meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under
the Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or You: any natural or legal person who makes any usage of
the Work under the terms of the Licence.
- Distribution or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, online or offline, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
2. Scope of the rights granted by the Licence
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
sublicensable licence to do the following, for the duration of copyright
vested in the Original Work:
- use the Work in any circumstance and for all usage,
- reproduce the Work,
- modify the Work, and make Derivative Works based upon the Work,
- communicate to the public, including the right to make available or display
the Work or copies thereof to the public and perform publicly, as the case
may be, the Work,
- distribute the Work or copies thereof,
- lend and rent the Work or copies thereof,
- sublicense rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make
effective the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights
to any patents held by the Licensor, to the extent necessary to make use of
the rights granted on the Work under this Licence.
3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates,
in a notice following the copyright notice attached to the Work, a repository
where the Source Code is easily and freely accessible for as long as the
Licensor continues to distribute or communicate the Work.
4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits
from any exception or limitation to the exclusive rights of the rights owners
in the Work, of the exhaustion of those rights or of other applicable
limitations thereto.
5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: The Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and
a copy of the Licence with every copy of the Work he/she distributes or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes or communicates copies of the
Original Works or Derivative Works, this Distribution or Communication will be
done under the terms of this Licence or of a later version of this Licence
unless the Original Work is expressly distributed only under this version of
the Licence — for example by communicating EUPL v. 1.2 only. The Licensee
(becoming Licensor) cannot offer or impose any additional terms or conditions
on the Work or Derivative Work that alter or restrict the terms of the
Licence.
Compatibility clause: If the Licensee Distributes or Communicates Derivative
Works or copies thereof based upon both the Work and another work licensed
under a Compatible Licence, this Distribution or Communication can be done
under the terms of this Compatible Licence. For the sake of this clause,
Compatible Licence refers to the licences listed in the appendix attached to
this Licence. Should the Licensee's obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available
for as long as the Licensee continues to distribute or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade
names, trademarks, service marks, or names of the Licensor, except as required
for reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she
brings to the Work are owned by him/her or licensed to him/her and that he/she
has the power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
Contributors. It is not a finished work and may therefore contain defects or
bugs inherent to this type of development.
For the above reason, the Work is provided under the Licence on an as is
basis and without warranties of any kind concerning the Work, including
without limitation merchantability, fitness for a particular purpose, absence
of defects or errors, accuracy, non-infringement of intellectual property
rights other than copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a
condition for the grant of any rights to the Work.
8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the
use of the Work, including without limitation, damages for loss of goodwill,
work stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
9. Additional agreements
While distributing the Work, You may choose to conclude an additional
agreement, defining obligations or services consistent with this Licence.
However, if accepting obligations, You may act only on your own behalf and on
your sole responsibility, not on behalf of the original Licensor or any other
Contributor, and only if You agree to indemnify, defend, and hold each
Contributor harmless for any liability incurred by, or claims asserted against
such Contributor by the fact You have accepted any warranty or additional
liability.
10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon I
agree placed under the bottom of a window displaying the text of this Licence
or by affirming consent in any other similar way, in accordance with the rules
of applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this
Licence, such as the use of the Work, the creation by You of a Derivative Work
or the Distribution or Communication by You of the Work or copies thereof.
11. Information to the public
In case of any Distribution or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed or reformed so as necessary to make it
valid and enforceable.
The European Commission may publish other linguistic versions or new versions
of this Licence or updated versions of the Appendix, so far this is required
and reasonable, without reducing the scope of the rights granted by the
Licence. New versions of the Licence will be published with a unique version
number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
14. Jurisdiction
Without prejudice to specific agreement between parties,
- any litigation resulting from the interpretation of this License, arising
between the European Union institutions, bodies, offices or agencies, as a
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
of Justice of the European Union, as laid down in article 272 of the Treaty
on the Functioning of the European Union,
- any litigation arising between other parties and resulting from the
interpretation of this License, will be subject to the exclusive
jurisdiction of the competent court where the Licensor resides or conducts
its primary business.
15. Applicable Law
Without prejudice to specific agreement between parties,
- this Licence shall be governed by the law of the European Union Member State
where the Licensor has his seat, resides or has his registered office,
- this licence shall be governed by Belgian law if the Licensor has no seat,
residence or registered office inside a European Union Member State.
Appendix
Compatible Licences according to Article 5 EUPL are:
- GNU General Public License (GPL) v. 2, v. 3
- GNU Affero General Public License (AGPL) v. 3
- Open Software License (OSL) v. 2.1, v. 3.0
- Eclipse Public License (EPL) v. 1.0
- CeCILL v. 2.0, v. 2.1
- Mozilla Public Licence (MPL) v. 2
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
works other than software
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
Reciprocity (LiLiQ-R+).
The European Commission may update this Appendix to later versions of the
above licences without producing a new version of the EUPL, as long as they
provide the rights granted in Article 2 of this Licence and protect the
covered Source Code from exclusive appropriation.
All other changes or additions to this Appendix require the production of a
new EUPL version.

47
boards/lolin_s3_mini.json Normal file
View File

@ -0,0 +1,47 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"memory_type": "qio_qspi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_LOLIN_S3_MINI",
"-DARDUINO_USB_MODE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0x303A",
"0x8167"
]
],
"mcu": "esp32s3",
"variant": "lolin_s3_mini"
},
"connectivity": [
"bluetooth",
"wifi"
],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "WEMOS LOLIN S3 Mini",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://www.wemos.cc/en/latest/s3/index.html",
"vendor": "WEMOS"
}

View File

@ -0,0 +1,504 @@
/* esp8266_waveform imported from platform source code
Modified for WLED to work around a fault in the NMI handling,
which can result in the system locking up and hard WDT crashes.
Imported from https://github.com/esp8266/Arduino/blob/7e0d20e2b9034994f573a236364e0aef17fd66de/cores/esp8266/core_esp8266_waveform_phase.cpp
*/
/*
esp8266_waveform - General purpose waveform generation and control,
supporting outputs on all pins in parallel.
Copyright (c) 2018 Earle F. Philhower, III. All rights reserved.
Copyright (c) 2020 Dirk O. Kaar.
The core idea is to have a programmable waveform generator with a unique
high and low period (defined in microseconds or CPU clock cycles). TIMER1 is
set to 1-shot mode and is always loaded with the time until the next edge
of any live waveforms.
Up to one waveform generator per pin supported.
Each waveform generator is synchronized to the ESP clock cycle counter, not the
timer. This allows for removing interrupt jitter and delay as the counter
always increments once per 80MHz clock. Changes to a waveform are
contiguous and only take effect on the next waveform transition,
allowing for smooth transitions.
This replaces older tone(), analogWrite(), and the Servo classes.
Everywhere in the code where "ccy" or "ccys" is used, it means ESP.getCycleCount()
clock cycle time, or an interval measured in clock cycles, but not TIMER1
cycles (which may be 2 CPU clock cycles @ 160MHz).
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "core_esp8266_waveform.h"
#include <Arduino.h>
#include "debug.h"
#include "ets_sys.h"
#include <atomic>
// ----- @willmmiles begin patch -----
// Linker magic
extern "C" void usePWMFixedNMI(void) {};
// NMI crash workaround
// Sometimes the NMI fails to return, stalling the CPU. When this happens,
// the next NMI gets a return address /inside the NMI handler function/.
// We work around this by caching the last NMI return address, and restoring
// the epc3 and eps3 registers to the previous values if the observed epc3
// happens to be pointing to the _NMILevelVector function.
extern "C" void _NMILevelVector();
extern "C" void _UserExceptionVector_1(); // the next function after _NMILevelVector
static inline IRAM_ATTR void nmiCrashWorkaround() {
static uintptr_t epc3_backup, eps3_backup;
uintptr_t epc3, eps3;
__asm__ __volatile__("rsr %0,epc3; rsr %1,eps3":"=a"(epc3),"=a" (eps3));
if ((epc3 < (uintptr_t) &_NMILevelVector) || (epc3 >= (uintptr_t) &_UserExceptionVector_1)) {
// Address is good; save backup
epc3_backup = epc3;
eps3_backup = eps3;
} else {
// Address is inside the NMI handler -- restore from backup
__asm__ __volatile__("wsr %0,epc3; wsr %1,eps3"::"a"(epc3_backup),"a"(eps3_backup));
}
}
// ----- @willmmiles end patch -----
// No-op calls to override the PWM implementation
extern "C" void _setPWMFreq_weak(uint32_t freq) { (void) freq; }
extern "C" IRAM_ATTR bool _stopPWM_weak(int pin) { (void) pin; return false; }
extern "C" bool _setPWM_weak(int pin, uint32_t val, uint32_t range) { (void) pin; (void) val; (void) range; return false; }
// Timer is 80MHz fixed. 160MHz CPU frequency need scaling.
constexpr bool ISCPUFREQ160MHZ = clockCyclesPerMicrosecond() == 160;
// Maximum delay between IRQs, Timer1, <= 2^23 / 80MHz
constexpr int32_t MAXIRQTICKSCCYS = microsecondsToClockCycles(10000);
// Maximum servicing time for any single IRQ
constexpr uint32_t ISRTIMEOUTCCYS = microsecondsToClockCycles(18);
// The latency between in-ISR rearming of the timer and the earliest firing
constexpr int32_t IRQLATENCYCCYS = microsecondsToClockCycles(2);
// The SDK and hardware take some time to actually get to our NMI code
constexpr int32_t DELTAIRQCCYS = ISCPUFREQ160MHZ ?
microsecondsToClockCycles(2) >> 1 : microsecondsToClockCycles(2);
// for INFINITE, the NMI proceeds on the waveform without expiry deadline.
// for EXPIRES, the NMI expires the waveform automatically on the expiry ccy.
// for UPDATEEXPIRY, the NMI recomputes the exact expiry ccy and transitions to EXPIRES.
// for UPDATEPHASE, the NMI recomputes the target timings
// for INIT, the NMI initializes nextPeriodCcy, and if expiryCcy != 0 includes UPDATEEXPIRY.
enum class WaveformMode : uint8_t {INFINITE = 0, EXPIRES = 1, UPDATEEXPIRY = 2, UPDATEPHASE = 3, INIT = 4};
// Waveform generator can create tones, PWM, and servos
typedef struct {
uint32_t nextPeriodCcy; // ESP clock cycle when a period begins.
uint32_t endDutyCcy; // ESP clock cycle when going from duty to off
int32_t dutyCcys; // Set next off cycle at low->high to maintain phase
int32_t adjDutyCcys; // Temporary correction for next period
int32_t periodCcys; // Set next phase cycle at low->high to maintain phase
uint32_t expiryCcy; // For time-limited waveform, the CPU clock cycle when this waveform must stop. If WaveformMode::UPDATE, temporarily holds relative ccy count
WaveformMode mode;
bool autoPwm; // perform PWM duty to idle cycle ratio correction under high load at the expense of precise timings
} Waveform;
namespace {
static struct {
Waveform pins[17]; // State of all possible pins
uint32_t states = 0; // Is the pin high or low, updated in NMI so no access outside the NMI code
uint32_t enabled = 0; // Is it actively running, updated in NMI so no access outside the NMI code
// Enable lock-free by only allowing updates to waveform.states and waveform.enabled from IRQ service routine
int32_t toSetBits = 0; // Message to the NMI handler to start/modify exactly one waveform
int32_t toDisableBits = 0; // Message to the NMI handler to disable exactly one pin from waveform generation
// toSetBits temporaries
// cheaper than packing them in every Waveform, since we permit only one use at a time
uint32_t phaseCcy; // positive phase offset ccy count
int8_t alignPhase; // < 0 no phase alignment, otherwise starts waveform in relative phase offset to given pin
uint32_t(*timer1CB)() = nullptr;
bool timer1Running = false;
uint32_t nextEventCcy;
} waveform;
}
// Interrupt on/off control
static IRAM_ATTR void timer1Interrupt();
// Non-speed critical bits
#pragma GCC optimize ("Os")
static void initTimer() {
timer1_disable();
ETS_FRC_TIMER1_INTR_ATTACH(NULL, NULL);
ETS_FRC_TIMER1_NMI_INTR_ATTACH(timer1Interrupt);
timer1_enable(TIM_DIV1, TIM_EDGE, TIM_SINGLE);
waveform.timer1Running = true;
timer1_write(IRQLATENCYCCYS); // Cause an interrupt post-haste
}
static void IRAM_ATTR deinitTimer() {
ETS_FRC_TIMER1_NMI_INTR_ATTACH(NULL);
timer1_disable();
timer1_isr_init();
waveform.timer1Running = false;
}
extern "C" {
// Set a callback. Pass in NULL to stop it
void setTimer1Callback_weak(uint32_t (*fn)()) {
waveform.timer1CB = fn;
std::atomic_thread_fence(std::memory_order_acq_rel);
if (!waveform.timer1Running && fn) {
initTimer();
} else if (waveform.timer1Running && !fn && !waveform.enabled) {
deinitTimer();
}
}
// Start up a waveform on a pin, or change the current one. Will change to the new
// waveform smoothly on next low->high transition. For immediate change, stopWaveform()
// first, then it will immediately begin.
int startWaveformClockCycles_weak(uint8_t pin, uint32_t highCcys, uint32_t lowCcys,
uint32_t runTimeCcys, int8_t alignPhase, uint32_t phaseOffsetCcys, bool autoPwm) {
uint32_t periodCcys = highCcys + lowCcys;
if (periodCcys < MAXIRQTICKSCCYS) {
if (!highCcys) {
periodCcys = (MAXIRQTICKSCCYS / periodCcys) * periodCcys;
}
else if (!lowCcys) {
highCcys = periodCcys = (MAXIRQTICKSCCYS / periodCcys) * periodCcys;
}
}
// sanity checks, including mixed signed/unsigned arithmetic safety
if ((pin > 16) || isFlashInterfacePin(pin) || (alignPhase > 16) ||
static_cast<int32_t>(periodCcys) <= 0 ||
static_cast<int32_t>(highCcys) < 0 || static_cast<int32_t>(lowCcys) < 0) {
return false;
}
Waveform& wave = waveform.pins[pin];
wave.dutyCcys = highCcys;
wave.adjDutyCcys = 0;
wave.periodCcys = periodCcys;
wave.autoPwm = autoPwm;
waveform.alignPhase = (alignPhase < 0) ? -1 : alignPhase;
waveform.phaseCcy = phaseOffsetCcys;
std::atomic_thread_fence(std::memory_order_acquire);
const uint32_t pinBit = 1UL << pin;
if (!(waveform.enabled & pinBit)) {
// wave.nextPeriodCcy and wave.endDutyCcy are initialized by the ISR
wave.expiryCcy = runTimeCcys; // in WaveformMode::INIT, temporarily hold relative cycle count
wave.mode = WaveformMode::INIT;
if (!wave.dutyCcys) {
// If initially at zero duty cycle, force GPIO off
if (pin == 16) {
GP16O = 0;
}
else {
GPOC = pinBit;
}
}
std::atomic_thread_fence(std::memory_order_release);
waveform.toSetBits = 1UL << pin;
std::atomic_thread_fence(std::memory_order_release);
if (!waveform.timer1Running) {
initTimer();
}
else if (T1V > IRQLATENCYCCYS) {
// Must not interfere if Timer is due shortly
timer1_write(IRQLATENCYCCYS);
}
}
else {
wave.mode = WaveformMode::INFINITE; // turn off possible expiry to make update atomic from NMI
std::atomic_thread_fence(std::memory_order_release);
if (runTimeCcys) {
wave.expiryCcy = runTimeCcys; // in WaveformMode::UPDATEEXPIRY, temporarily hold relative cycle count
wave.mode = WaveformMode::UPDATEEXPIRY;
std::atomic_thread_fence(std::memory_order_release);
waveform.toSetBits = 1UL << pin;
} else if (alignPhase >= 0) {
// @willmmiles new feature
wave.mode = WaveformMode::UPDATEPHASE; // recalculate start
std::atomic_thread_fence(std::memory_order_release);
waveform.toSetBits = 1UL << pin;
}
}
std::atomic_thread_fence(std::memory_order_acq_rel);
while (waveform.toSetBits) {
esp_yield(); // Wait for waveform to update
std::atomic_thread_fence(std::memory_order_acquire);
}
return true;
}
// Stops a waveform on a pin
IRAM_ATTR int stopWaveform_weak(uint8_t pin) {
// Can't possibly need to stop anything if there is no timer active
if (!waveform.timer1Running) {
return false;
}
// If user sends in a pin >16 but <32, this will always point to a 0 bit
// If they send >=32, then the shift will result in 0 and it will also return false
std::atomic_thread_fence(std::memory_order_acquire);
const uint32_t pinBit = 1UL << pin;
if (waveform.enabled & pinBit) {
waveform.toDisableBits = 1UL << pin;
std::atomic_thread_fence(std::memory_order_release);
// Must not interfere if Timer is due shortly
if (T1V > IRQLATENCYCCYS) {
timer1_write(IRQLATENCYCCYS);
}
while (waveform.toDisableBits) {
/* no-op */ // Can't delay() since stopWaveform may be called from an IRQ
std::atomic_thread_fence(std::memory_order_acquire);
}
}
if (!waveform.enabled && !waveform.timer1CB) {
deinitTimer();
}
return true;
}
};
// Speed critical bits
#pragma GCC optimize ("O2")
// For dynamic CPU clock frequency switch in loop the scaling logic would have to be adapted.
// Using constexpr makes sure that the CPU clock frequency is compile-time fixed.
static inline IRAM_ATTR int32_t scaleCcys(const int32_t ccys, const bool isCPU2X) {
if (ISCPUFREQ160MHZ) {
return isCPU2X ? ccys : (ccys >> 1);
}
else {
return isCPU2X ? (ccys << 1) : ccys;
}
}
static IRAM_ATTR void timer1Interrupt() {
const uint32_t isrStartCcy = ESP.getCycleCount();
//int32_t clockDrift = isrStartCcy - waveform.nextEventCcy;
// ----- @willmmiles begin patch -----
nmiCrashWorkaround();
// ----- @willmmiles end patch -----
const bool isCPU2X = CPU2X & 1;
if ((waveform.toSetBits && !(waveform.enabled & waveform.toSetBits)) || waveform.toDisableBits) {
// Handle enable/disable requests from main app.
waveform.enabled = (waveform.enabled & ~waveform.toDisableBits) | waveform.toSetBits; // Set the requested waveforms on/off
// Find the first GPIO being generated by checking GCC's find-first-set (returns 1 + the bit of the first 1 in an int32_t)
waveform.toDisableBits = 0;
}
if (waveform.toSetBits) {
const int toSetPin = __builtin_ffs(waveform.toSetBits) - 1;
Waveform& wave = waveform.pins[toSetPin];
switch (wave.mode) {
case WaveformMode::INIT:
waveform.states &= ~waveform.toSetBits; // Clear the state of any just started
if (waveform.alignPhase >= 0 && waveform.enabled & (1UL << waveform.alignPhase)) {
wave.nextPeriodCcy = waveform.pins[waveform.alignPhase].nextPeriodCcy + scaleCcys(waveform.phaseCcy, isCPU2X);
}
else {
wave.nextPeriodCcy = waveform.nextEventCcy;
}
if (!wave.expiryCcy) {
wave.mode = WaveformMode::INFINITE;
break;
}
// fall through
case WaveformMode::UPDATEEXPIRY:
// in WaveformMode::UPDATEEXPIRY, expiryCcy temporarily holds relative CPU cycle count
wave.expiryCcy = wave.nextPeriodCcy + scaleCcys(wave.expiryCcy, isCPU2X);
wave.mode = WaveformMode::EXPIRES;
break;
// @willmmiles new feature
case WaveformMode::UPDATEPHASE:
// in WaveformMode::UPDATEPHASE, we recalculate the targets
if ((waveform.alignPhase >= 0) && (waveform.enabled & (1UL << waveform.alignPhase))) {
// Compute phase shift to realign with target
auto const newPeriodCcy = waveform.pins[waveform.alignPhase].nextPeriodCcy + scaleCcys(waveform.phaseCcy, isCPU2X);
auto const period = scaleCcys(wave.periodCcys, isCPU2X);
auto shift = ((static_cast<int32_t> (newPeriodCcy - wave.nextPeriodCcy) + period/2) % period) - (period/2);
wave.nextPeriodCcy += static_cast<uint32_t>(shift);
if (static_cast<int32_t>(wave.endDutyCcy - wave.nextPeriodCcy) > 0) {
wave.endDutyCcy = wave.nextPeriodCcy;
}
}
default:
break;
}
waveform.toSetBits = 0;
}
// Exit the loop if the next event, if any, is sufficiently distant.
const uint32_t isrTimeoutCcy = isrStartCcy + ISRTIMEOUTCCYS;
uint32_t busyPins = waveform.enabled;
waveform.nextEventCcy = isrStartCcy + MAXIRQTICKSCCYS;
uint32_t now = ESP.getCycleCount();
uint32_t isrNextEventCcy = now;
while (busyPins) {
if (static_cast<int32_t>(isrNextEventCcy - now) > IRQLATENCYCCYS) {
waveform.nextEventCcy = isrNextEventCcy;
break;
}
isrNextEventCcy = waveform.nextEventCcy;
uint32_t loopPins = busyPins;
while (loopPins) {
const int pin = __builtin_ffsl(loopPins) - 1;
const uint32_t pinBit = 1UL << pin;
loopPins ^= pinBit;
Waveform& wave = waveform.pins[pin];
/* @willmmiles - wtf? We don't want to accumulate drift
if (clockDrift) {
wave.endDutyCcy += clockDrift;
wave.nextPeriodCcy += clockDrift;
wave.expiryCcy += clockDrift;
}
*/
uint32_t waveNextEventCcy = (waveform.states & pinBit) ? wave.endDutyCcy : wave.nextPeriodCcy;
if (WaveformMode::EXPIRES == wave.mode &&
static_cast<int32_t>(waveNextEventCcy - wave.expiryCcy) >= 0 &&
static_cast<int32_t>(now - wave.expiryCcy) >= 0) {
// Disable any waveforms that are done
waveform.enabled ^= pinBit;
busyPins ^= pinBit;
}
else {
const int32_t overshootCcys = now - waveNextEventCcy;
if (overshootCcys >= 0) {
const int32_t periodCcys = scaleCcys(wave.periodCcys, isCPU2X);
if (waveform.states & pinBit) {
// active configuration and forward are 100% duty
if (wave.periodCcys == wave.dutyCcys) {
wave.nextPeriodCcy += periodCcys;
wave.endDutyCcy = wave.nextPeriodCcy;
}
else {
if (wave.autoPwm) {
wave.adjDutyCcys += overshootCcys;
}
waveform.states ^= pinBit;
if (16 == pin) {
GP16O = 0;
}
else {
GPOC = pinBit;
}
}
waveNextEventCcy = wave.nextPeriodCcy;
}
else {
wave.nextPeriodCcy += periodCcys;
if (!wave.dutyCcys) {
wave.endDutyCcy = wave.nextPeriodCcy;
}
else {
int32_t dutyCcys = scaleCcys(wave.dutyCcys, isCPU2X);
if (dutyCcys <= wave.adjDutyCcys) {
dutyCcys >>= 1;
wave.adjDutyCcys -= dutyCcys;
}
else if (wave.adjDutyCcys) {
dutyCcys -= wave.adjDutyCcys;
wave.adjDutyCcys = 0;
}
wave.endDutyCcy = now + dutyCcys;
if (static_cast<int32_t>(wave.endDutyCcy - wave.nextPeriodCcy) > 0) {
wave.endDutyCcy = wave.nextPeriodCcy;
}
waveform.states |= pinBit;
if (16 == pin) {
GP16O = 1;
}
else {
GPOS = pinBit;
}
}
waveNextEventCcy = wave.endDutyCcy;
}
if (WaveformMode::EXPIRES == wave.mode && static_cast<int32_t>(waveNextEventCcy - wave.expiryCcy) > 0) {
waveNextEventCcy = wave.expiryCcy;
}
}
if (static_cast<int32_t>(waveNextEventCcy - isrTimeoutCcy) >= 0) {
busyPins ^= pinBit;
if (static_cast<int32_t>(waveform.nextEventCcy - waveNextEventCcy) > 0) {
waveform.nextEventCcy = waveNextEventCcy;
}
}
else if (static_cast<int32_t>(isrNextEventCcy - waveNextEventCcy) > 0) {
isrNextEventCcy = waveNextEventCcy;
}
}
now = ESP.getCycleCount();
}
//clockDrift = 0;
}
int32_t callbackCcys = 0;
if (waveform.timer1CB) {
callbackCcys = scaleCcys(waveform.timer1CB(), isCPU2X);
}
now = ESP.getCycleCount();
int32_t nextEventCcys = waveform.nextEventCcy - now;
// Account for unknown duration of timer1CB().
if (waveform.timer1CB && nextEventCcys > callbackCcys) {
waveform.nextEventCcy = now + callbackCcys;
nextEventCcys = callbackCcys;
}
// Timer is 80MHz fixed. 160MHz CPU frequency need scaling.
int32_t deltaIrqCcys = DELTAIRQCCYS;
int32_t irqLatencyCcys = IRQLATENCYCCYS;
if (isCPU2X) {
nextEventCcys >>= 1;
deltaIrqCcys >>= 1;
irqLatencyCcys >>= 1;
}
// Firing timer too soon, the NMI occurs before ISR has returned.
if (nextEventCcys < irqLatencyCcys + deltaIrqCcys) {
waveform.nextEventCcy = now + IRQLATENCYCCYS + DELTAIRQCCYS;
nextEventCcys = irqLatencyCcys;
}
else {
nextEventCcys -= deltaIrqCcys;
}
// Register access is fast and edge IRQ was configured before.
T1L = nextEventCcys;
}

1965
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "wled",
"version": "0.15.0-b2",
"version": "0.16.0-alpha",
"description": "Tools for WLED project",
"main": "tools/cdata.js",
"directories": {
@ -14,18 +14,21 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/Aircoookie/WLED.git"
"url": "git+https://github.com/wled-dev/WLED.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Aircoookie/WLED/issues"
"url": "https://github.com/wled-dev/WLED/issues"
},
"homepage": "https://github.com/Aircoookie/WLED#readme",
"homepage": "https://github.com/wled-dev/WLED#readme",
"dependencies": {
"clean-css": "^5.3.3",
"html-minifier-terser": "^7.2.0",
"inliner": "^1.13.1",
"nodemon": "^3.0.2"
"web-resource-inliner": "^7.0.0",
"nodemon": "^3.1.9"
},
"engines": {
"node": ">=20.0.0"
}
}
}

View File

@ -1,3 +1,21 @@
Import('env')
Import("env")
import shutil
env.Execute("npm run build")
node_ex = shutil.which("node")
# Check if Node.js is installed and present in PATH if it failed, abort the build
if node_ex is None:
print('\x1b[0;31;43m' + 'Node.js is not installed or missing from PATH html css js will not be processed check https://kno.wled.ge/advanced/compiling-wled/' + '\x1b[0m')
exitCode = env.Execute("null")
exit(exitCode)
else:
# Install the necessary node packages for the pre-build asset bundling script
print('\x1b[6;33;42m' + 'Installing node packages' + '\x1b[0m')
env.Execute("npm ci")
# Call the bundling script
exitCode = env.Execute("npm run build")
# If it failed, abort the build
if (exitCode):
print('\x1b[0;31;43m' + 'npm run build fails check https://kno.wled.ge/advanced/compiling-wled/' + '\x1b[0m')
exit(exitCode)

View File

@ -0,0 +1,115 @@
Import('env')
import os.path
from collections import deque
from pathlib import Path # For OS-agnostic path manipulation
from platformio.package.manager.library import LibraryPackageManager
usermod_dir = Path(env["PROJECT_DIR"]) / "usermods"
all_usermods = [f for f in usermod_dir.iterdir() if f.is_dir() and f.joinpath('library.json').exists()]
if env['PIOENV'] == "usermods":
# Add all usermods
env.GetProjectConfig().set(f"env:usermods", 'custom_usermods', " ".join([f.name for f in all_usermods]))
def find_usermod(mod: str):
"""Locate this library in the usermods folder.
We do this to avoid needing to rename a bunch of folders;
this could be removed later
"""
# Check name match
mp = usermod_dir / mod
if mp.exists():
return mp
mp = usermod_dir / f"{mod}_v2"
if mp.exists():
return mp
mp = usermod_dir / f"usermod_v2_{mod}"
if mp.exists():
return mp
raise RuntimeError(f"Couldn't locate module {mod} in usermods directory!")
usermods = env.GetProjectOption("custom_usermods","")
if usermods:
# Inject usermods in to project lib_deps
proj = env.GetProjectConfig()
deps = env.GetProjectOption('lib_deps')
src_dir = proj.get("platformio", "src_dir")
src_dir = src_dir.replace('\\','/')
mod_paths = {mod: find_usermod(mod) for mod in usermods.split()}
usermods = [f"{mod} = symlink://{path}" for mod, path in mod_paths.items()]
proj.set("env:" + env['PIOENV'], 'lib_deps', deps + usermods)
# Force usermods to be installed in to the environment build state before the LDF runs
# Otherwise we won't be able to see them until it's too late to change their paths for LDF
# Logic is largely borrowed from PlaformIO internals
not_found_specs = []
for spec in usermods:
found = False
for storage_dir in env.GetLibSourceDirs():
#print(f"Checking {storage_dir} for {spec}")
lm = LibraryPackageManager(storage_dir)
if lm.get_package(spec):
#print("Found!")
found = True
break
if not found:
#print("Missing!")
not_found_specs.append(spec)
if not_found_specs:
lm = LibraryPackageManager(
env.subst(os.path.join("$PROJECT_LIBDEPS_DIR", "$PIOENV"))
)
for spec in not_found_specs:
#print(f"LU: forcing install of {spec}")
lm.install(spec)
# Utility function for assembling usermod include paths
def cached_add_includes(dep, dep_cache: set, includes: deque):
""" Add dep's include paths to includes if it's not in the cache """
if dep not in dep_cache:
dep_cache.add(dep)
for include in dep.get_include_dirs():
if include not in includes:
includes.appendleft(include)
if usermod_dir not in Path(dep.src_dir).parents:
# Recurse, but only for NON-usermods
for subdep in dep.depbuilders:
cached_add_includes(subdep, dep_cache, includes)
# Monkey-patch ConfigureProjectLibBuilder to mark up the dependencies
# Save the old value
old_ConfigureProjectLibBuilder = env.ConfigureProjectLibBuilder
# Our new wrapper
def wrapped_ConfigureProjectLibBuilder(xenv):
# Update usermod properties
# Set libArchive before build actions are added
for um in (um for um in xenv.GetLibBuilders() if usermod_dir in Path(um.src_dir).parents):
build = um._manifest.get("build", {})
build["libArchive"] = False
um._manifest["build"] = build
# Call the wrapped function
result = old_ConfigureProjectLibBuilder.clone(xenv)()
# Fix up include paths
# In PlatformIO >=6.1.17, this could be done prior to ConfigureProjectLibBuilder
wled_dir = xenv["PROJECT_SRC_DIR"]
# Build a list of dependency include dirs
# TODO: Find out if this is the order that PlatformIO/SCons puts them in??
processed_deps = set()
extra_include_dirs = deque() # Deque used for fast prepend
for dep in result.depbuilders:
cached_add_includes(dep, processed_deps, extra_include_dirs)
for um in [dep for dep in result.depbuilders if usermod_dir in Path(dep.src_dir).parents]:
# Add the wled folder to the include path
um.env.PrependUnique(CPPPATH=wled_dir)
# Add WLED's own dependencies
for dir in extra_include_dirs:
um.env.PrependUnique(CPPPATH=dir)
return result
# Apply the wrapper
env.AddMethod(wrapped_ConfigureProjectLibBuilder, "ConfigureProjectLibBuilder")

View File

@ -1,9 +1,24 @@
# Little convenience script to get an object dump
# You may add "-S" to the objdump commandline (i.e. replace "-D -C " with "-d -S -C ")
# to get source code intermixed with disassembly (SLOW !)
Import('env')
def obj_dump_after_elf(source, target, env):
platform = env.PioPlatform()
board = env.BoardConfig()
mcu = board.get("build.mcu", "esp32")
print("Create firmware.asm")
env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm")
if mcu == "esp8266":
env.Execute("xtensa-lx106-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm")
if mcu == "esp32":
env.Execute("xtensa-esp32-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm")
if mcu == "esp32s2":
env.Execute("xtensa-esp32s2-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm")
if mcu == "esp32s3":
env.Execute("xtensa-esp32s3-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm")
if mcu == "esp32c3":
env.Execute("riscv32-esp-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm")
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf])

View File

@ -19,8 +19,9 @@ def _create_dirs(dirs=["map", "release", "firmware"]):
os.makedirs(os.path.join(OUTPUT_DIR, d), exist_ok=True)
def create_release(source):
release_name = _get_cpp_define_value(env, "WLED_RELEASE_NAME")
if release_name:
release_name_def = _get_cpp_define_value(env, "WLED_RELEASE_NAME")
if release_name_def:
release_name = release_name_def.replace("\\\"", "")
version = _get_cpp_define_value(env, "WLED_VERSION")
release_file = os.path.join(OUTPUT_DIR, "release", f"WLED_{version}_{release_name}.bin")
release_gz_file = release_file + ".gz"
@ -36,6 +37,8 @@ def create_release(source):
def bin_rename_copy(source, target, env):
_create_dirs()
variant = env["PIOENV"]
builddir = os.path.join(env["PROJECT_BUILD_DIR"], variant)
source_map = os.path.join(builddir, env["PROGNAME"] + ".map")
# create string with location and file names based on variant
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
@ -44,7 +47,11 @@ def bin_rename_copy(source, target, env):
# copy firmware.map to map/<variant>.map
if os.path.isfile("firmware.map"):
shutil.move("firmware.map", map_file)
print("Found linker mapfile firmware.map")
shutil.copy("firmware.map", map_file)
if os.path.isfile(source_map):
print(f"Found linker mapfile {source_map}")
shutil.copy(source_map, map_file)
def bin_gzip(source, target):
# only create gzip for esp8266

View File

@ -10,7 +10,7 @@
# ------------------------------------------------------------------------------
# CI/release binaries
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, nodemcuv2_160, esp8266_2m_160, esp01_1m_full_160, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi, esp32s3_4M_PSRAM_qspi, esp32_wrover
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, nodemcuv2_160, esp8266_2m_160, esp01_1m_full_160, nodemcuv2_compat, esp8266_2m_compat, esp01_1m_full_compat, esp32dev, esp32dev_V4, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_16MB_opi, esp32s3dev_8MB_opi, esp32s3_4M_qspi, esp32_wrover, usermods
src_dir = ./wled00
data_dir = ./wled00/data
@ -86,7 +86,6 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG
# This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m).
# ------------------------------------------------------------------------------
build_flags =
-Wno-attributes
-DMQTT_MAX_PACKET_SIZE=1024
-DSECURE_CLIENT=SECURE_CLIENT_BEARSSL
-DBEARSSL_SSL_BASIC
@ -104,10 +103,6 @@ build_flags =
build_unflags =
build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags}
build_flags_esp32 = ${common.build_flags} ${esp32.build_flags}
build_flags_esp32_V4= ${common.build_flags} ${esp32_idf_V4.build_flags}
ldscript_1m128k = eagle.flash.1m128.ld
ldscript_2m512k = eagle.flash.2m512.ld
ldscript_2m1m = eagle.flash.2m1m.ld
@ -119,7 +114,9 @@ extra_scripts =
post:pio-scripts/output_bins.py
post:pio-scripts/strip-floats.py
pre:pio-scripts/user_config_copy.py
pre:pio-scripts/load_usermods.py
pre:pio-scripts/build_ui.py
; post:pio-scripts/obj-dump.py ;; convenience script to create a disassembly dump of the firmware (hardcore debugging)
# ------------------------------------------------------------------------------
# COMMON SETTINGS:
@ -142,8 +139,9 @@ lib_compat_mode = strict
lib_deps =
fastled/FastLED @ 3.6.0
IRremoteESP8266 @ 2.8.2
makuna/NeoPixelBus @ 2.7.9
https://github.com/Aircoookie/ESPAsyncWebServer.git @ 2.2.1
makuna/NeoPixelBus @ 2.8.3
#https://github.com/makuna/NeoPixelBus.git#CoreShaderBeta
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.0
# for I2C interface
;Wire
# ESP-NOW library
@ -160,25 +158,18 @@ lib_deps =
;adafruit/Adafruit BMP280 Library @ 2.1.0
;adafruit/Adafruit CCS811 Library @ 1.0.4
;adafruit/Adafruit Si7021 Library @ 1.4.0
#For ADS1115 sensor uncomment following
;adafruit/Adafruit BusIO @ 1.13.2
;adafruit/Adafruit ADS1X15 @ 2.4.0
#For MAX1704x Lipo Monitor / Fuel Gauge uncomment following
; https://github.com/adafruit/Adafruit_BusIO @ 1.14.5
; https://github.com/adafruit/Adafruit_MAX1704X @ 1.0.2
#For MPU6050 IMU uncomment follwoing
;electroniccats/MPU6050 @1.0.1
# For -D USERMOD_ANIMARTRIX
# CC BY-NC 3.0 licensed effects by Stefan Petrick, include this usermod only if you accept the terms!
;https://github.com/netmindz/animartrix.git#18bf17389e57c69f11bc8d04ebe1d215422c7fb7
# SHT85
;robtillaart/SHT85@~0.3.3
# Audioreactive usermod
;kosme/arduinoFFT @ 2.0.0
extra_scripts = ${scripts_defaults.extra_scripts}
[esp8266]
build_unflags = ${common.build_unflags}
build_flags =
-DESP8266
-DFP_IN_IROM
@ -200,32 +191,83 @@ build_flags =
; decrease code cache size and increase IRAM to fit all pixel functions
-D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ;; in case of linker errors like "section `.text1' will not fit in region `iram1_0_seg'"
; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED ;; (experimental) adds some extra heap, but may cause slowdown
-D NON32XFER_HANDLER ;; ask forgiveness for PROGMEM misuse
lib_deps =
#https://github.com/lorol/LITTLEFS.git
ESPAsyncTCP @ 1.2.2
ESPAsyncUDP
ESP8266PWM
${env.lib_deps}
;; compatibilty flags - same as 0.14.0 which seems to work better on some 8266 boards. Not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
build_flags_compat =
-DESP8266
-DFP_IN_IROM
;;-Wno-deprecated-declarations
-Wno-misleading-indentation
;;-Wno-attributes ;; silence warnings about unknown attribute 'maybe_unused' in NeoPixelBus
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
-DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
-DVTABLES_IN_FLASH
-DMIMETYPE_MINIMAL
-DWLED_SAVE_IRAM ;; needed to prevent linker error
;; this platform version was used for WLED 0.14.0
platform_compat = espressif8266@4.2.0
platform_packages_compat =
platformio/toolchain-xtensa @ ~2.100300.220621 #2.40802.200502
platformio/tool-esptool #@ ~1.413.0
platformio/tool-esptoolpy #@ ~1.30000.0
;; experimental - for using older NeoPixelBus 2.7.9
lib_deps_compat =
ESPAsyncTCP @ 1.2.2
ESPAsyncUDP
ESP8266PWM
fastled/FastLED @ 3.6.0
IRremoteESP8266 @ 2.8.2
makuna/NeoPixelBus @ 2.7.9
https://github.com/blazoncek/QuickESPNow.git#optional-debug
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.0
[esp32_all_variants]
lib_deps =
willmmiles/AsyncTCP @ 1.3.1
bitbank2/AnimatedGIF@^1.4.7
https://github.com/Aircoookie/GifDecoder#bc3af18
build_flags =
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D WLED_ENABLE_GIF
[esp32]
#platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.3/platform-espressif32-2.0.2.3.zip
platform = espressif32@3.5.0
platform_packages = framework-arduinoespressif32 @ https://github.com/Aircoookie/arduino-esp32.git#1.0.6.4
build_unflags = ${common.build_unflags}
build_flags = -g
-DARDUINO_ARCH_ESP32
#-DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0
#use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x
-D LOROL_LITTLEFS
; -DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
${esp32_all_variants.build_flags}
tiny_partitions = tools/WLED_ESP32_2MB_noOTA.csv
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
extended_partitions = tools/WLED_ESP32_4MB_700k_FS.csv
big_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem, coredump support
large_partitions = tools/WLED_ESP32_8MB.csv
extreme_partitions = tools/WLED_ESP32_16MB_9MB_FS.csv
lib_deps =
https://github.com/lorol/LITTLEFS.git
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${esp32_all_variants.lib_deps}
${env.lib_deps}
# additional build flags for audioreactive
AR_build_flags = -D USERMOD_AUDIOREACTIVE
AR_lib_deps = kosme/arduinoFFT @ 2.0.0
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
# additional build flags for audioreactive - must be applied globally
AR_build_flags = ;; -fsingle-precision-constant ;; forces ArduinoFFT to use float math (2x faster)
AR_lib_deps = ;; for pre-usermod-library platformio_override compatibility
[esp32_idf_V4]
;; experimental build environment for ESP32 using ESP-IDF 4.4.x / arduino-esp32 v2.0.5
@ -233,73 +275,78 @@ AR_lib_deps = kosme/arduinoFFT @ 2.0.0
;;
;; please note that you can NOT update existing ESP32 installs with a "V4" build. Also updating by OTA will not work properly.
;; You need to completely erase your device (esptool erase_flash) first, then install the "V4" build from VSCode+platformio.
platform = espressif32@5.3.0
platform_packages =
;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them)
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.06.02/platform-espressif32.zip ;; Tasmota Arduino Core 2.0.9 with IPv6 support, based on IDF 4.4.4
build_unflags = ${common.build_unflags}
build_flags = -g
-Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
-DARDUINO_ARCH_ESP32 -DESP32
#-DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
${esp32_all_variants.build_flags}
-D WLED_ENABLE_DMX_INPUT
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${esp32_all_variants.lib_deps}
https://github.com/someweisguy/esp_dmx.git#47db25d
${env.lib_deps}
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
[esp32s2]
;; generic definitions for all ESP32-S2 boards
platform = espressif32@5.3.0
platform_packages =
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = -g
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32S2
-DCONFIG_IDF_TARGET_ESP32S2=1
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
-DCO
-DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
;; ARDUINO_USB_CDC_ON_BOOT
${esp32_all_variants.build_flags}
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${esp32_all_variants.lib_deps}
${env.lib_deps}
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
[esp32c3]
;; generic definitions for all ESP32-C3 boards
platform = espressif32@5.3.0
platform_packages =
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = -g
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32C3
-DCONFIG_IDF_TARGET_ESP32C3=1
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DCO
-DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
;; ARDUINO_USB_CDC_ON_BOOT
${esp32_all_variants.build_flags}
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${esp32_all_variants.lib_deps}
${env.lib_deps}
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
board_build.flash_mode = qio
[esp32s3]
;; generic definitions for all ESP32-S3 boards
platform = espressif32@5.3.0
platform_packages =
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = -g
-DESP32
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32S3
-DCONFIG_IDF_TARGET_ESP32S3=1
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_DFU_ON_BOOT=0
-DCO
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
;; ARDUINO_USB_MODE, ARDUINO_USB_CDC_ON_BOOT
${esp32_all_variants.build_flags}
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${esp32_all_variants.lib_deps}
${env.lib_deps}
board_build.partitions = ${esp32.large_partitions} ;; default partioning for 8MB flash - can be overridden in build envs
# ------------------------------------------------------------------------------
@ -312,14 +359,26 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 #-DWLED_DISABLE_2D
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP8266\" #-DWLED_DISABLE_2D
-D WLED_DISABLE_PARTICLESYSTEM2D
lib_deps = ${esp8266.lib_deps}
monitor_filters = esp8266_exception_decoder
[env:nodemcuv2_compat]
extends = env:nodemcuv2
;; using platform version and build options from WLED 0.14.0
platform = ${esp8266.platform_compat}
platform_packages = ${esp8266.platform_packages_compat}
build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEASE_NAME=\"ESP8266_compat\" #-DWLED_DISABLE_2D
-D WLED_DISABLE_PARTICLESYSTEM2D
;; lib_deps = ${esp8266.lib_deps_compat} ;; experimental - use older NeoPixelBus 2.7.9
[env:nodemcuv2_160]
extends = env:nodemcuv2
board_build.f_cpu = 160000000L
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266_160 #-DWLED_DISABLE_2D
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP8266_160\" #-DWLED_DISABLE_2D
-D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = audioreactive
[env:esp8266_2m]
board = esp_wroom_02
@ -327,13 +386,27 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP02\"
-D WLED_DISABLE_PARTICLESYSTEM2D
-D WLED_DISABLE_PARTICLESYSTEM1D
lib_deps = ${esp8266.lib_deps}
[env:esp8266_2m_compat]
extends = env:esp8266_2m
;; using platform version and build options from WLED 0.14.0
platform = ${esp8266.platform_compat}
platform_packages = ${esp8266.platform_packages_compat}
build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEASE_NAME=\"ESP02_compat\" #-DWLED_DISABLE_2D
-D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D
[env:esp8266_2m_160]
extends = env:esp8266_2m
board_build.f_cpu = 160000000L
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02_160
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP02_160\"
-D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = audioreactive
[env:esp01_1m_full]
board = esp01_1m
@ -341,71 +414,126 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA
; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP01\" -D WLED_DISABLE_OTA
; -D WLED_USE_REAL_MATH ;; may fix wrong sunset/sunrise times, at the cost of 7064 bytes FLASH and 975 bytes RAM
-D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D
lib_deps = ${esp8266.lib_deps}
[env:esp01_1m_full_compat]
extends = env:esp01_1m_full
;; using platform version and build options from WLED 0.14.0
platform = ${esp8266.platform_compat}
platform_packages = ${esp8266.platform_packages_compat}
build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEASE_NAME=\"ESP01_compat\" -D WLED_DISABLE_OTA #-DWLED_DISABLE_2D
-D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D
[env:esp01_1m_full_160]
extends = env:esp01_1m_full
board_build.f_cpu = 160000000L
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01_160 -D WLED_DISABLE_OTA
; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP01_160\" -D WLED_DISABLE_OTA
; -D WLED_USE_REAL_MATH ;; may fix wrong sunset/sunrise times, at the cost of 7064 bytes FLASH and 975 bytes RAM
-D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = audioreactive
[env:esp32dev]
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 #-D WLED_DISABLE_BROWNOUT_DET
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32\" #-D WLED_DISABLE_BROWNOUT_DET
lib_deps = ${esp32.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
[env:esp32dev_audioreactive]
[env:esp32dev_V4]
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_audioreactive #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags}
lib_deps = ${esp32.lib_deps}
${esp32.AR_lib_deps}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_V4\" #-D WLED_DISABLE_BROWNOUT_DET
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio
[env:esp32dev_8M]
board = esp32dev
platform = ${esp32_idf_V4.platform}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_8M\" #-D WLED_DISABLE_BROWNOUT_DET
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.large_partitions}
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
; board_build.f_flash = 80000000L
; board_build.flash_mode = dio
; board_build.flash_mode = qio
[env:esp32dev_16M]
board = esp32dev
platform = ${esp32_idf_V4.platform}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_16M\" #-D WLED_DISABLE_BROWNOUT_DET
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_build.f_flash = 80000000L
board_build.flash_mode = dio
;[env:esp32dev_audioreactive]
;board = esp32dev
;platform = ${esp32.platform}
;platform_packages = ${esp32.platform_packages}
;custom_usermods = audioreactive
;build_unflags = ${common.build_unflags}
;build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_audioreactive\" #-D WLED_DISABLE_BROWNOUT_DET
;lib_deps = ${esp32.lib_deps}
;monitor_filters = esp32_exception_decoder
;board_build.partitions = ${esp32.default_partitions}
;; board_build.f_flash = 80000000L
;; board_build.flash_mode = dio
[env:esp32_eth]
board = esp32-poe
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
-D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.default_partitions}
[env:esp32_wrover]
platform = ${esp32.platform}
extends = esp32_idf_V4
platform = ${esp32_idf_V4.platform}
board = ttgo-t7-v14-mini32
board_build.f_flash = 80000000L
board_build.flash_mode = qio
board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv
board_build.partitions = ${esp32.extended_partitions}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_WROVER
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_WROVER\"
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html
-D LEDPIN=25
lib_deps = ${esp32.lib_deps}
-D DATA_PINS=25
lib_deps = ${esp32_idf_V4.lib_deps}
[env:esp32c3dev]
extends = esp32c3
platform = ${esp32c3.platform}
platform_packages = ${esp32c3.platform_packages}
framework = arduino
board = esp32-c3-devkitm-1
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_RELEASE_NAME=ESP32-C3
board_build.partitions = ${esp32.default_partitions}
build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-C3\"
-D WLED_WATCHDOG_TIMEOUT=0
-DLOLIN_WIFI_FIX ; seems to work much better with this
-DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
@ -414,90 +542,122 @@ upload_speed = 460800
build_unflags = ${common.build_unflags}
lib_deps = ${esp32c3.lib_deps}
[env:esp32s3dev_8MB]
;; ESP32-S3-DevKitC-1 development board, with 8MB FLASH, no PSRAM (flash_mode: qio)
board = esp32-s3-devkitc-1
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
upload_speed = 921600 ; or 460800
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=ESP32-S3_8MB
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
;-D ARDUINO_USB_CDC_ON_BOOT=1 ;; -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
${esp32.AR_build_flags}
lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = tools/WLED_ESP32_8MB.csv
board_build.f_flash = 80000000L
board_build.flash_mode = qio
; board_build.flash_mode = dio ;; try this if you have problems at startup
monitor_filters = esp32_exception_decoder
[env:esp32s3dev_8MB_PSRAM_opi]
;; ESP32-S3 development board, with 8MB FLASH and >= 8MB PSRAM (memory_type: qio_opi)
[env:esp32s3dev_16MB_opi]
;; ESP32-S3 development board, with 16MB FLASH and >= 8MB PSRAM (memory_type: qio_opi)
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=ESP32-S3_8MB_PSRAM_opi
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_16MB_opi\"
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
${esp32.AR_build_flags}
lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = tools/WLED_ESP32_8MB.csv
board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
[env:esp32s3_4M_PSRAM_qspi]
;; ESP32-S3, with 4MB FLASH and <= 4MB PSRAM (memory_type: qio_qspi)
[env:esp32s3dev_8MB_opi]
;; ESP32-S3 development board, with 8MB FLASH and >= 8MB PSRAM (memory_type: qio_opi)
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or 4MB
board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=ESP32-S3_4M_PSRAM_qspi
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_8MB_opi\"
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
lib_deps = ${esp32s3.lib_deps}
board_build.partitions = ${esp32.large_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
[env:esp32S3_wroom2]
;; For ESP32-S3 WROOM-2, a.k.a. ESP32-S3 DevKitC-1 v1.1
;; with >= 16MB FLASH and >= 8MB PSRAM (memory_type: opi_opi)
platform = ${esp32s3.platform}
board = esp32s3camlcd ;; this is the only standard board with "opi_opi"
board_build.arduino.memory_type = opi_opi
upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_WROOM-2\"
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
;; -D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
-D LEDPIN=38 -D DATA_PINS=38 ;; buildin WS2812b LED
-D BTNPIN=0 -D RLYPIN=16 -D IRPIN=17 -D AUDIOPIN=-1
-D WLED_DEBUG
-D SR_DMTYPE=1 -D I2S_SDPIN=13 -D I2S_CKPIN=14 -D I2S_WSPIN=15 -D MCLK_PIN=4 ;; I2S mic
lib_deps = ${esp32s3.lib_deps}
board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
monitor_filters = esp32_exception_decoder
[env:esp32s3_4M_qspi]
;; ESP32-S3, with 4MB FLASH and <= 4MB PSRAM (memory_type: qio_qspi)
board = lolin_s3_mini ;; -S3 mini, 4MB flash 2MB PSRAM
platform = ${esp32s3.platform}
upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_4M_qspi\"
-DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_WATCHDOG_TIMEOUT=0
${esp32.AR_build_flags}
lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
[env:lolin_s2_mini]
platform = ${esp32s2.platform}
platform_packages = ${esp32s2.platform_packages}
board = lolin_s2_mini
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
;board_build.flash_mode = qio
;board_build.f_flash = 80000000L
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = qio
board_build.f_flash = 80000000L
custom_usermods = audioreactive
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S2\"
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MSC_ON_BOOT=0
-DARDUINO_USB_DFU_ON_BOOT=0
-DBOARD_HAS_PSRAM
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_WATCHDOG_TIMEOUT=0
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D LEDPIN=16
-D DATA_PINS=16
-D HW_PIN_SCL=35
-D HW_PIN_SDA=33
-D HW_PIN_CLOCKSPI=7
-D HW_PIN_DATASPI=11
-D HW_PIN_MISOSPI=9
; -D STATUSLED=15
${esp32.AR_build_flags}
lib_deps = ${esp32s2.lib_deps}
${esp32.AR_lib_deps}
[env:usermods]
board = esp32dev
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_USERMODS\"
-DTOUCH_CS=9
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.flash_mode = dio
; custom_usermods = *every folder with library.json* -- injected by pio-scripts/load_usermods.py
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat

View File

@ -5,12 +5,12 @@
# Please visit documentation: https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = WLED_tasmota_1M # define as many as you need
default_envs = WLED_generic8266_1M, esp32dev_V4_dio80 # put the name(s) of your own build environment here. You can define as many as you need
#----------
# SAMPLE
#----------
[env:WLED_tasmota_1M]
[env:WLED_generic8266_1M]
extends = env:esp01_1m_full # when you want to extend the existing environment (define only updated options)
; board = esp01_1m # uncomment when ou need different board
; platform = ${common.platform_wled_default} # uncomment and change when you want particular platform
@ -26,14 +26,19 @@ lib_deps = ${esp8266.lib_deps}
; adafruit/Adafruit BME280 Library@^2.2.2
; Wire
; robtillaart/SHT85@~0.3.3
; gmag11/QuickESPNow ;@ 0.6.2
; ;gmag11/QuickESPNow @ ~0.7.0 # will also load QuickDebug
; https://github.com/blazoncek/QuickESPNow.git#optional-debug ;; exludes debug library
; https://github.com/kosme/arduinoFFT#develop @ 1.9.2+sha.419d7b0 ;; used for USERMOD_AUDIOREACTIVE - using "known working" hash
; build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
; bitbank2/PNGdec@^1.0.1 ;; used for POV display uncomment following
; ${esp32.AR_lib_deps} ;; needed for USERMOD_AUDIOREACTIVE
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp8266.build_flags}
;
; *** To use the below defines/overrides, copy and paste each onto it's own line just below build_flags in the section above.
; *** To use the below defines/overrides, copy and paste each onto its own line just below build_flags in the section above.
;
; Set a release name that may be used to distinguish required binary for flashing
; -D WLED_RELEASE_NAME=\"ESP32_MULTI_USREMODS\"
;
; disable specific features
; -D WLED_DISABLE_OTA
; -D WLED_DISABLE_ALEXA
@ -48,18 +53,26 @@ build_flags = ${common.build_flags_esp8266}
; -D WLED_DISABLE_ESPNOW
; -D WLED_DISABLE_BROWNOUT_DET
;
; enable optional built-in features
; -D WLED_ENABLE_PIXART
; -D WLED_ENABLE_USERMOD_PAGE # if created
; -D WLED_ENABLE_DMX
;
; PIN defines - uncomment and change, if needed:
; -D LEDPIN=2
; -D DATA_PINS=2
; or use this for multiple outputs
; -D DATA_PINS=1,3
; -D BTNPIN=0
; -D IRPIN=4
; -D RLYPIN=12
; -D RLYMDE=1
; -D RLYODRAIN=0
; -D LED_BUILTIN=2 # GPIO of built-in LED
;
; Limit max buses
; -D WLED_MAX_BUSSES=2
; -D WLED_MAX_ANALOG_CHANNELS=3 # only 3 PWM HW pins available
; -D WLED_MAX_DIGITAL_CHANNELS=2 # only 2 HW accelerated pins available
;
; Configure default WiFi
; -D CLIENT_SSID='"MyNetwork"'
@ -90,9 +103,14 @@ build_flags = ${common.build_flags_esp8266}
; -D USERMOD_AUTO_SAVE
; -D AUTOSAVE_AFTER_SEC=90
;
; Use AHT10/AHT15/AHT20 usermod
; -D USERMOD_AHT10
;
; Use INA226 usermod
; -D USERMOD_INA226
;
; Use 4 Line Display usermod with SPI display
; -D USERMOD_FOUR_LINE_DISPLAY
; -D USE_ALT_DISPlAY # mandatory
; -DFLD_SPI_DEFAULT
; -D FLD_TYPE=SSD1306_SPI64
; -D FLD_PIN_CLOCKSPI=14
@ -118,12 +136,13 @@ build_flags = ${common.build_flags_esp8266}
;
; Use PIR sensor usermod and configure it to use GPIO4 and timer of 60s
; -D USERMOD_PIRSWITCH
; -D PIR_SENSOR_PIN=4
; -D PIR_SENSOR_PIN=4 # use -1 to disable usermod
; -D PIR_SENSOR_OFF_SEC=60
; -D PIR_SENSOR_MAX_SENSORS=2 # max allowable sensors (uses OR logic for triggering)
;
; Use Audioreactive usermod and configure I2S microphone
; -D USERMOD_AUDIOREACTIVE
; -D UM_AUDIOREACTIVE_USE_NEW_FFT
; ${esp32.AR_build_flags} ;; default flags required to properly configure ArduinoFFT
; ;; don't forget to add ArduinoFFT to your libs_deps: ${esp32.AR_lib_deps}
; -D AUDIOPIN=-1
; -D DMTYPE=1 # 0-analog/disabled, 1-I2S generic, 2-ES7243, 3-SPH0645, 4-I2S+mclk, 5-I2S PDM
; -D I2S_SDPIN=36
@ -135,28 +154,36 @@ build_flags = ${common.build_flags_esp8266}
; -D TACHO_PIN=33
; -D PWM_PIN=32
;
; Use POV Display usermod
; -D USERMOD_POV_DISPLAY
; Use built-in or custom LED as a status indicator (assumes LED is connected to GPIO16)
; -D STATUSLED=16
;
;
; set the name of the module - make sure there is a quote-backslash-quote before the name and a backslash-quote-quote after the name
; -D SERVERNAME="\"WLED\""
;
;
; set the number of LEDs
; -D DEFAULT_LED_COUNT=30
; -D PIXEL_COUNTS=30
; or this for multiple outputs
; -D PIXEL_COUNTS=30,30
;
; set milliampere limit when using ESP pin to power leds
; -D ABL_MILLIAMPS_DEFAULT=850
;
; enable IR by setting remote type
; -D IRTYPE=0 ;0 Remote disabled | 1 24-key RGB | 2 24-key with CT | 3 40-key blue | 4 40-key RGB | 5 21-key RGB | 6 6-key black | 7 9-key red | 8 JSON remote
;
; set the default LED type
; -D LED_TYPES=22 # see const.h (TYPE_xxxx)
; or this for multiple outputs
; -D LED_TYPES=TYPE_SK6812_RGBW,TYPE_WS2812_RGB
;
; set default color order of your led strip
; -D DEFAULT_LED_COLOR_ORDER=COL_ORDER_GRB
;
; set milliampere limit when using ESP power pin (or inadequate PSU) to power LEDs
; -D ABL_MILLIAMPS_DEFAULT=850
; -D LED_MILLIAMPS_DEFAULT=55
;
; enable IR by setting remote type
; -D IRTYPE=0 # 0 Remote disabled | 1 24-key RGB | 2 24-key with CT | 3 40-key blue | 4 40-key RGB | 5 21-key RGB | 6 6-key black | 7 9-key red | 8 JSON remote
;
; use PSRAM on classic ESP32 rev.1 (rev.3 or above has no issues)
; -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
; -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue # needed only for classic ESP32 rev.1
;
; configure I2C and SPI interface (for various hardware)
; -D I2CSDAPIN=33 # initialise interface
@ -179,7 +206,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
build_flags = ${common.build_flags} ${esp8266.build_flags}
lib_deps = ${esp8266.lib_deps}
[env:d1_mini]
@ -189,7 +216,7 @@ platform_packages = ${common.platform_packages}
upload_speed = 921600
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
build_flags = ${common.build_flags} ${esp8266.build_flags}
lib_deps = ${esp8266.lib_deps}
monitor_filters = esp8266_exception_decoder
@ -199,7 +226,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
build_flags = ${common.build_flags} ${esp8266.build_flags}
lib_deps = ${esp8266.lib_deps}
[env:h803wf]
@ -208,18 +235,17 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED
build_flags = ${common.build_flags} ${esp8266.build_flags} -D DATA_PINS=1 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
[env:esp32dev_qio80]
extends = env:esp32dev # we want to extend the existing esp32dev environment (and define only updated options)
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_qio80 #-D WLED_DISABLE_BROWNOUT_DET
build_flags = ${common.build_flags} ${esp32.build_flags} #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags} ;; optional - includes USERMOD_AUDIOREACTIVE
lib_deps = ${esp32.lib_deps}
${esp32.AR_lib_deps} ;; needed for USERMOD_AUDIOREACTIVE
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
@ -227,27 +253,26 @@ board_build.flash_mode = qio
;; experimental ESP32 env using ESP-IDF V4.4.x
;; Warning: this build environment is not stable!!
;; please erase your device before installing.
extends = esp32_idf_V4 # based on newer "esp-idf V4" platform environment
board = esp32dev
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=ESP32_V4_qio80 #-D WLED_DISABLE_BROWNOUT_DET
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags} ;; includes USERMOD_AUDIOREACTIVE
lib_deps = ${esp32_idf_V4.lib_deps}
${esp32.AR_lib_deps} ;; needed for USERMOD_AUDIOREACTIVE
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32_idf_V4.default_partitions}
board_build.partitions = ${esp32.default_partitions} ;; if you get errors about "out of program space", change this to ${esp32.extended_partitions} or even ${esp32.big_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = dio
[env:esp32s2_saola]
extends = esp32s2
board = esp32-s2-saola-1
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
platform_packages =
platform = ${esp32s2.platform}
platform_packages = ${esp32s2.platform_packages}
framework = arduino
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
board_build.flash_mode = qio
upload_speed = 460800
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME=S2_saola
build_flags = ${common.build_flags} ${esp32s2.build_flags}
;-DLOLIN_WIFI_FIX ;; try this in case Wifi does not work
-DARDUINO_USB_CDC_ON_BOOT=1
lib_deps = ${esp32s2.lib_deps}
@ -255,7 +280,7 @@ lib_deps = ${esp32s2.lib_deps}
[env:esp32s3dev_8MB_PSRAM_qspi]
;; ESP32-TinyS3 development board, with 8MB FLASH and PSRAM (memory_type: qio_qspi)
extends = env:esp32s3dev_8MB_PSRAM_opi
;board = um_tinys3 ; -> needs workaround from https://github.com/Aircoookie/WLED/pull/2905#issuecomment-1328049860
;board = um_tinys3 ; -> needs workaround from https://github.com/wled-dev/WLED/pull/2905#issuecomment-1328049860
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or 4MB
@ -265,7 +290,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_DISABLE_OTA
lib_deps = ${esp8266.lib_deps}
[env:esp8285_H801]
@ -274,7 +299,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_DISABLE_OTA
lib_deps = ${esp8266.lib_deps}
[env:d1_mini_5CH_Shojo_PCB]
@ -283,7 +308,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_USE_SHOJO_PCB
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_USE_SHOJO_PCB ;; NB: WLED_USE_SHOJO_PCB is not used anywhere in the source code. Not sure why its needed.
lib_deps = ${esp8266.lib_deps}
[env:d1_mini_debug]
@ -293,7 +318,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} ${common.debug_flags}
build_flags = ${common.build_flags} ${esp8266.build_flags} ${common.debug_flags}
lib_deps = ${esp8266.lib_deps}
[env:d1_mini_ota]
@ -305,7 +330,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
build_flags = ${common.build_flags} ${esp8266.build_flags}
lib_deps = ${esp8266.lib_deps}
[env:anavi_miracle_controller]
@ -314,7 +339,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=12 -D IRPIN=-1 -D RLYPIN=2
build_flags = ${common.build_flags} ${esp8266.build_flags} -D DATA_PINS=12 -D IRPIN=-1 -D RLYPIN=2
lib_deps = ${esp8266.lib_deps}
[env:esp32c3dev_2MB]
@ -324,7 +349,7 @@ extends = esp32c3
platform = ${esp32c3.platform}
platform_packages = ${esp32c3.platform_packages}
board = esp32-c3-devkitm-1
build_flags = ${common.build_flags} ${esp32c3.build_flags} #-D WLED_RELEASE_NAME=ESP32-C3
build_flags = ${common.build_flags} ${esp32c3.build_flags}
-D WLED_WATCHDOG_TIMEOUT=0
-D WLED_DISABLE_OTA
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
@ -334,51 +359,65 @@ upload_speed = 115200
lib_deps = ${esp32c3.lib_deps}
board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
board_build.flash_mode = dio
board_upload.flash_size = 2MB
board_upload.maximum_size = 2097152
[env:wemos_shield_esp32]
extends = esp32 ;; use default esp32 platform
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 460800
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32}
-D LEDPIN=16
build_flags = ${common.build_flags} ${esp32.build_flags}
-D WLED_RELEASE_NAME=\"ESP32_wemos_shield\"
-D DATA_PINS=16
-D RLYPIN=19
-D BTNPIN=17
-D IRPIN=18
-D UWLED_USE_MY_CONFIG
-UWLED_USE_MY_CONFIG
-D USERMOD_DALLASTEMPERATURE
-D USERMOD_FOUR_LINE_DISPLAY
-D TEMPERATURE_PIN=23
-D USE_ALT_DISPlAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
-D USERMOD_AUDIOREACTIVE
${esp32.AR_build_flags} ;; includes USERMOD_AUDIOREACTIVE
lib_deps = ${esp32.lib_deps}
OneWire@~2.3.5
olikraus/U8g2 @ ^2.28.8
https://github.com/blazoncek/arduinoFFT.git
OneWire@~2.3.5 ;; needed for USERMOD_DALLASTEMPERATURE
olikraus/U8g2 @ ^2.28.8 ;; needed for USERMOD_FOUR_LINE_DISPLAY
${esp32.AR_lib_deps} ;; needed for USERMOD_AUDIOREACTIVE
board_build.partitions = ${esp32.default_partitions}
[env:m5atom]
board = esp32dev
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
[env:esp32_pico-D4]
extends = esp32 ;; use default esp32 platform
board = pico32 ;; pico32-D4 is different from the standard esp32dev
;; hardware details from https://github.com/srg74/WLED-ESP32-pico
build_flags = ${common.build_flags} ${esp32.build_flags}
-D WLED_RELEASE_NAME=\"pico32-D4\" -D SERVERNAME='"WLED-pico32"'
-D WLED_DISABLE_ADALIGHT ;; no serial-to-USB chip on this board - better to disable serial protocols
-D DATA_PINS=2,18 ;; LED pins
-D RLYPIN=19 -D BTNPIN=0 -D IRPIN=-1 ;; no default pin for IR
${esp32.AR_build_flags} ;; include USERMOD_AUDIOREACTIVE
-D UM_AUDIOREACTIVE_ENABLE ;; enable AR by default
;; Audioreactive settings for on-board microphone (ICS-43432)
-D SR_DMTYPE=1 -D I2S_SDPIN=25 -D I2S_WSPIN=15 -D I2S_CKPIN=14
-D SR_SQUELCH=5 -D SR_GAIN=30
lib_deps = ${esp32.lib_deps}
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
${esp32.AR_lib_deps} ;; needed for USERMOD_AUDIOREACTIVE
board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
[env:m5atom]
extends = env:esp32dev # we want to extend the existing esp32dev environment (and define only updated options)
build_flags = ${common.build_flags} ${esp32.build_flags} -D DATA_PINS=27 -D BTNPIN=39
[env:sp501e]
board = esp_wroom_02
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_2m512k}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=1
build_flags = ${common.build_flags} ${esp8266.build_flags} -D DATA_PINS=3 -D BTNPIN=1
lib_deps = ${esp8266.lib_deps}
[env:sp511e]
board = esp_wroom_02
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_2m512k}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3
build_flags = ${common.build_flags} ${esp8266.build_flags} -D DATA_PINS=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3
lib_deps = ${esp8266.lib_deps}
[env:Athom_RGBCW] ;7w and 5w(GU10) bulbs
@ -387,8 +426,8 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,13,5
-D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0
build_flags = ${common.build_flags} ${esp8266.build_flags} -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,13,5
-D LED_TYPES=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0
lib_deps = ${esp8266.lib_deps}
[env:Athom_15w_RGBCW] ;15w bulb
@ -397,8 +436,8 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,5,13
-D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0 -D WLED_USE_IC_CCT
build_flags = ${common.build_flags} ${esp8266.build_flags} -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,5,13
-D LED_TYPES=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0 -D WLED_USE_IC_CCT
lib_deps = ${esp8266.lib_deps}
[env:Athom_3Pin_Controller] ;small controller with only data
@ -407,7 +446,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=-1 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
build_flags = ${common.build_flags} ${esp8266.build_flags} -D BTNPIN=0 -D RLYPIN=-1 -D DATA_PINS=1 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
[env:Athom_4Pin_Controller] ; With clock and data interface
@ -416,7 +455,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=12 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
build_flags = ${common.build_flags} ${esp8266.build_flags} -D BTNPIN=0 -D RLYPIN=12 -D DATA_PINS=1 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
[env:Athom_5Pin_Controller] ;Analog light strip controller
@ -425,7 +464,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=-1 DATA_PINS=4,12,14,13 -D WLED_DISABLE_INFRARED
build_flags = ${common.build_flags} ${esp8266.build_flags} -D BTNPIN=0 -D RLYPIN=-1 DATA_PINS=4,12,14,13 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
[env:MY9291]
@ -434,7 +473,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA -D USERMOD_MY9291
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_DISABLE_OTA -D USERMOD_MY9291
lib_deps = ${esp8266.lib_deps}
# ------------------------------------------------------------------------------
@ -448,7 +487,7 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
build_flags = ${common.build_flags} ${esp8266.build_flags}
lib_deps = ${esp8266.lib_deps}
[env:codm-controller-0_6-rev2]
@ -457,24 +496,22 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266}
build_flags = ${common.build_flags} ${esp8266.build_flags}
lib_deps = ${esp8266.lib_deps}
# ------------------------------------------------------------------------------
# EleksTube-IPS
# ------------------------------------------------------------------------------
[env:elekstube_ips]
extends = esp32 ;; use default esp32 platform
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 921600
build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
-D USERMOD_RTC
-D USERMOD_ELEKSTUBE_IPS
-D LEDPIN=12
custom_usermods = ${env:esp32dev.custom_usermods} RTC EleksTube_IPS
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
-D DATA_PINS=12
-D RLYPIN=27
-D BTNPIN=34
-D DEFAULT_LED_COUNT=6
-D PIXEL_COUNTS=6
# Display config
-D ST7789_DRIVER
-D TFT_WIDTH=135
@ -488,7 +525,14 @@ build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_D
-D SPI_FREQUENCY=40000000
-D USER_SETUP_LOADED
monitor_filters = esp32_exception_decoder
lib_deps =
${esp32.lib_deps}
TFT_eSPI @ ^2.3.70
board_build.partitions = ${esp32.default_partitions}
# ------------------------------------------------------------------------------
# Usermod examples
# ------------------------------------------------------------------------------
# 433MHz RF remote example for esp32dev
[env:esp32dev_usermod_RF433]
extends = env:esp32dev
build_flags = ${env:esp32dev.build_flags} -D USERMOD_RF433
lib_deps = ${env:esp32dev.lib_deps}
sui77/rc-switch @ 2.6.4

View File

@ -1,18 +1,18 @@
<p align="center">
<img src="/images/wled_logo_akemi.png">
<a href="https://github.com/Aircoookie/WLED/releases"><img src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a>
<a href="https://raw.githubusercontent.com/Aircoookie/WLED/master/LICENSE"><img src="https://img.shields.io/github/license/Aircoookie/wled?color=blue&style=flat-square"></a>
<a href="https://github.com/wled-dev/WLED/releases"><img src="https://img.shields.io/github/release/wled-dev/WLED.svg?style=flat-square"></a>
<a href="https://raw.githubusercontent.com/wled-dev/WLED/main/LICENSE"><img src="https://img.shields.io/github/license/wled-dev/wled?color=blue&style=flat-square"></a>
<a href="https://wled.discourse.group"><img src="https://img.shields.io/discourse/topics?colorB=blue&label=forum&server=https%3A%2F%2Fwled.discourse.group%2F&style=flat-square"></a>
<a href="https://discord.gg/QAh7wJHrRM"><img src="https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square"></a>
<a href="https://kno.wled.ge"><img src="https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square"></a>
<a href="https://github.com/Aircoookie/WLED-App"><img src="https://img.shields.io/badge/app-wled-blue.svg?style=flat-square"></a>
<a href="https://gitpod.io/#https://github.com/Aircoookie/WLED"><img src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?style=flat-square&logo=gitpod"></a>
<a href="https://gitpod.io/#https://github.com/wled-dev/WLED"><img src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?style=flat-square&logo=gitpod"></a>
</p>
# Welcome to my project WLED! ✨
A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based chipsets like the WS2801 and APA102!
A fast and feature-rich implementation of an ESP32 and ESP8266 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based chipsets like the WS2801 and APA102!
## ⚙️ Features
- WS2812FX library with more than 100 special effects
@ -21,7 +21,7 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control
- Segments to set different effects and colors to user defined parts of the LED string
- Settings page - configuration via the network
- Access Point and station mode - automatic failsafe AP
- Up to 10 LED outputs per instance
- [Up to 10 LED outputs](https://kno.wled.ge/features/multi-strip/#esp32) per instance
- Support for RGBW strips
- 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
@ -61,7 +61,7 @@ See [here](https://kno.wled.ge/basics/compatible-hardware)!
## ✌️ Other
Licensed under the MIT license
Licensed under the EUPL v1.2 license
Credits [here](https://kno.wled.ge/about/contributors/)!
Join the Discord server to discuss everything about WLED!
@ -80,5 +80,5 @@ If WLED really brightens up your day, you can [![](https://img.shields.io/badge/
If you are prone to photosensitive epilepsy, we recommended you do **not** use this software.
If you still want to try, don't use strobe, lighting or noise modes or high effect speed settings.
As per the MIT license, I assume no liability for any damage to you or any other person or equipment.
As per the EUPL license, I assume no liability for any damage to you or any other person or equipment.

View File

@ -1 +1 @@
platformio
platformio>=6.1.17

View File

@ -1,60 +1,58 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile
# pip-compile requirements.in
#
aiofiles==22.1.0
# via platformio
ajsonrpc==1.2.0
# via platformio
anyio==3.6.2
anyio==4.8.0
# via starlette
bottle==0.12.25
bottle==0.13.2
# via platformio
certifi==2023.7.22
certifi==2025.1.31
# via requests
charset-normalizer==3.1.0
charset-normalizer==3.4.1
# via requests
click==8.1.3
click==8.1.8
# via
# platformio
# uvicorn
colorama==0.4.6
# via
# click
# platformio
# via platformio
h11==0.14.0
# via
# uvicorn
# wsproto
idna==3.4
idna==3.10
# via
# anyio
# requests
marshmallow==3.19.0
marshmallow==3.26.1
# via platformio
packaging==23.1
packaging==24.2
# via marshmallow
platformio==6.1.14
platformio==6.1.17
# via -r requirements.in
pyelftools==0.29
pyelftools==0.32
# via platformio
pyserial==3.5
# via platformio
requests==2.31.0
requests==2.32.3
# via platformio
semantic-version==2.10.0
# via platformio
sniffio==1.3.0
sniffio==1.3.1
# via anyio
starlette==0.23.1
starlette==0.45.3
# via platformio
tabulate==0.9.0
# via platformio
urllib3==1.26.18
typing-extensions==4.12.2
# via anyio
urllib3==2.3.0
# via requests
uvicorn==0.20.0
uvicorn==0.34.0
# via platformio
wsproto==1.2.0
# via platformio

BIN
tools/AutoCubeMap.xlsx Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1D0000,
app1, app, ota_1, 0x1E0000,0x1D0000,
spiffs, data, spiffs, 0x3B0000,0x40000,
coredump, data, coredump,,64K
1 # Name, Type, SubType, Offset, Size, Flags
2 nvs, data, nvs, 0x9000, 0x5000,
3 otadata, data, ota, 0xe000, 0x2000,
4 app0, app, ota_0, 0x10000, 0x1D0000,
5 app1, app, ota_1, 0x1E0000,0x1D0000,
6 spiffs, data, spiffs, 0x3B0000,0x40000,
7 coredump, data, coredump,,64K

View File

@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1B0000,
app1, app, ota_1, 0x1C0000,0x1B0000,
spiffs, data, spiffs, 0x370000,0x80000,
coredump, data, coredump,,64K
1 # Name, Type, SubType, Offset, Size, Flags
2 nvs, data, nvs, 0x9000, 0x5000,
3 otadata, data, ota, 0xe000, 0x2000,
4 app0, app, ota_0, 0x10000, 0x1B0000,
5 app1, app, ota_1, 0x1C0000,0x1B0000,
6 spiffs, data, spiffs, 0x370000,0x80000,
7 coredump, data, coredump,,64K

View File

@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1A0000,
app1, app, ota_1, 0x1B0000,0x1A0000,
spiffs, data, spiffs, 0x350000,0xB0000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x1A0000
5 app1 app ota_1 0x1B0000 0x1A0000
6 spiffs data spiffs 0x350000 0xB0000

17
tools/all_xml.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# Pull all settings pages for comparison
HOST=$1
TGT_PATH=$2
CURL_ARGS="--compressed"
# Replicate one target many times
function replicate() {
for i in {0..10}
do
echo -n " http://${HOST}/settings.js?p=$i -o ${TGT_PATH}/$i.xml"
done
}
read -a TARGETS <<< $(replicate)
mkdir -p ${TGT_PATH}
curl ${CURL_ARGS} ${TARGETS[@]}

View File

@ -17,7 +17,7 @@
const fs = require("node:fs");
const path = require("path");
const inliner = require("inliner");
const inline = require("web-resource-inliner");
const zlib = require("node:zlib");
const CleanCSS = require("clean-css");
const minifyHtml = require("html-minifier-terser").minify;
@ -89,7 +89,7 @@ function adoptVersionAndRepo(html) {
repoUrl = repoUrl.replace(/^git\+/, "");
repoUrl = repoUrl.replace(/\.git$/, "");
html = html.replaceAll("https://github.com/atuline/WLED", repoUrl);
html = html.replaceAll("https://github.com/Aircoookie/WLED", repoUrl);
html = html.replaceAll("https://github.com/wled-dev/WLED", repoUrl);
}
let version = packageJson.version;
if (version) {
@ -101,6 +101,7 @@ function adoptVersionAndRepo(html) {
async function minify(str, type = "plain") {
const options = {
collapseWhitespace: true,
conservativeCollapse: true, // preserve spaces in text
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
minifyCSS: true,
@ -116,7 +117,8 @@ async function minify(str, type = "plain") {
} else if (type == "css-minify") {
return new CleanCSS({}).minify(str).styles;
} else if (type == "js-minify") {
return await minifyHtml('<script>' + str + '</script>', options).replace(/<[\/]*script>/g, '');
let js = await minifyHtml('<script>' + str + '</script>', options);
return js.replace(/<[\/]*script>/g, '');
} else if (type == "html-minify") {
return await minifyHtml(str, options);
}
@ -126,21 +128,26 @@ async function minify(str, type = "plain") {
async function writeHtmlGzipped(sourceFile, resultFile, page) {
console.info("Reading " + sourceFile);
new inliner(sourceFile, async function (error, html) {
if (error) throw error;
inline.html({
fileContent: fs.readFileSync(sourceFile, "utf8"),
relativeTo: path.dirname(sourceFile),
strict: true,
},
async function (error, html) {
if (error) throw error;
html = adoptVersionAndRepo(html);
const originalLength = html.length;
html = await minify(html, "html-minify");
const result = zlib.gzipSync(html, { level: zlib.constants.Z_BEST_COMPRESSION });
console.info("Minified and compressed " + sourceFile + " from " + originalLength + " to " + result.length + " bytes");
const array = hexdump(result);
let src = singleHeader;
src += `const uint16_t PAGE_${page}_L = ${result.length};\n`;
src += `const uint8_t PAGE_${page}[] PROGMEM = {\n${array}\n};\n\n`;
console.info("Writing " + resultFile);
fs.writeFileSync(resultFile, src);
});
html = adoptVersionAndRepo(html);
const originalLength = html.length;
html = await minify(html, "html-minify");
const result = zlib.gzipSync(html, { level: zlib.constants.Z_BEST_COMPRESSION });
console.info("Minified and compressed " + sourceFile + " from " + originalLength + " to " + result.length + " bytes");
const array = hexdump(result);
let src = singleHeader;
src += `const uint16_t PAGE_${page}_L = ${result.length};\n`;
src += `const uint8_t PAGE_${page}[] PROGMEM = {\n${array}\n};\n\n`;
console.info("Writing " + resultFile);
fs.writeFileSync(resultFile, src);
});
}
async function specToChunk(srcDir, s) {
@ -252,6 +259,12 @@ writeChunks(
str
.replace("%%", "%")
},
{
file: "common.js",
name: "JS_common",
method: "gzip",
filter: "js-minify",
},
{
file: "settings.htm",
name: "PAGE_settings",

38
tools/stress_test.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# Some web server stress tests
#
# Perform a large number of parallel requests, stress testing the web server
# TODO: some kind of performance metrics
# Accepts three command line arguments:
# - first argument - mandatory - IP or hostname of target server
# - second argument - target type (optional)
# - third argument - xfer count (for replicated targets) (optional)
HOST=$1
declare -n TARGET_STR="${2:-JSON_LARGER}_TARGETS"
REPLICATE_COUNT=$(("${3:-10}"))
PARALLEL_MAX=${PARALLEL_MAX:-50}
CURL_ARGS="--compressed --parallel --parallel-immediate --parallel-max ${PARALLEL_MAX}"
CURL_PRINT_RESPONSE_ARGS="-w %{http_code}\n"
JSON_TARGETS=('json/state' 'json/info' 'json/si', 'json/palettes' 'json/fxdata' 'settings/s.js?p=2')
FILE_TARGETS=('' 'iro.js' 'rangetouch.js' 'settings' 'settings/wifi')
# Replicate one target many times
function replicate() {
printf "${1}?%d " $(seq 1 ${REPLICATE_COUNT})
}
read -a JSON_TINY_TARGETS <<< $(replicate "json/nodes")
read -a JSON_SMALL_TARGETS <<< $(replicate "json/info")
read -a JSON_LARGE_TARGETS <<< $(replicate "json/si")
read -a JSON_LARGER_TARGETS <<< $(replicate "json/fxdata")
read -a INDEX_TARGETS <<< $(replicate "")
# Expand target URLS to full arguments for curl
TARGETS=(${TARGET_STR[@]})
#echo "${TARGETS[@]}"
FULL_TGT_OPTIONS=$(printf "http://${HOST}/%s -o /dev/null " "${TARGETS[@]}")
#echo ${FULL_TGT_OPTIONS}
time curl ${CURL_ARGS} ${FULL_TGT_OPTIONS}

46
tools/udp_test.py Normal file
View File

@ -0,0 +1,46 @@
import numpy as np
import socket
class WledRealtimeClient:
def __init__(self, wled_controller_ip, num_pixels, udp_port=21324, max_pixels_per_packet=126):
self.wled_controller_ip = wled_controller_ip
self.num_pixels = num_pixels
self.udp_port = udp_port
self.max_pixels_per_packet = max_pixels_per_packet
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self._prev_pixels = np.full((3, self.num_pixels), 253, dtype=np.uint8)
self.pixels = np.full((3, self.num_pixels), 1, dtype=np.uint8)
def update(self):
# Truncate values and cast to integer
self.pixels = np.clip(self.pixels, 0, 255).astype(np.uint8)
p = np.copy(self.pixels)
idx = np.where(~np.all(p == self._prev_pixels, axis=0))[0]
num_pixels = len(idx)
n_packets = (num_pixels + self.max_pixels_per_packet - 1) // self.max_pixels_per_packet
idx_split = np.array_split(idx, n_packets)
header = bytes([1, 2]) # WARLS protocol header
for packet_indices in idx_split:
data = bytearray(header)
for i in packet_indices:
data.extend([i, *p[:, i]]) # Index and RGB values
self._sock.sendto(bytes(data), (self.wled_controller_ip, self.udp_port))
self._prev_pixels = np.copy(p)
################################## LED blink test ##################################
if __name__ == "__main__":
WLED_CONTROLLER_IP = "192.168.1.153"
NUM_PIXELS = 255 # Amount of LEDs on your strip
import time
wled = WledRealtimeClient(WLED_CONTROLLER_IP, NUM_PIXELS)
print('Starting LED blink test')
while True:
for i in range(NUM_PIXELS):
wled.pixels[1, i] = 255 if wled.pixels[1, i] == 0 else 0
wled.update()
time.sleep(.01)

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h"
#include <Adafruit_ADS1X15.h>
#include <math.h>
@ -252,4 +250,7 @@ class ADS1115Usermod : public Usermod {
int16_t results = ads.getLastConversionResults();
readings[activeChannel] = ads.computeVolts(results);
}
};
};
static ADS1115Usermod ads1115_v2;
REGISTER_USERMOD(ads1115_v2);

View File

@ -0,0 +1,7 @@
{
"name:": "ADS1115_v2",
"dependencies": {
"Adafruit BusIO": "https://github.com/adafruit/Adafruit_BusIO#1.13.2",
"Adafruit ADS1X15": "https://github.com/adafruit/Adafruit_ADS1X15#2.4.0"
}
}

View File

@ -6,5 +6,5 @@ Configuration is performed via the Usermod menu. There are no parameters to set
## Installation
Add the build flag `-D USERMOD_ADS1115` to your platformio environment.
Uncomment libraries with comment `#For ADS1115 sensor uncomment following`
Add 'ADS1115' to `custom_usermods` in your platformio environment.

View File

@ -0,0 +1,328 @@
#include "wled.h"
#include <AHT10.h>
#define AHT10_SUCCESS 1
class UsermodAHT10 : public Usermod
{
private:
static const char _name[];
unsigned long _lastLoopCheck = 0;
bool _settingEnabled : 1; // Enable the usermod
bool _mqttPublish : 1; // Publish mqtt values
bool _mqttPublishAlways : 1; // Publish always, regardless if there is a change
bool _mqttHomeAssistant : 1; // Enable Home Assistant docs
bool _initDone : 1; // Initialization is done
// Settings. Some of these are stored in a different format than they're user settings - so we don't have to convert at runtime
uint8_t _i2cAddress = AHT10_ADDRESS_0X38;
ASAIR_I2C_SENSOR _ahtType = AHT10_SENSOR;
uint16_t _checkInterval = 60000; // milliseconds, user settings is in seconds
float _decimalFactor = 100; // a power of 10 factor. 1 would be no change, 10 is one decimal, 100 is two etc. User sees a power of 10 (0, 1, 2, ..)
uint8_t _lastStatus = 0;
float _lastHumidity = 0;
float _lastTemperature = 0;
#ifndef WLED_MQTT_DISABLE
float _lastHumiditySent = 0;
float _lastTemperatureSent = 0;
#endif
AHT10 *_aht = nullptr;
float truncateDecimals(float val)
{
return roundf(val * _decimalFactor) / _decimalFactor;
}
void initializeAht()
{
if (_aht != nullptr)
{
delete _aht;
}
_aht = new AHT10(_i2cAddress, _ahtType);
_lastStatus = 0;
_lastHumidity = 0;
_lastTemperature = 0;
}
#ifndef WLED_DISABLE_MQTT
void mqttInitialize()
{
// This is a generic "setup mqtt" function, So we must abort if we're not to do mqtt
if (!WLED_MQTT_CONNECTED || !_mqttPublish || !_mqttHomeAssistant)
return;
char topic[128];
snprintf_P(topic, 127, "%s/temperature", mqttDeviceTopic);
mqttCreateHassSensor(F("Temperature"), topic, F("temperature"), F("°C"));
snprintf_P(topic, 127, "%s/humidity", mqttDeviceTopic);
mqttCreateHassSensor(F("Humidity"), topic, F("humidity"), F("%"));
}
void mqttPublishIfChanged(const __FlashStringHelper *topic, float &lastState, float state, float minChange)
{
// Check if MQTT Connected, otherwise it will crash the 8266
// Only report if the change is larger than the required diff
if (WLED_MQTT_CONNECTED && _mqttPublish && (_mqttPublishAlways || fabsf(lastState - state) > minChange))
{
char subuf[128];
snprintf_P(subuf, 127, PSTR("%s/%s"), mqttDeviceTopic, (const char *)topic);
mqtt->publish(subuf, 0, false, String(state).c_str());
lastState = state;
}
}
// Create an MQTT Sensor for Home Assistant Discovery purposes, this includes a pointer to the topic that is published to in the Loop.
void mqttCreateHassSensor(const String &name, const String &topic, const String &deviceClass, const String &unitOfMeasurement)
{
String t = String(F("homeassistant/sensor/")) + mqttClientID + "/" + name + F("/config");
StaticJsonDocument<600> doc;
doc[F("name")] = name;
doc[F("state_topic")] = topic;
doc[F("unique_id")] = String(mqttClientID) + name;
if (unitOfMeasurement != "")
doc[F("unit_of_measurement")] = unitOfMeasurement;
if (deviceClass != "")
doc[F("device_class")] = deviceClass;
doc[F("expire_after")] = 1800;
JsonObject device = doc.createNestedObject(F("device")); // attach the sensor to the same device
device[F("name")] = serverDescription;
device[F("identifiers")] = "wled-sensor-" + String(mqttClientID);
device[F("manufacturer")] = F(WLED_BRAND);
device[F("model")] = F(WLED_PRODUCT_NAME);
device[F("sw_version")] = versionString;
String temp;
serializeJson(doc, temp);
DEBUG_PRINTLN(t);
DEBUG_PRINTLN(temp);
mqtt->publish(t.c_str(), 0, true, temp.c_str());
}
#endif
public:
void setup()
{
initializeAht();
}
void loop()
{
// if usermod is disabled or called during strip updating just exit
// NOTE: on very long strips strip.isUpdating() may always return true so update accordingly
if (!_settingEnabled || strip.isUpdating())
return;
// do your magic here
unsigned long currentTime = millis();
if (currentTime - _lastLoopCheck < _checkInterval)
return;
_lastLoopCheck = currentTime;
_lastStatus = _aht->readRawData();
if (_lastStatus == AHT10_ERROR)
{
// Perform softReset and retry
DEBUG_PRINTLN(F("AHTxx returned error, doing softReset"));
if (!_aht->softReset())
{
DEBUG_PRINTLN(F("softReset failed"));
return;
}
_lastStatus = _aht->readRawData();
}
if (_lastStatus == AHT10_SUCCESS)
{
float temperature = truncateDecimals(_aht->readTemperature(AHT10_USE_READ_DATA));
float humidity = truncateDecimals(_aht->readHumidity(AHT10_USE_READ_DATA));
#ifndef WLED_DISABLE_MQTT
// Push to MQTT
// We can avoid reporting if the change is insignificant. The threshold chosen is below the level of accuracy, but way above 0.01 which is the precision of the value provided.
// The AHT10/15/20 has an accuracy of 0.3C in the temperature readings
mqttPublishIfChanged(F("temperature"), _lastTemperatureSent, temperature, 0.1f);
// The AHT10/15/20 has an accuracy in the humidity sensor of 2%
mqttPublishIfChanged(F("humidity"), _lastHumiditySent, humidity, 0.5f);
#endif
// Store
_lastTemperature = temperature;
_lastHumidity = humidity;
}
}
#ifndef WLED_DISABLE_MQTT
void onMqttConnect(bool sessionPresent)
{
mqttInitialize();
}
#endif
uint16_t getId()
{
return USERMOD_ID_AHT10;
}
void addToJsonInfo(JsonObject &root) override
{
// if "u" object does not exist yet wee need to create it
JsonObject user = root["u"];
if (user.isNull())
user = root.createNestedObject("u");
#ifdef USERMOD_AHT10_DEBUG
JsonArray temp = user.createNestedArray(F("AHT last loop"));
temp.add(_lastLoopCheck);
temp = user.createNestedArray(F("AHT last status"));
temp.add(_lastStatus);
#endif
JsonArray jsonTemp = user.createNestedArray(F("Temperature"));
JsonArray jsonHumidity = user.createNestedArray(F("Humidity"));
if (_lastLoopCheck == 0)
{
// Before first run
jsonTemp.add(F("Not read yet"));
jsonHumidity.add(F("Not read yet"));
return;
}
if (_lastStatus != AHT10_SUCCESS)
{
jsonTemp.add(F("An error occurred"));
jsonHumidity.add(F("An error occurred"));
return;
}
jsonTemp.add(_lastTemperature);
jsonTemp.add(F("°C"));
jsonHumidity.add(_lastHumidity);
jsonHumidity.add(F("%"));
}
void addToConfig(JsonObject &root)
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[F("Enabled")] = _settingEnabled;
top[F("I2CAddress")] = static_cast<uint8_t>(_i2cAddress);
top[F("SensorType")] = _ahtType;
top[F("CheckInterval")] = _checkInterval / 1000;
top[F("Decimals")] = log10f(_decimalFactor);
#ifndef WLED_DISABLE_MQTT
top[F("MqttPublish")] = _mqttPublish;
top[F("MqttPublishAlways")] = _mqttPublishAlways;
top[F("MqttHomeAssistantDiscovery")] = _mqttHomeAssistant;
#endif
DEBUG_PRINTLN(F("AHT10 config saved."));
}
bool readFromConfig(JsonObject &root) override
{
// default settings values could be set here (or below using the 3-argument getJsonValue()) instead of in the class definition or constructor
// setting them inside readFromConfig() is slightly more robust, handling the rare but plausible use case of single value being missing after boot (e.g. if the cfg.json was manually edited and a value was removed)
JsonObject top = root[FPSTR(_name)];
bool configComplete = !top.isNull();
if (!configComplete)
return false;
bool tmpBool = false;
configComplete &= getJsonValue(top[F("Enabled")], tmpBool);
if (configComplete)
_settingEnabled = tmpBool;
configComplete &= getJsonValue(top[F("I2CAddress")], _i2cAddress);
configComplete &= getJsonValue(top[F("CheckInterval")], _checkInterval);
if (configComplete)
{
if (1 <= _checkInterval && _checkInterval <= 600)
_checkInterval *= 1000;
else
// Invalid input
_checkInterval = 60000;
}
configComplete &= getJsonValue(top[F("Decimals")], _decimalFactor);
if (configComplete)
{
if (0 <= _decimalFactor && _decimalFactor <= 5)
_decimalFactor = pow10f(_decimalFactor);
else
// Invalid input
_decimalFactor = 100;
}
uint8_t tmpAhtType;
configComplete &= getJsonValue(top[F("SensorType")], tmpAhtType);
if (configComplete)
{
if (0 <= tmpAhtType && tmpAhtType <= 2)
_ahtType = static_cast<ASAIR_I2C_SENSOR>(tmpAhtType);
else
// Invalid input
_ahtType = ASAIR_I2C_SENSOR::AHT10_SENSOR;
}
#ifndef WLED_DISABLE_MQTT
configComplete &= getJsonValue(top[F("MqttPublish")], tmpBool);
if (configComplete)
_mqttPublish = tmpBool;
configComplete &= getJsonValue(top[F("MqttPublishAlways")], tmpBool);
if (configComplete)
_mqttPublishAlways = tmpBool;
configComplete &= getJsonValue(top[F("MqttHomeAssistantDiscovery")], tmpBool);
if (configComplete)
_mqttHomeAssistant = tmpBool;
#endif
if (_initDone)
{
// Reloading config
initializeAht();
#ifndef WLED_DISABLE_MQTT
mqttInitialize();
#endif
}
_initDone = true;
return configComplete;
}
~UsermodAHT10()
{
delete _aht;
_aht = nullptr;
}
};
const char UsermodAHT10::_name[] PROGMEM = "AHTxx";
static UsermodAHT10 aht10_v2;
REGISTER_USERMOD(aht10_v2);

View File

@ -0,0 +1,30 @@
# Usermod AHT10
This Usermod is designed to read a `AHT10`, `AHT15` or `AHT20` sensor and output the following:
- Temperature
- Humidity
Configuration is performed via the Usermod menu. The following settings can be configured in the Usermod Menu:
- I2CAddress: The i2c address in decimal. Set it to either 56 (0x38, the default) or 57 (0x39).
- SensorType, one of:
- 0 - AHT10
- 1 - AHT15
- 2 - AHT20
- CheckInterval: Number of seconds between readings
- Decimals: Number of decimals to put in the output
Dependencies, These must be added under `lib_deps` in your `platform.ini` (or `platform_override.ini`).
- Libraries
- `enjoyneering/AHT10@~1.1.0` (by [enjoyneering](https://registry.platformio.org/libraries/enjoyneering/AHT10))
- `Wire`
## Author
[@LordMike](https://github.com/LordMike)
# Compiling
To enable, add 'AHT10' to `custom_usermods` in your platformio encrionment (e.g. in `platformio_override.ini`)
```ini
[env:aht10_example]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods} AHT10
```

View File

@ -0,0 +1,6 @@
{
"name:": "AHT10_v2",
"dependencies": {
"enjoyneering/AHT10":"~1.1.0"
}
}

View File

@ -0,0 +1,5 @@
[env:aht10_example]
extends = env:esp32dev
build_flags =
${common.build_flags} ${esp32.build_flags}
; -D USERMOD_AHT10_DEBUG ; -- add a debug status to the info modal

View File

@ -1,4 +1,3 @@
#pragma once
#include "wled.h"
/*
@ -102,9 +101,9 @@ private:
void secondsEffectSineFade(int16_t secondLed, Toki::Time const& time) {
uint32_t ms = time.ms % 1000;
uint8_t b0 = (cos8(ms * 64 / 1000) - 128) * 2;
uint8_t b0 = (cos8_t(ms * 64 / 1000) - 128) * 2;
setPixelColor(secondLed, gamma32(scale32(secondColor, b0)));
uint8_t b1 = (sin8(ms * 64 / 1000) - 128) * 2;
uint8_t b1 = (sin8_t(ms * 64 / 1000) - 128) * 2;
setPixelColor(inc(secondLed, 1, secondsSegment), gamma32(scale32(secondColor, b1)));
}
@ -254,3 +253,7 @@ public:
return USERMOD_ID_ANALOG_CLOCK;
}
};
static AnalogClockUsermod analog_clock;
REGISTER_USERMOD(analog_clock);

View File

@ -0,0 +1,3 @@
{
"name:": "Analog_Clock"
}

View File

@ -7,7 +7,6 @@
*
* See the accompanying README.md file for more info.
*/
#pragma once
#include "wled.h"
class Animated_Staircase : public Usermod {
@ -332,7 +331,7 @@ class Animated_Staircase : public Usermod {
};
// NOTE: this *WILL* return TRUE if all the pins are set to -1.
// this is *BY DESIGN*.
if (!pinManager.allocateMultiplePins(pins, 4, PinOwner::UM_AnimatedStaircase)) {
if (!PinManager::allocateMultiplePins(pins, 4, PinOwner::UM_AnimatedStaircase)) {
topPIRorTriggerPin = -1;
topEchoPin = -1;
bottomPIRorTriggerPin = -1;
@ -425,10 +424,10 @@ class Animated_Staircase : public Usermod {
}
void appendConfigData() {
//oappend(SET_F("dd=addDropdown('staircase','selectfield');"));
//oappend(SET_F("addOption(dd,'1st value',0);"));
//oappend(SET_F("addOption(dd,'2nd value',1);"));
//oappend(SET_F("addInfo('staircase:selectfield',1,'additional info');")); // 0 is field type, 1 is actual field
//oappend(F("dd=addDropdown('staircase','selectfield');"));
//oappend(F("addOption(dd,'1st value',0);"));
//oappend(F("addOption(dd,'2nd value',1);"));
//oappend(F("addInfo('staircase:selectfield',1,'additional info');")); // 0 is field type, 1 is actual field
}
@ -513,10 +512,10 @@ class Animated_Staircase : public Usermod {
(oldBottomAPin != bottomPIRorTriggerPin) ||
(oldBottomBPin != bottomEchoPin)) {
changed = true;
pinManager.deallocatePin(oldTopAPin, PinOwner::UM_AnimatedStaircase);
pinManager.deallocatePin(oldTopBPin, PinOwner::UM_AnimatedStaircase);
pinManager.deallocatePin(oldBottomAPin, PinOwner::UM_AnimatedStaircase);
pinManager.deallocatePin(oldBottomBPin, PinOwner::UM_AnimatedStaircase);
PinManager::deallocatePin(oldTopAPin, PinOwner::UM_AnimatedStaircase);
PinManager::deallocatePin(oldTopBPin, PinOwner::UM_AnimatedStaircase);
PinManager::deallocatePin(oldBottomAPin, PinOwner::UM_AnimatedStaircase);
PinManager::deallocatePin(oldBottomBPin, PinOwner::UM_AnimatedStaircase);
}
if (changed) setup();
}
@ -562,3 +561,7 @@ const char Animated_Staircase::_bottomEcho_pin[] PROGMEM = "bottomEch
const char Animated_Staircase::_topEchoCm[] PROGMEM = "top-dist-cm";
const char Animated_Staircase::_bottomEchoCm[] PROGMEM = "bottom-dist-cm";
const char Animated_Staircase::_togglePower[] PROGMEM = "toggle-on-off";
static Animated_Staircase animated_staircase;
REGISTER_USERMOD(animated_staircase);

View File

@ -15,10 +15,9 @@ To include this usermod in your WLED setup, you have to be able to [compile WLED
Before compiling, you have to make the following modifications:
Edit `usermods_list.cpp`:
1. Open `wled00/usermods_list.cpp`
2. add `#include "../usermods/Animated_Staircase/Animated_Staircase.h"` to the top of the file
3. add `usermods.add(new Animated_Staircase());` to the end of the `void registerUsermods()` function.
Edit your environment in `platformio_override.ini`
1. Open `platformio_override.ini`
2. add `Animated_Staircase` to the `custom_usermods` line for your environment
You can configure usermod using the Usermods settings page.
Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo).

View File

@ -0,0 +1,3 @@
{
"name:": "Animated_Staircase"
}

View File

@ -1,15 +1,13 @@
// force the compiler to show a warning to confirm that this file is included
#warning **** Included USERMOD_BH1750 ****
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
#include "wled.h"
#include <BH1750.h>
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
// the max frequency to check photoresistor, 10 seconds
#ifndef USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL
#define USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL 10000
@ -59,7 +57,7 @@ private:
bool sensorFound = false;
// Home Assistant and MQTT
String mqttLuminanceTopic = F("");
String mqttLuminanceTopic;
bool mqttInitialized = false;
bool HomeAssistantDiscovery = true; // Publish Home Assistant Discovery messages
@ -250,3 +248,7 @@ const char Usermod_BH1750::_maxReadInterval[] PROGMEM = "max-read-interval-ms";
const char Usermod_BH1750::_minReadInterval[] PROGMEM = "min-read-interval-ms";
const char Usermod_BH1750::_HomeAssistantDiscovery[] PROGMEM = "HomeAssistantDiscoveryLux";
const char Usermod_BH1750::_offset[] PROGMEM = "offset-lx";
static Usermod_BH1750 bh1750_v2;
REGISTER_USERMOD(bh1750_v2);

View File

@ -0,0 +1,6 @@
{
"name:": "BH1750_v2",
"dependencies": {
"claws/BH1750":"^1.2.0"
}
}

View File

@ -6,22 +6,11 @@ The luminance is displayed in both the Info section of the web UI, as well as pu
## Dependencies
- Libraries
- `claws/BH1750 @^1.2.0`
- This must be added under `lib_deps` in your `platformio.ini` (or `platformio_override.ini`).
- Data is published over MQTT - make sure you've enabled the MQTT sync interface.
## Compilation
To enable, compile with `USERMOD_BH1750` defined (e.g. in `platformio_override.ini`)
```ini
[env:usermod_BH1750_d1_mini]
extends = env:d1_mini
build_flags =
${common.build_flags_esp8266}
-D USERMOD_BH1750
lib_deps =
${esp8266.lib_deps}
claws/BH1750 @ ^1.2.0
```
To enable, compile with `BH1750` in `custom_usermods` (e.g. in `platformio_override.ini`)
### Configuration Options
The following settings can be set at compile-time but are configurable on the usermod menu (except First Measurement time):

View File

@ -1,17 +1,15 @@
// force the compiler to show a warning to confirm that this file is included
#warning **** Included USERMOD_BME280 version 2.0 ****
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
#include "wled.h"
#include <Arduino.h>
#include <BME280I2C.h> // BME280 sensor
#include <EnvironmentCalculations.h> // BME280 extended measurements
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
class UsermodBME280 : public Usermod
{
private:
@ -24,6 +22,7 @@ private:
uint8_t PressureDecimals = 0; // Number of decimal places in published pressure values
uint16_t TemperatureInterval = 5; // Interval to measure temperature (and humidity, dew point if available) in seconds
uint16_t PressureInterval = 300; // Interval to measure pressure in seconds
BME280I2C::I2CAddr I2CAddress = BME280I2C::I2CAddr_0x76; // i2c address, defaults to 0x76
bool PublishAlways = false; // Publish values even when they have not changed
bool UseCelsius = true; // Use Celsius for Reporting
bool HomeAssistantDiscovery = false; // Publish Home Assistant Device Information
@ -35,20 +34,7 @@ private:
#endif
bool initDone = false;
// BME280 sensor settings
BME280I2C::Settings settings{
BME280::OSR_X16, // Temperature oversampling x16
BME280::OSR_X16, // Humidity oversampling x16
BME280::OSR_X16, // Pressure oversampling x16
// Defaults
BME280::Mode_Forced,
BME280::StandbyTime_1000ms,
BME280::Filter_Off,
BME280::SpiEnable_False,
BME280I2C::I2CAddr_0x76 // I2C address. I2C specific. Default 0x76
};
BME280I2C bme{settings};
BME280I2C bme;
uint8_t sensorType;
@ -181,34 +167,52 @@ private:
}
}
void initializeBmeComms()
{
BME280I2C::Settings settings{
BME280::OSR_X16, // Temperature oversampling x16
BME280::OSR_X16, // Humidity oversampling x16
BME280::OSR_X16, // Pressure oversampling x16
BME280::Mode_Forced,
BME280::StandbyTime_1000ms,
BME280::Filter_Off,
BME280::SpiEnable_False,
I2CAddress
};
bme.setSettings(settings);
if (!bme.begin())
{
sensorType = 0;
DEBUG_PRINTLN(F("Could not find BME280 I2C sensor!"));
}
else
{
switch (bme.chipModel())
{
case BME280::ChipModel_BME280:
sensorType = 1;
DEBUG_PRINTLN(F("Found BME280 sensor! Success."));
break;
case BME280::ChipModel_BMP280:
sensorType = 2;
DEBUG_PRINTLN(F("Found BMP280 sensor! No Humidity available."));
break;
default:
sensorType = 0;
DEBUG_PRINTLN(F("Found UNKNOWN sensor! Error!"));
}
}
}
public:
void setup()
{
if (i2c_scl<0 || i2c_sda<0) { enabled = false; sensorType = 0; return; }
if (!bme.begin())
{
sensorType = 0;
DEBUG_PRINTLN(F("Could not find BME280 I2C sensor!"));
}
else
{
switch (bme.chipModel())
{
case BME280::ChipModel_BME280:
sensorType = 1;
DEBUG_PRINTLN(F("Found BME280 sensor! Success."));
break;
case BME280::ChipModel_BMP280:
sensorType = 2;
DEBUG_PRINTLN(F("Found BMP280 sensor! No Humidity available."));
break;
default:
sensorType = 0;
DEBUG_PRINTLN(F("Found UNKNOWN sensor! Error!"));
}
}
initDone=true;
initializeBmeComms();
initDone = true;
}
void loop()
@ -235,7 +239,7 @@ public:
// from the UI and values read from sensor, then publish to broker
if (temperature != lastTemperature || PublishAlways)
{
publishMqtt("temperature", String(temperature, TemperatureDecimals).c_str());
publishMqtt("temperature", String(temperature, (unsigned) TemperatureDecimals).c_str());
}
lastTemperature = temperature; // Update last sensor temperature for next loop
@ -248,17 +252,17 @@ public:
if (humidity != lastHumidity || PublishAlways)
{
publishMqtt("humidity", String(humidity, HumidityDecimals).c_str());
publishMqtt("humidity", String(humidity, (unsigned) HumidityDecimals).c_str());
}
if (heatIndex != lastHeatIndex || PublishAlways)
{
publishMqtt("heat_index", String(heatIndex, TemperatureDecimals).c_str());
publishMqtt("heat_index", String(heatIndex, (unsigned) TemperatureDecimals).c_str());
}
if (dewPoint != lastDewPoint || PublishAlways)
{
publishMqtt("dew_point", String(dewPoint, TemperatureDecimals).c_str());
publishMqtt("dew_point", String(dewPoint, (unsigned) TemperatureDecimals).c_str());
}
lastHumidity = humidity;
@ -275,7 +279,7 @@ public:
if (pressure != lastPressure || PublishAlways)
{
publishMqtt("pressure", String(pressure, PressureDecimals).c_str());
publishMqtt("pressure", String(pressure, (unsigned) PressureDecimals).c_str());
}
lastPressure = pressure;
@ -365,12 +369,11 @@ public:
}
else if (sensorType==2) //BMP280
{
JsonArray temperature_json = user.createNestedArray(F("Temperature"));
JsonArray pressure_json = user.createNestedArray(F("Pressure"));
temperature_json.add(roundf(sensorTemperature * powf(10, TemperatureDecimals)));
temperature_json.add(roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals));
temperature_json.add(tempScale);
pressure_json.add(roundf(sensorPressure * powf(10, PressureDecimals)));
pressure_json.add(roundf(sensorPressure * powf(10, PressureDecimals)) / powf(10, PressureDecimals));
pressure_json.add(F("hPa"));
}
else if (sensorType==1) //BME280
@ -382,9 +385,9 @@ public:
JsonArray dewpoint_json = user.createNestedArray(F("Dew Point"));
temperature_json.add(roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals));
temperature_json.add(tempScale);
humidity_json.add(roundf(sensorHumidity * powf(10, HumidityDecimals)));
humidity_json.add(roundf(sensorHumidity * powf(10, HumidityDecimals)) / powf(10, HumidityDecimals));
humidity_json.add(F("%"));
pressure_json.add(roundf(sensorPressure * powf(10, PressureDecimals)));
pressure_json.add(roundf(sensorPressure * powf(10, PressureDecimals)) / powf(10, PressureDecimals));
pressure_json.add(F("hPa"));
heatindex_json.add(roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals));
heatindex_json.add(tempScale);
@ -399,6 +402,7 @@ public:
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[FPSTR(_enabled)] = enabled;
top[F("I2CAddress")] = static_cast<uint8_t>(I2CAddress);
top[F("TemperatureDecimals")] = TemperatureDecimals;
top[F("HumidityDecimals")] = HumidityDecimals;
top[F("PressureDecimals")] = PressureDecimals;
@ -426,6 +430,10 @@ public:
configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled);
// A 3-argument getJsonValue() assigns the 3rd argument as a default value if the Json value is missing
uint8_t tmpI2cAddress;
configComplete &= getJsonValue(top[F("I2CAddress")], tmpI2cAddress, 0x76);
I2CAddress = static_cast<BME280I2C::I2CAddr>(tmpI2cAddress);
configComplete &= getJsonValue(top[F("TemperatureDecimals")], TemperatureDecimals, 1);
configComplete &= getJsonValue(top[F("HumidityDecimals")], HumidityDecimals, 0);
configComplete &= getJsonValue(top[F("PressureDecimals")], PressureDecimals, 0);
@ -440,8 +448,23 @@ public:
// first run: reading from cfg.json
DEBUG_PRINTLN(F(" config loaded."));
} else {
DEBUG_PRINTLN(F(" config (re)loaded."));
// changing parameters from settings page
DEBUG_PRINTLN(F(" config (re)loaded."));
// Reset all known values
sensorType = 0;
sensorTemperature = 0;
sensorHumidity = 0;
sensorHeatIndex = 0;
sensorDewPoint = 0;
sensorPressure = 0;
lastTemperature = 0;
lastHumidity = 0;
lastHeatIndex = 0;
lastDewPoint = 0;
lastPressure = 0;
initializeBmeComms();
}
return configComplete;
@ -454,3 +477,7 @@ public:
const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280";
const char UsermodBME280::_enabled[] PROGMEM = "enabled";
static UsermodBME280 bme280_v2;
REGISTER_USERMOD(bme280_v2);

View File

@ -7,6 +7,7 @@ This Usermod is designed to read a `BME280` or `BMP280` sensor and output the fo
- Dew Point (`BME280` only)
Configuration is performed via the Usermod menu. There are no parameters to set in code! The following settings can be configured in the Usermod Menu:
- The i2c address in decimal. Set it to either 118 (0x76, the default) or 119 (0x77).
- Temperature Decimals (number of decimal places to output)
- Humidity Decimals
- Pressure Decimals
@ -21,7 +22,6 @@ Dependencies
- Libraries
- `BME280@~3.0.0` (by [finitespace](https://github.com/finitespace/BME280))
- `Wire`
- These must be added under `lib_deps` in your `platform.ini` (or `platform_override.ini`).
- Data is published over MQTT - make sure you've enabled the MQTT sync interface.
- This usermod also writes to serial (GPIO1 on ESP8266). Please make sure nothing else is listening to the serial TX pin or your board will get confused by log messages!
@ -39,17 +39,11 @@ Methods also exist to read the read/calculated values from other WLED modules th
# Compiling
To enable, compile with `USERMOD_BME280` defined (e.g. in `platformio_override.ini`)
To enable, add `BME280_v2` to your `custom_usermods` (e.g. in `platformio_override.ini`)
```ini
[env:usermod_bme280_d1_mini]
extends = env:d1_mini
build_flags =
${common.build_flags_esp8266}
-D USERMOD_BME280
lib_deps =
${esp8266.lib_deps}
BME280@~3.0.0
Wire
custom_usermods = ${env:d1_mini.custom_usermods} BME280_v2
```

View File

@ -0,0 +1,6 @@
{
"name:": "BME280_v2",
"dependencies": {
"finitespace/BME280":"~3.0.0"
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
# Usermod BME68X
This usermod was developed for a BME680/BME68X sensor. The BME68X is not compatible with the BME280/BMP280 chip. It has its own library. The original 'BSEC Software Library' from Bosch was used to develop the code. The measured values are displayed on the WLED info page.
<p align="center"><img src="pics/pic1.png" style="width:60%;"></p>
In addition, the values are published on MQTT if this is active. The topic used for this is: 'wled/[MQTT Client ID]'. The Client ID is set in the WLED MQTT settings.
<p align="center"><img src="pics/pic2.png"></p>
If you use HomeAssistance discovery, the device tree for HomeAssistance is created. This is published under the topic 'homeassistant/sensor/[MQTT Client ID]' via MQTT.
<p align="center"><img src="pics/pic3.png"></p>
A device with the following sensors appears in HomeAssistant. Please note that MQTT must be activated in HomeAssistant.
<p align="center"><img src="pics/pic4.png" style="width:60%;"></p>
## Features
Raw sensor types
Sensor Accuracy Scale Range
-----------------------------
Temperature +/- 1.0 °C/°F -40 to 85 °C
Humidity +/- 3 % 0 to 100 %
Pressure +/- 1 hPa 300 to 1100 hPa
Gas Resistance Ohm
The BSEC Library calculates the following values via the gas resistance
Sensor Accuracy Scale Range
-----------------------------
IAQ value between 0 and 500
Static IAQ same as IAQ but for permanently installed devices
CO2 PPM
VOC PPM
Gas-Percentage %
In addition the usermod calculates
Sensor Accuracy Scale Range
-----------------------------
Absolute humidity g/m³
Dew point °C/°F
### IAQ (Indoor Air Quality)
The IAQ is divided into the following value groups.
<p align="center"><img src="pics/pic5.png"></p>
For more detailed information, please consult the enclosed Bosch product description (BME680.pdf).
## Calibration of the device
The gas sensor of the BME68X must be calibrated. This differs from the BME280, which does not require any calibration.
There is a range of additional information for this, which the driver also provides. These values can be found in HomeAssistant under Diagnostics.
- **STABILIZATION_STATUS**: Gas sensor stabilization status [boolean] Indicates initial stabilization status of the gas sensor element: stabilization is ongoing (0) or stabilization is finished (1).
- **RUN_IN_STATUS**: Gas sensor run-in status [boolean] Indicates power-on stabilization status of the gas sensor element: stabilization is ongoing (0) or stabilization is finished (1)
Furthermore, all GAS based values have their own accuracy value. These have the following meaning:
- **Accuracy = 0** means the sensor is being stabilized (this can take a while on the first run)
- **Accuracy = 1** means that the previous measured values show too few differences and cannot be used for calibration. If the sensor is at accuracy 1 for too long, you must ensure that the ambient air is chaning. Opening the windows is fine. Or sometimes it is sufficient to breathe on the sensor for approx. 5 minutes.
- **Accuracy = 2** means the sensor is currently calibrating.
- **Accuracy = 3** means that the sensor has been successfully calibrated. Once accuracy 3 is reached, the calibration data is automatically written to the file system. This calibration data will be used again at the next start and will speed up the calibration.
The IAQ index is therefore only meaningful if IAQ Accuracy = 3. In addition to the value for IAQ, BSEC also provides us with CO2 and VOC equivalent values. When using the sensor, the calibration value should also always be read out and displayed or transmitted.
Reasonably reliable values are therefore only achieved when accuracy displays the value 3.
## Settings
The settings of the usermods are set in the usermod section of wled.
<p align="center"><img src="pics/pic6.png"></p>
The possible settings are
- **Enable:** Enables / disables the usermod
- **I2C address:** I2C address of the sensor. You can choose between 0X77 & 0X76. The default is 0x77.
- **Interval:** Specifies the interval of seconds at which the usermod should be executed. The default is every second.
- **Pub Chages Only:** If this item is active, the values are only published if they have changed since the last publication.
- **Pub Accuracy:** The Accuracy values associated with the gas values are also published.
- **Pub Calib State:** If this item is active, STABILIZATION_STATUS& RUN_IN_STATUS are also published.
- **Temp Scale:** Here you can choose between °C and °F.
- **Temp Offset:** The temperature offset is always set in °C. It must be converted for Fahrenheit.
- **HA Discovery:** If this item is active, the HomeAssistant sensor tree is created.
- **Pause While WLED Active:** If WLED has many LEDs to calculate, the computing power may no longer be sufficient to calculate the LEDs and read the sensor data. The LEDs then hang for a few microseconds, which can be seen. If this point is active, no sensor data is fetched as long as WLED is running.
- **Del Calibration Hist:** If a check mark is set here, the calibration file saved in the file system is deleted when the settings are saved.
### Sensors
Applies to all sensors. The number of decimal places is set here. If the sensor is set to -1, it will no longer be published. In addition, the IAQ values can be activated here in verbal form.
It is recommended to use the Static IAQ for the IAQ values. This is recommended by Bosch for statically placed devices.
## Output
Data is published over MQTT - make sure you've enabled the MQTT sync interface.
In addition to outputting via MQTT, you can read the values from the Info Screen on the dashboard page of the device's web interface.
Methods also exist to read the read/calculated values from other WLED modules through code.
- getTemperature(); The scale °C/°F is depended to the settings
- getHumidity();
- getPressure();
- getGasResistance();
- getAbsoluteHumidity();
- getDewPoint(); The scale °C/°F is depended to the settings
- getIaq();
- getStaticIaq();
- getCo2();
- getVoc();
- getGasPerc();
- getIaqAccuracy();
- getStaticIaqAccuracy();
- getCo2Accuracy();
- getVocAccuracy();
- getGasPercAccuracy();
- getStabStatus();
- getRunInStatus();
## Compilation
To enable, compile with `BME68X` in `custom_usermods` (e.g. in `platformio_override.ini`)
Example:
```[env:esp32_mySpecial]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods} BME68X
```
## Revision History
### Version 1.0.0
- First version of the BME68X_v user module
### Version 1.0.1
- Rebased to WELD Version 0.15
- Reworked some default settings
- A problem with the default settings has been fixed
### Version 1.0.2
* Rebased to WELD Version 0.16
* Fixed: Solved compilation problems related to some macro naming interferences.
## Known problems
- MQTT goes online at device start. Shortly afterwards it goes offline and takes quite a while until it goes online again. The problem does not come from this user module, but from the WLED core.
- If you save the settings often, WLED can get stuck.
- If many LEDS are connected to WLED, reading the sensor can cause a small but noticeable hang. The "Pause While WLED Active" option was introduced as a workaround.
<div><img src="pics/GeoGab.svg" width="20%"/> </div>
Gabriel Sieben (gsieben@geogab.net)

View File

@ -0,0 +1,6 @@
{
"name:": "BME68X",
"dependencies": {
"boschsensortec/BSEC Software Library":"^1.8.1492"
}
}

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xml:space="preserve"
style="enable-background:new 0 0 595.28 127.56;"
viewBox="0 0 600 135"
y="0px"
x="0px"
id="Layer_1"
version="1.1"><metadata
id="metadata2372"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs2370"><linearGradient
osb:paint="solid"
id="linearGradient3877"><stop
id="stop3875"
offset="0"
style="stop-color:#808285;stop-opacity:1;" /></linearGradient><clipPath
id="clipPath2379"
clipPathUnits="userSpaceOnUse"><g
style="fill:#808285;fill-opacity:1;fill-rule:nonzero;stroke:#230065;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
id="use2381"><path
style="fill:#808285;fill-opacity:1;fill-rule:nonzero;stroke:#230065;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
class="st0"
d="m 588.34,94.29 c 0,13.28 -10.77,24.04 -24.04,24.04 H 31.38 C 18.1,118.33 7.34,107.57 7.34,94.29 V 32.38 C 7.34,19.1 18.1,8.34 31.38,8.34 h 532.91 c 13.28,0 24.04,10.76 24.04,24.04 V 94.29 Z M 159.44,69.66 c 0,17.15 11.68,19.07 21.89,19.07 h 14.23 c 14.6,0 23.44,-3.2 23.44,-13.87 v -0.91 h -7.84 c -0.45,7.11 -4.47,8.39 -14.32,8.39 h -10.76 c -13.68,0 -18.79,-2.74 -18.79,-13.32 V 66.65 H 219 V 60.9 C 219,44.3 208.88,40.74 194.83,40.74 h -12.59 c -11.12,0 -22.8,1.92 -22.8,18.79 z m 51.72,-9.95 h -43.87 c 0.73,-10.58 3.65,-12.59 16.05,-12.59 h 11.49 c 12.77,0 16.33,4.74 16.33,9.49 z m 18.62,10.13 c 0,15.33 10.86,18.88 25.73,18.88 h 11.22 c 14.87,0 25.72,-3.56 25.72,-18.88 V 59.62 c 0,-15.32 -10.85,-18.88 -25.72,-18.88 h -11.22 c -14.87,0 -25.73,3.56 -25.73,18.88 z m 54.82,-0.46 c 0,10.86 -6.38,12.95 -15.51,12.95 h -15.96 c -9.12,0 -15.51,-2.09 -15.51,-12.95 v -9.31 c 0,-10.85 6.39,-12.95 15.51,-12.95 h 15.96 c 9.12,0 15.51,2.1 15.51,12.95 z m 173.79,18.61 v -31.2 c 0,-13.87 -9.85,-16.06 -24.45,-16.06 h -12.41 c -14.05,0 -19.43,3.47 -19.43,11.95 v 2.28 h 7.84 v -1.64 c 0,-3.83 1.92,-6.2 11.77,-6.2 h 11.49 c 12.04,0 17.33,1.09 17.33,9.49 v 8.76 h -0.18 c -2.74,-4.47 -6.39,-5.56 -16.6,-5.56 H 421.16 C 407.48,59.81 400,61.09 400,71.67 v 3.1 c 0,8.76 3.1,13.96 14.96,13.96 h 18.79 z m -7.84,-12.5 c 0,5.84 -5.47,6.84 -19.7,6.84 h -10.4 c -10.76,0 -12.59,-2.19 -12.59,-7.39 v -1.46 c 0,-5.84 2.83,-7.3 12.95,-7.3 h 12.04 c 12.04,0 17.7,0.82 17.7,7.2 z M 73.6,66.69 h 10.88 l 5.03,0.01 h 48.67 v 2.41 c 0,9.12 -5.47,12.23 -14.41,12.23 H 88.83 c -8.58,0 -15.51,-2.55 -15.51,-14.05 v -0.35 -0.26 z m -9.16,-0.01 c 0,0.06 0,0.14 0,0.2 0.67,14.68 6.68,21.76 23.47,21.76 h 36.85 c 16.51,0 22.35,-6.39 22.35,-24.36 V 59.4 H 89.51 L 85.39,59.39 H 73.32 v -0.01 -16.9 c 0,-11.49 6.93,-14.05 15.51,-14.05 H 112 c 22.07,0 25.81,0.91 25.81,13.23 h 8.39 v -2.37 c 0,-15.23 -12.68,-18.15 -24.54,-18.15 H 87.92 c -17.88,0 -23.53,8.03 -23.53,24.72 V 59.39 L 64.38,59.4 H 44.6 c -11.86,0 -24.54,2.92 -24.54,18.15 v 2.37 5.02 2.37 c 0,15.24 12.68,18.16 24.54,18.16 h 40.79 432.59 34.03 c 17.88,0 23.54,-8.03 23.54,-24.72 V 45.88 c 0,-16.69 -5.65,-24.72 -23.54,-24.72 l -0.16,-0.02 h -223 c -17.88,0 -23.53,8.03 -23.53,24.72 v 18.06 c 0,16.69 5.65,24.72 23.53,24.72 h 36.85 c 16.51,0 22.35,-6.39 22.35,-24.36 V 59.4 h -42.78 v 7.3 h 33.84 v 2.41 c 0,9.12 -5.47,12.23 -14.41,12.23 h -34.94 c -8.58,0 -15.5,-2.55 -15.5,-14.05 V 42.48 c 0,-11.49 6.93,-14.05 15.5,-14.05 l 142.5,0.02 v 61.24 l 24.35,0.73 h 10.95 c 14.23,0 24.18,-3.56 24.18,-19.61 V 62.6 c 0,-14.87 -5.75,-20.16 -24.63,-20.16 h -11.95 -14.88 -0.17 l -0.02,-14.01 h 71.75 l -0.75,0.02 c 8.58,0 15.51,2.55 15.51,14.04 v 41.62 c 0,11.49 -6.93,14.05 -15.51,14.05 H 518.97 86.87 54.27 c -22.08,0 -25.81,-0.91 -25.81,-13.23 v -5.02 c 0,-12.31 3.74,-13.23 25.81,-13.23 h 9.84 z m 459.45,4.04 c 0,9.03 -2.83,13.32 -15.6,13.32 h -12.77 c -11.67,0 -15.42,-4.93 -15.42,-13.41 v -8.85 c 0,-11.13 6.48,-12.95 17.06,-12.95 h 10.58 c 10.76,0 16.14,2.01 16.14,12.77 v 9.12 z"
id="path3935" /><path
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#230065;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
class="st0"
d="m 611.07375,-48.387188 c 0,13.28 -10.77,24.039999 -24.04,24.039999 H 54.113747 c -13.27999,0 -24.04,-10.76 -24.04,-24.039999 v -61.910002 c 0,-13.28 10.76001,-24.04 24.04,-24.04 H 587.02375 c 13.28,0 24.04,10.76 24.04,24.04 v 61.910002 z"
id="path3937" /></g></clipPath><clipPath
id="clipPath2398"
clipPathUnits="userSpaceOnUse"><g
id="use2400"
style="fill:#268298;fill-opacity:1"><g
id="g3959"
clip-path="url(#clipPath2407)"
style="fill:#268298;fill-opacity:1"><g
id="g3957"
style="fill:#268298;fill-opacity:1"><rect
style="opacity:1;fill:#268298;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="rect3955"
width="350.98587"
height="147.57361"
x="95.224861"
y="-97.290329" /></g></g></g></clipPath><clipPath
id="clipPath2407"
clipPathUnits="userSpaceOnUse"><g
id="use2409"
style="fill:#268298;fill-opacity:1"><rect
style="opacity:1;fill:#268298;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="rect3963"
width="350.98587"
height="147.57361"
x="95.224861"
y="-97.290329" /></g></clipPath></defs>
<style
id="style2363"
type="text/css">
.st0{fill:#808285;}
</style>
<path
style="opacity:1;fill:#ffffff;fill-opacity:0.9859813;fill-rule:nonzero;stroke:#5c7823;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
class="st0"
d="M 600,103.51782 C 600,116.79902 588.8778,127.56 575.17384,127.56 H 24.826163 C 11.111876,127.56 5.1635108e-7,116.79902 5.1635108e-7,103.51782 V 41.602186 C 5.1635108e-7,28.320979 11.111876,17.560001 24.826163,17.560001 H 575.16351 c 13.71429,0 24.82616,10.760978 24.82616,24.042185 v 61.915634 z"
id="path2365-0" /><path
style="fill:#808285;fill-opacity:1;fill-rule:nonzero;stroke:#230065;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
class="st0"
d="M 600,103.51782 C 600,116.79902 588.8778,127.56 575.17384,127.56 H 24.826162 C 11.111877,127.56 5.1635111e-7,116.79902 5.1635111e-7,103.51782 V 41.602187 C 5.1635111e-7,28.320977 11.111876,17.559997 24.826162,17.559997 H 575.16351 c 13.71429,0 24.82616,10.76098 24.82616,24.04219 V 103.51782 Z M 157.07401,78.885567 c 0,17.15156 12.06196,19.07173 22.60585,19.07173 h 14.69535 c 15.07745,0 24.20654,-3.20029 24.20654,-13.87125 v -0.91009 h -8.09638 c -0.46472,7.11065 -4.61618,8.39076 -14.7883,8.39076 h -11.11188 c -14.12736,0 -19.40447,-2.74024 -19.40447,-13.3212 v -2.37022 h 53.40103 v -5.75052 c 0,-16.60151 -10.45094,-20.16183 -24.96041,-20.16183 h -13.00172 c -11.48365,0 -23.54561,1.92017 -23.54561,18.79171 z m 53.41136,-9.9509 h -45.30465 c 0.75387,-10.58096 3.76936,-12.59114 16.57487,-12.59114 h 11.86575 c 13.18761,0 16.86403,4.74043 16.86403,9.49086 z m 19.22891,10.13092 c 0,15.33139 11.21515,18.88171 26.57143,18.88171 h 11.58692 c 15.35629,0 26.56111,-3.56032 26.56111,-18.88171 v -10.22093 c 0,-15.32139 -11.20482,-18.88171 -26.56111,-18.88171 h -11.58692 c -15.35628,0 -26.57143,3.56032 -26.57143,18.88171 z m 56.61275,-0.46004 c 0,10.86098 -6.58865,12.95117 -16.01722,12.95117 h -16.48193 c -9.41825,0 -16.01721,-2.09019 -16.01721,-12.95117 v -9.31085 c 0,-10.85098 6.59896,-12.95117 16.01721,-12.95117 h 16.48193 c 9.41824,0 16.01722,2.10019 16.01722,12.95117 z m 179.47332,18.61169 v -31.20283 c 0,-13.87126 -10.17212,-16.06146 -25.24957,-16.06146 h -12.81584 c -14.50946,0 -20.0654,3.47031 -20.0654,11.95108 v 2.28021 h 8.09638 v -1.64015 c 0,-3.83035 1.98279,-6.20056 12.15491,-6.20056 h 11.86575 c 12.43373,0 17.89673,1.0901 17.89673,9.49086 v 8.7608 h -0.18589 c -2.8296,-4.47041 -6.59897,-5.56051 -17.14286,-5.56051 h -13.00172 c -14.12736,0 -21.85198,1.28012 -21.85198,11.86108 v 3.10028 c 0,8.76079 3.20138,13.96126 15.44923,13.96126 h 19.40447 z m -8.09639,-12.50114 c 0,5.84053 -5.64888,6.84062 -20.34423,6.84062 h -10.74011 c -11.11187,0 -13.00172,-2.19019 -13.00172,-7.39067 v -1.46013 c 0,-5.84053 2.92255,-7.30066 13.3735,-7.30066 h 12.43373 c 12.43374,0 18.27883,0.82007 18.27883,7.20065 z m -389.27711,-8.8008 h 11.2358 l 5.194492,0.01 h 50.261618 v 2.41021 c 0,9.12083 -5.64888,12.23111 -14.88124,12.23111 H 84.154905 c -8.860585,0 -16.017212,-2.55023 -16.017212,-14.05127 v -0.35003 -0.26003 z m -9.459552,-0.01 c 0,0.06 0,0.14002 0,0.20002 0.69191,14.68133 6.898451,21.76198 24.237521,21.76198 h 38.055071 c 17.04992,0 23.0809,-6.39058 23.0809,-24.36221 v -4.88045 H 84.857142 l -4.254733,-0.01 H 68.137693 v -0.01 -16.90153 c 0,-11.49104 7.156627,-14.05129 16.017212,-14.05129 h 23.927705 c 22.79174,0 26.65405,0.91009 26.65405,13.23121 h 8.66437 v -2.37021 c 0,-15.23139 -13.09466,-18.15166 -25.34251,-18.15166 H 83.215146 c -18.464717,0 -24.299483,8.03073 -24.299483,24.72226 v 13.53122 l -0.01033,0.01 h -20.42685 c -12.247849,0 -25.342513,2.92027 -25.342513,18.15165 v 2.37022 5.02045 2.37022 c 0,15.241393 13.094664,18.161653 25.342513,18.161653 h 42.123923 446.736664 35.14286 c 18.46471,0 24.30981,-8.03073 24.30981,-24.722253 v -34.87316 c 0,-16.69153 -5.83477,-24.72226 -24.30981,-24.72226 l -0.16523,-0.02 H 332.0241 c -18.46471,0 -24.29948,8.03073 -24.29948,24.72226 v 18.06163 c 0,16.69152 5.83477,24.72225 24.29948,24.72225 h 38.05508 c 17.04991,0 23.08089,-6.39058 23.08089,-24.36221 v -4.88045 h -44.179 v 7.30067 h 34.94664 v 2.41021 c 0,9.12083 -5.64888,12.23111 -14.88123,12.23111 h -36.08262 c -8.86059,0 -16.00688,-2.55023 -16.00688,-14.05127 v -24.81225 c 0,-11.49104 7.15662,-14.05129 16.00688,-14.05129 l 147.16007,0.02 v 61.24556 l 25.14629,0.73007 h 11.30809 c 14.69536,0 24.97074,-3.56033 24.97074,-19.61178 v -8.21075 c 0,-14.87135 -5.93803,-20.16183 -25.43545,-20.16183 h -12.34079 -15.36661 -0.17556 l -0.0207,-14.01128 h 74.09639 l -0.77453,0.02 c 8.86059,0 16.01721,2.55024 16.01721,14.04128 v 41.62378 c 0,11.491053 -7.15662,14.051283 -16.01721,14.051283 H 528.36145 82.130808 48.464716 c -22.802065,0 -26.654044,-0.91008 -26.654044,-13.231213 v -5.02046 c 0,-12.31111 3.862306,-13.2312 26.654044,-13.2312 h 10.161789 z m 474.475042,4.04037 c 0,9.03082 -2.92255,13.32121 -16.11015,13.32121 h -13.18761 c -12.05164,0 -15.92427,-4.93045 -15.92427,-13.41122 v -8.8508 c 0,-11.13101 6.69191,-12.95118 17.6179,-12.95118 h 10.92599 c 11.11188,0 16.66781,2.01019 16.66781,12.77116 v 9.12083 z"
id="path2365" />
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,13 +1,14 @@
#pragma once
#include "wled.h"
#include "battery_defaults.h"
#include "UMBattery.h"
#include "types/UnkownUMBattery.h"
#include "types/LionUMBattery.h"
#include "types/LipoUMBattery.h"
/*
* Usermod by Maximilian Mewes
* Mail: mewes.maximilian@gmx.de
* GitHub: itCarl
* Date: 25.12.2022
* E-mail: mewes.maximilian@gmx.de
* Created at: 25.12.2022
* If you have any questions, please feel free to contact me.
*/
class UsermodBattery : public Usermod
@ -15,49 +16,39 @@ class UsermodBattery : public Usermod
private:
// battery pin can be defined in my_config.h
int8_t batteryPin = USERMOD_BATTERY_MEASUREMENT_PIN;
UMBattery* bat = new UnkownUMBattery();
batteryConfig cfg;
// Initial delay before first reading to allow voltage stabilization
unsigned long initialDelay = USERMOD_BATTERY_INITIAL_DELAY;
bool initialDelayComplete = false;
bool isFirstVoltageReading = true;
// how often to read the battery voltage
unsigned long readingInterval = USERMOD_BATTERY_MEASUREMENT_INTERVAL;
unsigned long nextReadTime = 0;
unsigned long lastReadTime = 0;
// battery min. voltage
float minBatteryVoltage = USERMOD_BATTERY_MIN_VOLTAGE;
// battery max. voltage
float maxBatteryVoltage = USERMOD_BATTERY_MAX_VOLTAGE;
// all battery cells summed up
unsigned int totalBatteryCapacity = USERMOD_BATTERY_TOTAL_CAPACITY;
// raw analog reading
float rawValue = 0.0f;
// calculated voltage
float voltage = maxBatteryVoltage;
// between 0 and 1, to control strength of voltage smoothing filter
float alpha = 0.05f;
// multiplier for the voltage divider that is in place between ADC pin and battery, default will be 2 but might be adapted to readout voltages over ~5v ESP32 or ~6.6v ESP8266
float voltageMultiplier = USERMOD_BATTERY_VOLTAGE_MULTIPLIER;
// mapped battery level based on voltage
int8_t batteryLevel = 100;
// offset or calibration value to fine tune the calculated voltage
float calibration = USERMOD_BATTERY_CALIBRATION;
// time left estimation feature
// bool calculateTimeLeftEnabled = USERMOD_BATTERY_CALCULATE_TIME_LEFT_ENABLED;
// float estimatedTimeLeft = 0.0;
float alpha = USERMOD_BATTERY_AVERAGING_ALPHA;
// auto shutdown/shutoff/master off feature
bool autoOffEnabled = USERMOD_BATTERY_AUTO_OFF_ENABLED;
int8_t autoOffThreshold = USERMOD_BATTERY_AUTO_OFF_THRESHOLD;
uint8_t autoOffThreshold = USERMOD_BATTERY_AUTO_OFF_THRESHOLD;
// low power indicator feature
bool lowPowerIndicatorEnabled = USERMOD_BATTERY_LOW_POWER_INDICATOR_ENABLED;
int8_t lowPowerIndicatorPreset = USERMOD_BATTERY_LOW_POWER_INDICATOR_PRESET;
int8_t lowPowerIndicatorThreshold = USERMOD_BATTERY_LOW_POWER_INDICATOR_THRESHOLD;
int8_t lowPowerIndicatorReactivationThreshold = lowPowerIndicatorThreshold+10;
int8_t lowPowerIndicatorDuration = USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION;
uint8_t lowPowerIndicatorPreset = USERMOD_BATTERY_LOW_POWER_INDICATOR_PRESET;
uint8_t lowPowerIndicatorThreshold = USERMOD_BATTERY_LOW_POWER_INDICATOR_THRESHOLD;
uint8_t lowPowerIndicatorReactivationThreshold = lowPowerIndicatorThreshold+10;
uint8_t lowPowerIndicatorDuration = USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION;
bool lowPowerIndicationDone = false;
unsigned long lowPowerActivationTime = 0; // used temporary during active time
int8_t lastPreset = 0;
uint8_t lastPreset = 0;
//
bool initDone = false;
bool initializing = true;
bool HomeAssistantDiscovery = false;
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
@ -67,22 +58,29 @@ class UsermodBattery : public Usermod
static const char _preset[];
static const char _duration[];
static const char _init[];
// custom map function
// https://forum.arduino.cc/t/floating-point-using-map-function/348113/2
double mapf(double x, double in_min, double in_max, double out_min, double out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
static const char _haDiscovery[];
/**
* Helper for rounding floating point values
*/
float dot2round(float x)
{
float nx = (int)(x * 100 + .5);
return (float)(nx / 100);
}
/*
/**
* Helper for converting a string to lowercase
*/
String stringToLower(String str)
{
for(int i = 0; i < str.length(); i++)
if(str[i] >= 'A' && str[i] <= 'Z')
str[i] += 32;
return str;
}
/**
* Turn off all leds
*/
void turnOff()
@ -91,15 +89,15 @@ class UsermodBattery : public Usermod
stateUpdated(CALL_MODE_DIRECT_CHANGE);
}
/*
/**
* Indicate low power by activating a configured preset for a given time and then switching back to the preset that was selected previously
*/
void lowPowerIndicator()
{
if (!lowPowerIndicatorEnabled) return;
if (batteryPin < 0) return; // no measurement
if (lowPowerIndicationDone && lowPowerIndicatorReactivationThreshold <= batteryLevel) lowPowerIndicationDone = false;
if (lowPowerIndicatorThreshold <= batteryLevel) return;
if (lowPowerIndicationDone && lowPowerIndicatorReactivationThreshold <= bat->getLevel()) lowPowerIndicationDone = false;
if (lowPowerIndicatorThreshold <= bat->getLevel()) return;
if (lowPowerIndicationDone) return;
if (lowPowerActivationTime <= 1) {
lowPowerActivationTime = millis();
@ -114,34 +112,95 @@ class UsermodBattery : public Usermod
}
}
/**
* read the battery voltage in different ways depending on the architecture
*/
float readVoltage()
{
#ifdef ARDUINO_ARCH_ESP32
// use calibrated millivolts analogread on esp32 (150 mV ~ 2450 mV default attentuation) and divide by 1000 to get from milivolts to volts and multiply by voltage multiplier and apply calibration value
return (analogReadMilliVolts(batteryPin) / 1000.0f) * voltageMultiplier + calibration;
return (analogReadMilliVolts(batteryPin) / 1000.0f) * bat->getVoltageMultiplier() + bat->getCalibration();
#else
// use analog read on esp8266 ( 0V ~ 1V no attenuation options) and divide by ADC precision 1023 and multiply by voltage multiplier and apply calibration value
return (analogRead(batteryPin) / 1023.0f) * voltageMultiplier + calibration;
return (analogRead(batteryPin) / 1023.0f) * bat->getVoltageMultiplier() + bat->getCalibration();
#endif
}
#ifndef WLED_DISABLE_MQTT
void addMqttSensor(const String &name, const String &type, const String &topic, const String &deviceClass, const String &unitOfMeasurement = "", const bool &isDiagnostic = false)
{
StaticJsonDocument<600> doc;
char uid[128], json_str[1024], buf[128];
doc[F("name")] = name;
doc[F("stat_t")] = topic;
sprintf_P(uid, PSTR("%s_%s_%s"), escapedMac.c_str(), stringToLower(name).c_str(), type);
doc[F("uniq_id")] = uid;
doc[F("dev_cla")] = deviceClass;
doc[F("exp_aft")] = 1800;
if(type == "binary_sensor") {
doc[F("pl_on")] = "on";
doc[F("pl_off")] = "off";
}
if(unitOfMeasurement != "")
doc[F("unit_of_measurement")] = unitOfMeasurement;
if(isDiagnostic)
doc[F("entity_category")] = "diagnostic";
JsonObject device = doc.createNestedObject(F("device")); // attach the sensor to the same device
device[F("name")] = serverDescription;
device[F("ids")] = String(F("wled-sensor-")) + mqttClientID;
device[F("mf")] = F(WLED_BRAND);
device[F("mdl")] = F(WLED_PRODUCT_NAME);
device[F("sw")] = versionString;
sprintf_P(buf, PSTR("homeassistant/%s/%s/%s/config"), type, mqttClientID, uid);
DEBUG_PRINTLN(buf);
size_t payload_size = serializeJson(doc, json_str);
DEBUG_PRINTLN(json_str);
mqtt->publish(buf, 0, true, json_str, payload_size);
}
void publishMqtt(const char* topic, const char* state)
{
if (WLED_MQTT_CONNECTED) {
char buf[128];
snprintf_P(buf, 127, PSTR("%s/%s"), mqttDeviceTopic, topic);
mqtt->publish(buf, 0, false, state);
}
}
#endif
public:
//Functions called by WLED
/*
/**
* setup() is called once at boot. WiFi is not yet connected at this point.
* You can use it to initialize variables, sensors or similar.
*/
void setup()
{
// plug in the right battery type
if(cfg.type == (batteryType)lipo) {
bat = new LipoUMBattery();
} else if(cfg.type == (batteryType)lion) {
bat = new LionUMBattery();
}
// update the choosen battery type with configured values
bat->update(cfg);
#ifdef ARDUINO_ARCH_ESP32
bool success = false;
DEBUG_PRINTLN(F("Allocating battery pin..."));
if (batteryPin >= 0 && digitalPinToAnalogChannel(batteryPin) >= 0)
if (pinManager.allocatePin(batteryPin, false, PinOwner::UM_Battery)) {
if (PinManager::allocatePin(batteryPin, false, PinOwner::UM_Battery)) {
DEBUG_PRINTLN(F("Battery pin allocation succeeded."));
success = true;
voltage = readVoltage();
}
if (!success) {
@ -152,17 +211,17 @@ class UsermodBattery : public Usermod
}
#else //ESP8266 boards have only one analog input pin A0
pinMode(batteryPin, INPUT);
voltage = readVoltage();
#endif
nextReadTime = millis() + readingInterval;
// First voltage reading is delayed to allow voltage stabilization after powering up
nextReadTime = millis() + initialDelay;
lastReadTime = millis();
initDone = true;
}
/*
/**
* connected() is called every time the WiFi is (re)connected
* Use it to initialize network interfaces
*/
@ -182,6 +241,25 @@ class UsermodBattery : public Usermod
lowPowerIndicator();
// Handling the initial delay
if (!initialDelayComplete && millis() < nextReadTime)
return; // Continue to return until the initial delay is over
// Once the initial delay is over, set it as complete
if (!initialDelayComplete)
{
initialDelayComplete = true;
// Set the regular interval after initial delay
nextReadTime = millis() + readingInterval;
}
// Make the first voltage reading after the initial delay has elapsed
if (isFirstVoltageReading)
{
bat->setVoltage(readVoltage());
isFirstVoltageReading = false;
}
// check the battery level every USERMOD_BATTERY_MEASUREMENT_INTERVAL (ms)
if (millis() < nextReadTime) return;
@ -191,58 +269,27 @@ class UsermodBattery : public Usermod
if (batteryPin < 0) return; // nothing to read
initializing = false;
float rawValue = readVoltage();
rawValue = readVoltage();
// filter with exponential smoothing because ADC in esp32 is fluctuating too much for a good single readout
voltage = voltage + alpha * (rawValue - voltage);
// check if voltage is within specified voltage range, allow 10% over/under voltage - removed cause this just makes it hard for people to troubleshoot as the voltage in the web gui will say invalid instead of displaying a voltage
//voltage = ((voltage < minBatteryVoltage * 0.85f) || (voltage > maxBatteryVoltage * 1.1f)) ? -1.0f : voltage;
float filteredVoltage = bat->getVoltage() + alpha * (rawValue - bat->getVoltage());
bat->setVoltage(filteredVoltage);
// translate battery voltage into percentage
/*
the standard "map" function doesn't work
https://www.arduino.cc/reference/en/language/functions/math/map/ notes and warnings at the bottom
*/
#ifdef USERMOD_BATTERY_USE_LIPO
batteryLevel = mapf(voltage, minBatteryVoltage, maxBatteryVoltage, 0, 100); // basic mapping
// LiPo batteries have a differnt dischargin curve, see
// https://blog.ampow.com/lipo-voltage-chart/
if (batteryLevel < 40.0f)
batteryLevel = mapf(batteryLevel, 0, 40, 0, 12); // last 45% -> drops very quickly
else {
if (batteryLevel < 90.0f)
batteryLevel = mapf(batteryLevel, 40, 90, 12, 95); // 90% ... 40% -> almost linear drop
else // level > 90%
batteryLevel = mapf(batteryLevel, 90, 105, 95, 100); // highest 15% -> drop slowly
}
#else
batteryLevel = mapf(voltage, minBatteryVoltage, maxBatteryVoltage, 0, 100);
#endif
if (voltage > -1.0f) batteryLevel = constrain(batteryLevel, 0.0f, 110.0f);
// if (calculateTimeLeftEnabled) {
// float currentBatteryCapacity = totalBatteryCapacity;
// estimatedTimeLeft = (currentBatteryCapacity/strip.currentMilliamps)*60;
// }
bat->calculateAndSetLevel(filteredVoltage);
// Auto off -- Master power off
if (autoOffEnabled && (autoOffThreshold >= batteryLevel))
if (autoOffEnabled && (autoOffThreshold >= bat->getLevel()))
turnOff();
#ifndef WLED_DISABLE_MQTT
// SmartHome stuff
// still don't know much about MQTT and/or HA
if (WLED_MQTT_CONNECTED) {
char buf[64]; // buffer for snprintf()
snprintf_P(buf, 63, PSTR("%s/voltage"), mqttDeviceTopic);
mqtt->publish(buf, 0, false, String(voltage).c_str());
}
publishMqtt("battery", String(bat->getLevel(), 0).c_str());
publishMqtt("voltage", String(bat->getVoltage()).c_str());
#endif
}
/*
/**
* addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API.
* Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI.
* Below it is shown how this could be used for e.g. a light sensor
@ -262,16 +309,6 @@ class UsermodBattery : public Usermod
// info modal display names
JsonArray infoPercentage = user.createNestedArray(F("Battery level"));
JsonArray infoVoltage = user.createNestedArray(F("Battery voltage"));
// if (calculateTimeLeftEnabled)
// {
// JsonArray infoEstimatedTimeLeft = user.createNestedArray(F("Estimated time left"));
// if (initializing) {
// infoEstimatedTimeLeft.add(FPSTR(_init));
// } else {
// infoEstimatedTimeLeft.add(estimatedTimeLeft);
// infoEstimatedTimeLeft.add(F(" min"));
// }
// }
JsonArray infoNextUpdate = user.createNestedArray(F("Next update"));
infoNextUpdate.add((nextReadTime - millis()) / 1000);
@ -283,46 +320,105 @@ class UsermodBattery : public Usermod
return;
}
if (batteryLevel < 0) {
if (bat->getLevel() < 0) {
infoPercentage.add(F("invalid"));
} else {
infoPercentage.add(batteryLevel);
infoPercentage.add(bat->getLevel());
}
infoPercentage.add(F(" %"));
if (voltage < 0) {
if (bat->getVoltage() < 0) {
infoVoltage.add(F("invalid"));
} else {
infoVoltage.add(dot2round(voltage));
infoVoltage.add(dot2round(bat->getVoltage()));
}
infoVoltage.add(F(" V"));
}
void addBatteryToJsonObject(JsonObject& battery, bool forJsonState)
{
if(forJsonState) { battery[F("type")] = cfg.type; } else {battery[F("type")] = (String)cfg.type; } // has to be a String otherwise it won't get converted to a Dropdown
battery[F("min-voltage")] = bat->getMinVoltage();
battery[F("max-voltage")] = bat->getMaxVoltage();
battery[F("calibration")] = bat->getCalibration();
battery[F("voltage-multiplier")] = bat->getVoltageMultiplier();
battery[FPSTR(_readInterval)] = readingInterval;
battery[FPSTR(_haDiscovery)] = HomeAssistantDiscovery;
/*
JsonObject ao = battery.createNestedObject(F("auto-off")); // auto off section
ao[FPSTR(_enabled)] = autoOffEnabled;
ao[FPSTR(_threshold)] = autoOffThreshold;
JsonObject lp = battery.createNestedObject(F("indicator")); // low power section
lp[FPSTR(_enabled)] = lowPowerIndicatorEnabled;
lp[FPSTR(_preset)] = lowPowerIndicatorPreset; // dropdown trickery (String)lowPowerIndicatorPreset;
lp[FPSTR(_threshold)] = lowPowerIndicatorThreshold;
lp[FPSTR(_duration)] = lowPowerIndicatorDuration;
}
void getUsermodConfigFromJsonObject(JsonObject& battery)
{
getJsonValue(battery[F("type")], cfg.type);
getJsonValue(battery[F("min-voltage")], cfg.minVoltage);
getJsonValue(battery[F("max-voltage")], cfg.maxVoltage);
getJsonValue(battery[F("calibration")], cfg.calibration);
getJsonValue(battery[F("voltage-multiplier")], cfg.voltageMultiplier);
setReadingInterval(battery[FPSTR(_readInterval)] | readingInterval);
setHomeAssistantDiscovery(battery[FPSTR(_haDiscovery)] | HomeAssistantDiscovery);
JsonObject ao = battery[F("auto-off")];
setAutoOffEnabled(ao[FPSTR(_enabled)] | autoOffEnabled);
setAutoOffThreshold(ao[FPSTR(_threshold)] | autoOffThreshold);
JsonObject lp = battery[F("indicator")];
setLowPowerIndicatorEnabled(lp[FPSTR(_enabled)] | lowPowerIndicatorEnabled);
setLowPowerIndicatorPreset(lp[FPSTR(_preset)] | lowPowerIndicatorPreset);
setLowPowerIndicatorThreshold(lp[FPSTR(_threshold)] | lowPowerIndicatorThreshold);
lowPowerIndicatorReactivationThreshold = lowPowerIndicatorThreshold+10;
setLowPowerIndicatorDuration(lp[FPSTR(_duration)] | lowPowerIndicatorDuration);
if(initDone)
bat->update(cfg);
}
/**
* addToJsonState() can be used to add custom entries to the /json/state part of the JSON API (state object).
* Values in the state object may be modified by connected clients
*/
/*
void addToJsonState(JsonObject& root)
{
JsonObject battery = root.createNestedObject(FPSTR(_name));
if (battery.isNull())
battery = root.createNestedObject(FPSTR(_name));
addBatteryToJsonObject(battery, true);
DEBUG_PRINTLN(F("Battery state exposed in JSON API."));
}
*/
/*
/**
* readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object).
* Values in the state object may be modified by connected clients
*/
/*
void readFromJsonState(JsonObject& root)
{
if (!initDone) return; // prevent crash on boot applyPreset()
JsonObject battery = root[FPSTR(_name)];
if (!battery.isNull()) {
getUsermodConfigFromJsonObject(battery);
DEBUG_PRINTLN(F("Battery state read from JSON API."));
}
}
*/
/*
/**
* 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().
@ -359,60 +455,55 @@ class UsermodBattery : public Usermod
*/
void addToConfig(JsonObject& root)
{
JsonObject battery = root.createNestedObject(FPSTR(_name)); // usermodname
JsonObject battery = root.createNestedObject(FPSTR(_name));
if (battery.isNull()) {
battery = root.createNestedObject(FPSTR(_name));
}
#ifdef ARDUINO_ARCH_ESP32
battery[F("pin")] = batteryPin;
#endif
// battery[F("time-left")] = calculateTimeLeftEnabled;
battery[F("min-voltage")] = minBatteryVoltage;
battery[F("max-voltage")] = maxBatteryVoltage;
battery[F("capacity")] = totalBatteryCapacity;
battery[F("calibration")] = calibration;
battery[F("voltage-multiplier")] = voltageMultiplier;
battery[FPSTR(_readInterval)] = readingInterval;
JsonObject ao = battery.createNestedObject(F("auto-off")); // auto off section
ao[FPSTR(_enabled)] = autoOffEnabled;
ao[FPSTR(_threshold)] = autoOffThreshold;
JsonObject lp = battery.createNestedObject(F("indicator")); // low power section
lp[FPSTR(_enabled)] = lowPowerIndicatorEnabled;
lp[FPSTR(_preset)] = lowPowerIndicatorPreset; // dropdown trickery (String)lowPowerIndicatorPreset;
lp[FPSTR(_threshold)] = lowPowerIndicatorThreshold;
lp[FPSTR(_duration)] = lowPowerIndicatorDuration;
addBatteryToJsonObject(battery, false);
// read voltage in case calibration or voltage multiplier changed to see immediate effect
voltage = readVoltage();
bat->setVoltage(readVoltage());
DEBUG_PRINTLN(F("Battery config saved."));
}
void appendConfigData()
{
oappend(SET_F("addInfo('Battery:min-voltage', 1, 'v');"));
oappend(SET_F("addInfo('Battery:max-voltage', 1, 'v');"));
oappend(SET_F("addInfo('Battery:capacity', 1, 'mAh');"));
oappend(SET_F("addInfo('Battery:interval', 1, 'ms');"));
oappend(SET_F("addInfo('Battery:auto-off:threshold', 1, '%');"));
oappend(SET_F("addInfo('Battery:indicator:threshold', 1, '%');"));
oappend(SET_F("addInfo('Battery:indicator:duration', 1, 's');"));
// Total: 462 Bytes
oappend(F("td=addDropdown('Battery','type');")); // 34 Bytes
oappend(F("addOption(td,'Unkown','0');")); // 28 Bytes
oappend(F("addOption(td,'LiPo','1');")); // 26 Bytes
oappend(F("addOption(td,'LiOn','2');")); // 26 Bytes
oappend(F("addInfo('Battery:type',1,'<small style=\"color:orange\">requires reboot</small>');")); // 81 Bytes
oappend(F("addInfo('Battery:min-voltage',1,'v');")); // 38 Bytes
oappend(F("addInfo('Battery:max-voltage',1,'v');")); // 38 Bytes
oappend(F("addInfo('Battery:interval',1,'ms');")); // 36 Bytes
oappend(F("addInfo('Battery:HA-discovery',1,'');")); // 38 Bytes
oappend(F("addInfo('Battery:auto-off:threshold',1,'%');")); // 45 Bytes
oappend(F("addInfo('Battery:indicator:threshold',1,'%');")); // 46 Bytes
oappend(F("addInfo('Battery:indicator:duration',1,'s');")); // 45 Bytes
// cannot quite get this mf to work. its exeeding some buffer limit i think
// what i wanted is a list of all presets to select one from
// oappend(SET_F("bd=addDropdown('Battery:low-power-indicator', 'preset');"));
// the loop generates: oappend(SET_F("addOption(bd, 'preset name', preset id);"));
// this option list would exeed the oappend() buffer
// a list of all presets to select one from
// oappend(F("bd=addDropdown('Battery:low-power-indicator', 'preset');"));
// the loop generates: oappend(F("addOption(bd, 'preset name', preset id);"));
// for(int8_t i=1; i < 42; i++) {
// oappend(SET_F("addOption(bd, 'Preset#"));
// oappend(F("addOption(bd, 'Preset#"));
// oappendi(i);
// oappend(SET_F("',"));
// oappend(F("',"));
// oappendi(i);
// oappend(SET_F(");"));
// oappend(F(");"));
// }
}
/*
/**
* 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 immediately after boot, or after saving on the Usermod Settings page)
*
@ -444,26 +535,14 @@ class UsermodBattery : public Usermod
#ifdef ARDUINO_ARCH_ESP32
newBatteryPin = battery[F("pin")] | newBatteryPin;
#endif
// calculateTimeLeftEnabled = battery[F("time-left")] | calculateTimeLeftEnabled;
setMinBatteryVoltage(battery[F("min-voltage")] | minBatteryVoltage);
setMaxBatteryVoltage(battery[F("max-voltage")] | maxBatteryVoltage);
setTotalBatteryCapacity(battery[F("capacity")] | totalBatteryCapacity);
setCalibration(battery[F("calibration")] | calibration);
setVoltageMultiplier(battery[F("voltage-multiplier")] | voltageMultiplier);
setMinBatteryVoltage(battery[F("min-voltage")] | bat->getMinVoltage());
setMaxBatteryVoltage(battery[F("max-voltage")] | bat->getMaxVoltage());
setCalibration(battery[F("calibration")] | bat->getCalibration());
setVoltageMultiplier(battery[F("voltage-multiplier")] | bat->getVoltageMultiplier());
setReadingInterval(battery[FPSTR(_readInterval)] | readingInterval);
setHomeAssistantDiscovery(battery[FPSTR(_haDiscovery)] | HomeAssistantDiscovery);
JsonObject ao = battery[F("auto-off")];
setAutoOffEnabled(ao[FPSTR(_enabled)] | autoOffEnabled);
setAutoOffThreshold(ao[FPSTR(_threshold)] | autoOffThreshold);
JsonObject lp = battery[F("indicator")];
setLowPowerIndicatorEnabled(lp[FPSTR(_enabled)] | lowPowerIndicatorEnabled);
setLowPowerIndicatorPreset(lp[FPSTR(_preset)] | lowPowerIndicatorPreset); // dropdown trickery (int)lp["preset"]
setLowPowerIndicatorThreshold(lp[FPSTR(_threshold)] | lowPowerIndicatorThreshold);
lowPowerIndicatorReactivationThreshold = lowPowerIndicatorThreshold+10;
setLowPowerIndicatorDuration(lp[FPSTR(_duration)] | lowPowerIndicatorDuration);
DEBUG_PRINT(FPSTR(_name));
getUsermodConfigFromJsonObject(battery);
#ifdef ARDUINO_ARCH_ESP32
if (!initDone)
@ -480,7 +559,7 @@ class UsermodBattery : public Usermod
if (newBatteryPin != batteryPin)
{
// deallocate pin
pinManager.deallocatePin(batteryPin, PinOwner::UM_Battery);
PinManager::deallocatePin(batteryPin, PinOwner::UM_Battery);
batteryPin = newBatteryPin;
// initialise
setup();
@ -491,37 +570,24 @@ class UsermodBattery : public Usermod
return !battery[FPSTR(_readInterval)].isNull();
}
/*
* Generate a preset sample for low power indication
*/
void generateExamplePreset()
#ifndef WLED_DISABLE_MQTT
void onMqttConnect(bool sessionPresent)
{
// StaticJsonDocument<300> j;
// JsonObject preset = j.createNestedObject();
// preset["mainseg"] = 0;
// JsonArray seg = preset.createNestedArray("seg");
// JsonObject seg0 = seg.createNestedObject();
// seg0["id"] = 0;
// seg0["start"] = 0;
// seg0["stop"] = 60;
// seg0["grp"] = 0;
// seg0["spc"] = 0;
// seg0["on"] = true;
// seg0["bri"] = 255;
// Home Assistant Autodiscovery
if (!HomeAssistantDiscovery)
return;
// JsonArray col0 = seg0.createNestedArray("col");
// JsonArray col00 = col0.createNestedArray();
// col00.add(255);
// col00.add(0);
// col00.add(0);
// battery percentage
char mqttBatteryTopic[128];
snprintf_P(mqttBatteryTopic, 127, PSTR("%s/battery"), mqttDeviceTopic);
this->addMqttSensor(F("Battery"), "sensor", mqttBatteryTopic, "battery", "%", true);
// seg0["fx"] = 1;
// seg0["sx"] = 128;
// seg0["ix"] = 128;
// savePreset(199, "Low power Indicator", preset);
// voltage
char mqttVoltageTopic[128];
snprintf_P(mqttVoltageTopic, 127, PSTR("%s/voltage"), mqttDeviceTopic);
this->addMqttSensor(F("Voltage"), "sensor", mqttVoltageTopic, "voltage", "V", true);
}
#endif
/*
*
@ -529,7 +595,7 @@ class UsermodBattery : public Usermod
*
*/
/*
/**
* getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!).
* This could be used in the future for the system to determine whether your usermod is installed.
*/
@ -538,13 +604,23 @@ class UsermodBattery : public Usermod
return USERMOD_ID_BATTERY;
}
/**
* get currently active battery type
*/
batteryType getBatteryType()
{
return cfg.type;
}
/**
*
*/
unsigned long getReadingInterval()
{
return readingInterval;
}
/*
/**
* minimum repetition is 3000ms (3s)
*/
void setReadingInterval(unsigned long newReadingInterval)
@ -552,105 +628,84 @@ class UsermodBattery : public Usermod
readingInterval = max((unsigned long)3000, newReadingInterval);
}
/*
/**
* Get lowest configured battery voltage
*/
float getMinBatteryVoltage()
{
return minBatteryVoltage;
return bat->getMinVoltage();
}
/*
/**
* Set lowest battery voltage
* can't be below 0 volt
*/
void setMinBatteryVoltage(float voltage)
{
minBatteryVoltage = max(0.0f, voltage);
bat->setMinVoltage(voltage);
}
/*
/**
* Get highest configured battery voltage
*/
float getMaxBatteryVoltage()
{
return maxBatteryVoltage;
return bat->getMaxVoltage();
}
/*
/**
* Set highest battery voltage
* can't be below minBatteryVoltage
*/
void setMaxBatteryVoltage(float voltage)
{
#ifdef USERMOD_BATTERY_USE_LIPO
maxBatteryVoltage = max(getMinBatteryVoltage()+0.7f, voltage);
#else
maxBatteryVoltage = max(getMinBatteryVoltage()+1.0f, voltage);
#endif
bat->setMaxVoltage(voltage);
}
/*
* Get the capacity of all cells in parralel sumed up
* unit: mAh
*/
unsigned int getTotalBatteryCapacity()
{
return totalBatteryCapacity;
}
void setTotalBatteryCapacity(unsigned int capacity)
{
totalBatteryCapacity = capacity;
}
/*
/**
* Get the calculated voltage
* formula: (adc pin value / adc precision * max voltage) + calibration
*/
float getVoltage()
{
return voltage;
return bat->getVoltage();
}
/*
/**
* Get the mapped battery level (0 - 100) based on voltage
* important: voltage can drop when a load is applied, so its only an estimate
*/
int8_t getBatteryLevel()
{
return batteryLevel;
return bat->getLevel();
}
/*
/**
* Get the configured calibration value
* a offset value to fine-tune the calculated voltage.
*/
float getCalibration()
{
return calibration;
return bat->getCalibration();
}
/*
/**
* Set the voltage calibration offset value
* a offset value to fine-tune the calculated voltage.
*/
void setCalibration(float offset)
{
calibration = offset;
bat->setCalibration(offset);
}
/*
/**
* Set the voltage multiplier value
* A multiplier that may need adjusting for different voltage divider setups
*/
void setVoltageMultiplier(float multiplier)
{
voltageMultiplier = multiplier;
bat->setVoltageMultiplier(multiplier);
}
/*
@ -659,10 +714,10 @@ class UsermodBattery : public Usermod
*/
float getVoltageMultiplier()
{
return voltageMultiplier;
return bat->getVoltageMultiplier();
}
/*
/**
* Get auto-off feature enabled status
* is auto-off enabled, true/false
*/
@ -671,7 +726,7 @@ class UsermodBattery : public Usermod
return autoOffEnabled;
}
/*
/**
* Set auto-off feature status
*/
void setAutoOffEnabled(bool enabled)
@ -679,7 +734,7 @@ class UsermodBattery : public Usermod
autoOffEnabled = enabled;
}
/*
/**
* Get auto-off threshold in percent (0-100)
*/
int8_t getAutoOffThreshold()
@ -687,7 +742,7 @@ class UsermodBattery : public Usermod
return autoOffThreshold;
}
/*
/**
* Set auto-off threshold in percent (0-100)
*/
void setAutoOffThreshold(int8_t threshold)
@ -697,8 +752,7 @@ class UsermodBattery : public Usermod
autoOffThreshold = lowPowerIndicatorEnabled /*&& autoOffEnabled*/ ? min(lowPowerIndicatorThreshold-1, (int)autoOffThreshold) : autoOffThreshold;
}
/*
/**
* Get low-power-indicator feature enabled status
* is the low-power-indicator enabled, true/false
*/
@ -707,7 +761,7 @@ class UsermodBattery : public Usermod
return lowPowerIndicatorEnabled;
}
/*
/**
* Set low-power-indicator feature status
*/
void setLowPowerIndicatorEnabled(bool enabled)
@ -715,7 +769,7 @@ class UsermodBattery : public Usermod
lowPowerIndicatorEnabled = enabled;
}
/*
/**
* Get low-power-indicator preset to activate when low power is detected
*/
int8_t getLowPowerIndicatorPreset()
@ -723,7 +777,7 @@ class UsermodBattery : public Usermod
return lowPowerIndicatorPreset;
}
/*
/**
* Set low-power-indicator preset to activate when low power is detected
*/
void setLowPowerIndicatorPreset(int8_t presetId)
@ -741,7 +795,7 @@ class UsermodBattery : public Usermod
return lowPowerIndicatorThreshold;
}
/*
/**
* Set low-power-indicator threshold in percent (0-100)
*/
void setLowPowerIndicatorThreshold(int8_t threshold)
@ -751,7 +805,7 @@ class UsermodBattery : public Usermod
lowPowerIndicatorThreshold = autoOffEnabled /*&& lowPowerIndicatorEnabled*/ ? max(autoOffThreshold+1, (int)lowPowerIndicatorThreshold) : max(5, (int)lowPowerIndicatorThreshold);
}
/*
/**
* Get low-power-indicator duration in seconds
*/
int8_t getLowPowerIndicatorDuration()
@ -759,7 +813,7 @@ class UsermodBattery : public Usermod
return lowPowerIndicatorDuration;
}
/*
/**
* Set low-power-indicator duration in seconds
*/
void setLowPowerIndicatorDuration(int8_t duration)
@ -767,14 +821,29 @@ class UsermodBattery : public Usermod
lowPowerIndicatorDuration = duration;
}
/*
* Get low-power-indicator status when the indication is done thsi returns true
/**
* Get low-power-indicator status when the indication is done this returns true
*/
bool getLowPowerIndicatorDone()
{
return lowPowerIndicationDone;
}
/**
* Set Home Assistant auto discovery
*/
void setHomeAssistantDiscovery(bool enable)
{
HomeAssistantDiscovery = enable;
}
/**
* Get Home Assistant auto discovery
*/
bool getHomeAssistantDiscovery()
{
return HomeAssistantDiscovery;
}
};
// strings to reduce flash memory usage (used more than twice)
@ -785,3 +854,8 @@ const char UsermodBattery::_threshold[] PROGMEM = "threshold";
const char UsermodBattery::_preset[] PROGMEM = "preset";
const char UsermodBattery::_duration[] PROGMEM = "duration";
const char UsermodBattery::_init[] PROGMEM = "init";
const char UsermodBattery::_haDiscovery[] PROGMEM = "HA-discovery";
static UsermodBattery battery;
REGISTER_USERMOD(battery);

View File

@ -0,0 +1,160 @@
#ifndef UMBBattery_h
#define UMBBattery_h
#include "battery_defaults.h"
/**
* Battery base class
* all other battery classes should inherit from this
*/
class UMBattery
{
private:
protected:
float minVoltage;
float maxVoltage;
float voltage;
int8_t level = 100;
float calibration; // offset or calibration value to fine tune the calculated voltage
float voltageMultiplier; // ratio for the voltage divider
float linearMapping(float v, float min, float max, float oMin = 0.0f, float oMax = 100.0f)
{
return (v-min) * (oMax-oMin) / (max-min) + oMin;
}
public:
UMBattery()
{
this->setVoltageMultiplier(USERMOD_BATTERY_VOLTAGE_MULTIPLIER);
this->setCalibration(USERMOD_BATTERY_CALIBRATION);
}
virtual void update(batteryConfig cfg)
{
if(cfg.minVoltage) this->setMinVoltage(cfg.minVoltage);
if(cfg.maxVoltage) this->setMaxVoltage(cfg.maxVoltage);
if(cfg.level) this->setLevel(cfg.level);
if(cfg.calibration) this->setCalibration(cfg.calibration);
if(cfg.voltageMultiplier) this->setVoltageMultiplier(cfg.voltageMultiplier);
}
/**
* Corresponding battery curves
* calculates the level in % (0-100) with given voltage and possible voltage range
*/
virtual float mapVoltage(float v, float min, float max) = 0;
// {
// example implementation, linear mapping
// return (v-min) * 100 / (max-min);
// };
virtual void calculateAndSetLevel(float voltage) = 0;
/*
*
* Getter and Setter
*
*/
/*
* Get lowest configured battery voltage
*/
virtual float getMinVoltage()
{
return this->minVoltage;
}
/*
* Set lowest battery voltage
* can't be below 0 volt
*/
virtual void setMinVoltage(float voltage)
{
this->minVoltage = max(0.0f, voltage);
}
/*
* Get highest configured battery voltage
*/
virtual float getMaxVoltage()
{
return this->maxVoltage;
}
/*
* Set highest battery voltage
* can't be below minVoltage
*/
virtual void setMaxVoltage(float voltage)
{
this->maxVoltage = max(getMinVoltage()+.5f, voltage);
}
float getVoltage()
{
return this->voltage;
}
/**
* check if voltage is within specified voltage range, allow 10% over/under voltage
*/
void setVoltage(float voltage)
{
// this->voltage = ( (voltage < this->getMinVoltage() * 0.85f) || (voltage > this->getMaxVoltage() * 1.1f) )
// ? -1.0f
// : voltage;
this->voltage = voltage;
}
float getLevel()
{
return this->level;
}
void setLevel(float level)
{
this->level = constrain(level, 0.0f, 110.0f);
}
/*
* Get the configured calibration value
* a offset value to fine-tune the calculated voltage.
*/
virtual float getCalibration()
{
return calibration;
}
/*
* Set the voltage calibration offset value
* a offset value to fine-tune the calculated voltage.
*/
virtual void setCalibration(float offset)
{
calibration = offset;
}
/*
* Get the configured calibration value
* a value to set the voltage divider ratio
*/
virtual float getVoltageMultiplier()
{
return voltageMultiplier;
}
/*
* Set the voltage multiplier value
* a value to set the voltage divider ratio.
*/
virtual void setVoltageMultiplier(float multiplier)
{
voltageMultiplier = multiplier;
}
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1,3 +1,8 @@
#ifndef UMBDefaults_h
#define UMBDefaults_h
#include "wled.h"
// pin defaults
// for the esp32 it is best to use the ADC1: GPIO32 - GPIO39
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html
@ -9,24 +14,66 @@
#endif
#endif
// The initial delay before the first battery voltage reading after power-on.
// This allows the voltage to stabilize before readings are taken, improving accuracy of initial reading.
#ifndef USERMOD_BATTERY_INITIAL_DELAY
#define USERMOD_BATTERY_INITIAL_DELAY 10000 // (milliseconds)
#endif
// the frequency to check the battery, 30 sec
#ifndef USERMOD_BATTERY_MEASUREMENT_INTERVAL
#define USERMOD_BATTERY_MEASUREMENT_INTERVAL 30000
#endif
// default for 18650 battery
// https://batterybro.com/blogs/18650-wholesale-battery-reviews/18852515-when-to-recycle-18650-batteries-and-how-to-start-a-collection-center-in-your-vape-shop
// Discharge voltage: 2.5 volt + .1 for personal safety
#ifndef USERMOD_BATTERY_MIN_VOLTAGE
#ifdef USERMOD_BATTERY_USE_LIPO
// LiPo "1S" Batteries should not be dischared below 3V !!
#define USERMOD_BATTERY_MIN_VOLTAGE 3.2f
#else
#define USERMOD_BATTERY_MIN_VOLTAGE 2.6f
#endif
/* Default Battery Type
* 0 = unkown
* 1 = Lipo
* 2 = Lion
*/
#ifndef USERMOD_BATTERY_DEFAULT_TYPE
#define USERMOD_BATTERY_DEFAULT_TYPE 0
#endif
/*
*
* Unkown 'Battery' defaults
*
*/
#ifndef USERMOD_BATTERY_UNKOWN_MIN_VOLTAGE
// Extra save defaults
#define USERMOD_BATTERY_UNKOWN_MIN_VOLTAGE 3.3f
#endif
#ifndef USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE
#define USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE 4.2f
#endif
//the default ratio for the voltage divider
/*
*
* Lithium polymer (Li-Po) defaults
*
*/
#ifndef USERMOD_BATTERY_LIPO_MIN_VOLTAGE
// LiPo "1S" Batteries should not be dischared below 3V !!
#define USERMOD_BATTERY_LIPO_MIN_VOLTAGE 3.2f
#endif
#ifndef USERMOD_BATTERY_LIPO_MAX_VOLTAGE
#define USERMOD_BATTERY_LIPO_MAX_VOLTAGE 4.2f
#endif
/*
*
* Lithium-ion (Li-Ion) defaults
*
*/
#ifndef USERMOD_BATTERY_LION_MIN_VOLTAGE
// default for 18650 battery
#define USERMOD_BATTERY_LION_MIN_VOLTAGE 2.6f
#endif
#ifndef USERMOD_BATTERY_LION_MAX_VOLTAGE
#define USERMOD_BATTERY_LION_MAX_VOLTAGE 4.2f
#endif
// the default ratio for the voltage divider
#ifndef USERMOD_BATTERY_VOLTAGE_MULTIPLIER
#ifdef ARDUINO_ARCH_ESP32
#define USERMOD_BATTERY_VOLTAGE_MULTIPLIER 2.0f
@ -35,13 +82,8 @@
#endif
#endif
#ifndef USERMOD_BATTERY_MAX_VOLTAGE
#define USERMOD_BATTERY_MAX_VOLTAGE 4.2f
#endif
// a common capacity for single 18650 battery cells is between 2500 and 3600 mAh
#ifndef USERMOD_BATTERY_TOTAL_CAPACITY
#define USERMOD_BATTERY_TOTAL_CAPACITY 3100
#ifndef USERMOD_BATTERY_AVERAGING_ALPHA
#define USERMOD_BATTERY_AVERAGING_ALPHA 0.1f
#endif
// offset or calibration value to fine tune the calculated voltage
@ -49,11 +91,6 @@
#define USERMOD_BATTERY_CALIBRATION 0
#endif
// calculate remaining time / the time that is left before the battery runs out of power
// #ifndef USERMOD_BATTERY_CALCULATE_TIME_LEFT_ENABLED
// #define USERMOD_BATTERY_CALCULATE_TIME_LEFT_ENABLED false
// #endif
// auto-off feature
#ifndef USERMOD_BATTERY_AUTO_OFF_ENABLED
#define USERMOD_BATTERY_AUTO_OFF_ENABLED true
@ -78,4 +115,26 @@
#ifndef USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION
#define USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION 5
#endif
// battery types
typedef enum
{
unknown=0,
lipo=1,
lion=2
} batteryType;
// used for initial configuration after boot
typedef struct bconfig_t
{
batteryType type;
float minVoltage;
float maxVoltage;
float voltage; // current voltage
int8_t level; // current level
float calibration; // offset or calibration value to fine tune the calculated voltage
float voltageMultiplier;
} batteryConfig;
#endif

View File

@ -0,0 +1,3 @@
{
"name:": "Battery"
}

View File

@ -6,105 +6,169 @@
Enables battery level monitoring of your project.
For this to work, the positive side of the (18650) battery must be connected to pin `A0` of the d1 mini/esp8266 with a 100k Ohm resistor (see [Useful Links](#useful-links)).
If you have an ESP32 board, connect the positive side of the battery to ADC1 (GPIO32 - GPIO39)
<p align="center">
<img width="500" src="assets/battery_info_screen.png">
<p align="left">
<img width="700" src="assets/battery_info_screen.png">
</p>
<br>
## ⚙️ Features
- 💯 Displays current battery voltage
- 💯 Displays current battery voltage
- 🚥 Displays battery level
- 🚫 Auto-off with configurable Threshold
- 🚫 Auto-off with configurable threshold
- 🚨 Low power indicator with many configuration possibilities
<br><br>
## 🎈 Installation
define `USERMOD_BATTERY` in `wled00/my_config.h`
In `platformio_override.ini` (or `platformio.ini`)<br>Under: `custom_usermods =`, add the line: `Battery`<br><br>[Example: platformio_override.ini](assets/installation_platformio_override_ini.png) |
### Example wiring
<br><br>
<p align="center">
<img width="300" src="assets/battery_connection_schematic_01.png">
</p>
## 🔌 Example wiring
### Define Your Options
- (see [Useful Links](#useful-links)).
<table style="width: 100%; table-layout: fixed;">
<tr>
<!-- Column for the first image -->
<td style="width: 50%; vertical-align: bottom;">
<img width="300" src="assets/battery_connection_schematic_01.png" style="display: block;">
<p><strong>ESP8266</strong><br>
With a 100k Ohm resistor, connect the positive<br>
side of the battery to pin `A0`.</p>
</td>
<!-- Column for the second image -->
<td style="width: 50%; vertical-align: bottom;">
<img width="250" src="assets/battery_connection_schematic_esp32.png" style="display: block;">
<p><strong>ESP32</strong> (+S2, S3, C3 etc...)<br>
Use a voltage divider (two resistors of equal value).<br>
Connect to ADC1 (GPIO32 - GPIO39). GPIO35 is Default.</p>
</td>
</tr>
</table>
<br><br>
## Define Your Options
| Name | Unit | Description |
| ----------------------------------------------- | ----------- |-------------------------------------------------------------------------------------- |
| `USERMOD_BATTERY` | | define this (in `my_config.h`) to have this usermod included wled00\usermods_list.cpp |
| `USERMOD_BATTERY_USE_LIPO` | | define this (in `my_config.h`) if you use LiPo rechargeables (1S) |
| `USERMOD_BATTERY_MEASUREMENT_PIN` | | defaults to A0 on ESP8266 and GPIO35 on ESP32 |
| `USERMOD_BATTERY_MEASUREMENT_INTERVAL` | ms | battery check interval. defaults to 30 seconds |
| `USERMOD_BATTERY_MIN_VOLTAGE` | v | minimum battery voltage. default is 2.6 (18650 battery standard) |
| `USERMOD_BATTERY_MAX_VOLTAGE` | v | maximum battery voltage. default is 4.2 (18650 battery standard) |
| `USERMOD_BATTERY_TOTAL_CAPACITY` | mAh | the capacity of all cells in parallel summed up |
| `USERMOD_BATTERY_CALIBRATION` | | offset / calibration number, fine tune the measured voltage by the microcontroller |
| `USERMOD_BATTERY` | | Define this (in `my_config.h`) to have this usermod included wled00\usermods_list.cpp |
| `USERMOD_BATTERY_MEASUREMENT_PIN` | | Defaults to A0 on ESP8266 and GPIO35 on ESP32 |
| `USERMOD_BATTERY_MEASUREMENT_INTERVAL` | ms | Battery check interval. defaults to 30 seconds |
| `USERMOD_BATTERY_INITIAL_DELAY` | ms | Delay before initial reading. defaults to 10 seconds to allow voltage stabilization |
| `USERMOD_BATTERY_{TYPE}_MIN_VOLTAGE` | v | Minimum battery voltage. default is 2.6 (18650 battery standard) |
| `USERMOD_BATTERY_{TYPE}_MAX_VOLTAGE` | v | Maximum battery voltage. default is 4.2 (18650 battery standard) |
| `USERMOD_BATTERY_{TYPE}_TOTAL_CAPACITY` | mAh | The capacity of all cells in parallel summed up |
| `USERMOD_BATTERY_{TYPE}_CALIBRATION` | | Offset / calibration number, fine tune the measured voltage by the microcontroller |
| Auto-Off | --- | --- |
| `USERMOD_BATTERY_AUTO_OFF_ENABLED` | true/false | enables auto-off |
| `USERMOD_BATTERY_AUTO_OFF_THRESHOLD` | % (0-100) | when this threshold is reached master power turns off |
| `USERMOD_BATTERY_AUTO_OFF_ENABLED` | true/false | Enables auto-off |
| `USERMOD_BATTERY_AUTO_OFF_THRESHOLD` | % (0-100) | When this threshold is reached master power turns off |
| Low-Power-Indicator | --- | --- |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_ENABLED` | true/false | enables low power indication |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_PRESET` | preset id | when low power is detected then use this preset to indicate low power |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_THRESHOLD` | % (0-100) | when this threshold is reached low power gets indicated |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION` | seconds | for this long the configured preset is played |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_ENABLED` | true/false | Enables low power indication |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_PRESET` | preset id | When low power is detected then use this preset to indicate low power |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_THRESHOLD` | % (0-100) | When this threshold is reached low power gets indicated |
| `USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION` | seconds | For this long the configured preset is played |
All parameters can be configured at runtime via the Usermods settings page.
<br>
**NOTICE:** Each Battery type can be pre-configured individualy (in `my_config.h`)
| Name | Alias | `my_config.h` example |
| --------------- | ------------- | ------------------------------------- |
| Lithium Polymer | lipo (Li-Po) | `USERMOD_BATTERY_lipo_MIN_VOLTAGE` |
| Lithium Ionen | lion (Li-Ion) | `USERMOD_BATTERY_lion_TOTAL_CAPACITY` |
<br><br>
## 🔧 Calibration
The calibration number is a value that is added to the final computed voltage after it has been scaled by the voltage multiplier.
It fine-tunes the voltage reading so that it more closely matches the actual battery voltage, compensating for inaccuracies inherent in the voltage divider resistors or the ESP's ADC measurements.
Set calibration either in the Usermods settings page or at compile time in `my_config.h` or `platformio_override.ini`.
It can be either a positive or negative number.
<br><br>
## ⚠️ Important
- Make sure you know your battery specifications! All batteries are **NOT** the same!
- Example:
Make sure you know your battery specifications! All batteries are **NOT** the same!
| Your battery specification table | | Options you can define |
| :-------------------------------- |:--------------- | :---------------------------- |
| Capacity | 3500mAh 12,5 Wh | |
| Minimum capacity | 3350mAh 11,9 Wh | |
Example:
| Your battery specification table | | Options you can define |
| --------------------------------- | --------------- | ----------------------------- |
| Capacity | 3500mAh 12.5Wh | |
| Minimum capacity | 3350mAh 11.9Wh | |
| Rated voltage | 3.6V - 3.7V | |
| **Charging end voltage** | **4,2V ± 0,05** | `USERMOD_BATTERY_MAX_VOLTAGE` |
| **Discharge voltage** | **2,5V** | `USERMOD_BATTERY_MIN_VOLTAGE` |
| **Charging end voltage** | **4.2V ± 0.05** | `USERMOD_BATTERY_MAX_VOLTAGE` |
| **Discharge voltage** | **2.5V** | `USERMOD_BATTERY_MIN_VOLTAGE` |
| Max. discharge current (constant) | 10A (10000mA) | |
| max. charging current | 1.7A (1700mA) | |
| ... | ... | ... |
| .. | .. | .. |
Specification from: [Molicel INR18650-M35A, 3500mAh 10A Lithium-ion battery, 3.6V - 3.7V](https://www.akkuteile.de/lithium-ionen-akkus/18650/molicel/molicel-inr18650-m35a-3500mah-10a-lithium-ionen-akku-3-6v-3-7v_100833)
Specification from: [Molicel INR18650-M35A, 3500mAh 10A Lithium-ion battery, 3.6V - 3.7V](https://www.akkuteile.de/lithium-ionen-akkus/18650/molicel/molicel-inr18650-m35a-3500mah-10a-lithium-ionen-akku-3-6v-3-7v_100833)
<br><br>
## 🌐 Useful Links
- https://lazyzero.de/elektronik/esp8266/wemos_d1_mini_a0/start
- https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/
<br><br>
## 📝 Change Log
2024-08-19
- Improved MQTT support
- Added battery percentage & battery voltage as MQTT topic
2024-05-11
- Documentation updated
2024-04-30
- Integrate factory pattern to make it easier to add other / custom battery types
- Update readme
- Improved initial reading accuracy by delaying initial measurement to allow voltage to stabilize at power-on
2023-01-04
- basic support for LiPo rechargeable batteries ( `-D USERMOD_BATTERY_USE_LIPO`)
- improved support for esp32 (read calibrated voltage)
- corrected config saving (measurement pin, and battery min/max were lost)
- various bugfixes
- Basic support for LiPo rechargeable batteries (`-D USERMOD_BATTERY_USE_LIPO`)
- Improved support for ESP32 (read calibrated voltage)
- Corrected config saving (measurement pin, and battery min/max were lost)
- Various bugfixes
2022-12-25
- added "auto-off" feature
- added "low-power-indication" feature
- added "calibration/offset" field to configuration page
- added getter and setter, so that user usermods could interact with this one
- update readme (added new options, made it markdownlint compliant)
- Added "auto-off" feature
- Added "low-power-indication" feature
- Added "calibration/offset" field to configuration page
- Added getter and setter, so that user usermods could interact with this one
- Update readme (added new options, made it markdownlint compliant)
2021-09-02
- added "Battery voltage" to info
- added circuit diagram to readme
- added MQTT support, sending battery voltage
- minor fixes
- Added "Battery voltage" to info
- Added circuit diagram to readme
- Added MQTT support, sending battery voltage
- Minor fixes
2021-08-15
- changed `USERMOD_BATTERY_MIN_VOLTAGE` to 2.6 volt as default for 18650 batteries
- Changed `USERMOD_BATTERY_MIN_VOLTAGE` to 2.6 volt as default for 18650 batteries
- Updated readme, added specification table
2021-08-10

View File

@ -0,0 +1,38 @@
#ifndef UMBLion_h
#define UMBLion_h
#include "../battery_defaults.h"
#include "../UMBattery.h"
/**
* LiOn Battery
*
*/
class LionUMBattery : public UMBattery
{
private:
public:
LionUMBattery() : UMBattery()
{
this->setMinVoltage(USERMOD_BATTERY_LION_MIN_VOLTAGE);
this->setMaxVoltage(USERMOD_BATTERY_LION_MAX_VOLTAGE);
}
float mapVoltage(float v, float min, float max) override
{
return this->linearMapping(v, min, max); // basic mapping
};
void calculateAndSetLevel(float voltage) override
{
this->setLevel(this->mapVoltage(voltage, this->getMinVoltage(), this->getMaxVoltage()));
};
virtual void setMaxVoltage(float voltage) override
{
this->maxVoltage = max(getMinVoltage()+1.0f, voltage);
}
};
#endif

View File

@ -0,0 +1,54 @@
#ifndef UMBLipo_h
#define UMBLipo_h
#include "../battery_defaults.h"
#include "../UMBattery.h"
/**
* LiPo Battery
*
*/
class LipoUMBattery : public UMBattery
{
private:
public:
LipoUMBattery() : UMBattery()
{
this->setMinVoltage(USERMOD_BATTERY_LIPO_MIN_VOLTAGE);
this->setMaxVoltage(USERMOD_BATTERY_LIPO_MAX_VOLTAGE);
}
/**
* LiPo batteries have a differnt discharge curve, see
* https://blog.ampow.com/lipo-voltage-chart/
*/
float mapVoltage(float v, float min, float max) override
{
float lvl = 0.0f;
lvl = this->linearMapping(v, min, max); // basic mapping
if (lvl < 40.0f)
lvl = this->linearMapping(lvl, 0, 40, 0, 12); // last 45% -> drops very quickly
else {
if (lvl < 90.0f)
lvl = this->linearMapping(lvl, 40, 90, 12, 95); // 90% ... 40% -> almost linear drop
else // level > 90%
lvl = this->linearMapping(lvl, 90, 105, 95, 100); // highest 15% -> drop slowly
}
return lvl;
};
void calculateAndSetLevel(float voltage) override
{
this->setLevel(this->mapVoltage(voltage, this->getMinVoltage(), this->getMaxVoltage()));
};
virtual void setMaxVoltage(float voltage) override
{
this->maxVoltage = max(getMinVoltage()+0.7f, voltage);
}
};
#endif

View File

@ -0,0 +1,39 @@
#ifndef UMBUnkown_h
#define UMBUnkown_h
#include "../battery_defaults.h"
#include "../UMBattery.h"
/**
* Unkown / Default Battery
*
*/
class UnkownUMBattery : public UMBattery
{
private:
public:
UnkownUMBattery() : UMBattery()
{
this->setMinVoltage(USERMOD_BATTERY_UNKOWN_MIN_VOLTAGE);
this->setMaxVoltage(USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE);
}
void update(batteryConfig cfg)
{
if(cfg.minVoltage) this->setMinVoltage(cfg.minVoltage); else this->setMinVoltage(USERMOD_BATTERY_UNKOWN_MIN_VOLTAGE);
if(cfg.maxVoltage) this->setMaxVoltage(cfg.maxVoltage); else this->setMaxVoltage(USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE);
}
float mapVoltage(float v, float min, float max) override
{
return this->linearMapping(v, min, max); // basic mapping
};
void calculateAndSetLevel(float voltage) override
{
this->setLevel(this->mapVoltage(voltage, this->getMinVoltage(), this->getMaxVoltage()));
};
};
#endif

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h"
class UsermodCronixie : public Usermod {
@ -299,4 +297,7 @@ class UsermodCronixie : public Usermod {
{
return USERMOD_ID_CRONIXIE;
}
};
};
static UsermodCronixie cronixie;
REGISTER_USERMOD(cronixie);

View File

@ -0,0 +1,3 @@
{
"name:": "Cronixie"
}

View File

@ -4,5 +4,5 @@ This usermod supports driving the Cronixie M and L clock kits by Diamex.
## Installation
Compile and upload after adding `-D USERMOD_CRONIXIE` to `build_flags` of your PlatformIO environment.
Compile and upload after adding `Cronixie` to `custom_usermods` of your PlatformIO environment.
Make sure the Auto Brightness Limiter is enabled at 420mA (!) and configure 60 WS281x LEDs.

View File

@ -1,7 +1,5 @@
#pragma once
#include "wled.h"
#ifndef WLED_ENABLE_MQTT
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
@ -245,3 +243,7 @@ class UsermodDHT : public Usermod {
}
};
static UsermodDHT dht;
REGISTER_USERMOD(dht);

View File

@ -0,0 +1,7 @@
{
"name:": "DHT",
"build": { "libArchive": false},
"dependencies": {
"DHT_nonblocking":"https://github.com/alwynallan/DHT_nonblocking"
}
}

View File

@ -1,6 +1,5 @@
; Options
; -------
; USERMOD_DHT - define this to have this user mod included wled00\usermods_list.cpp
; USERMOD_DHT_DHTTYPE - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22
; USERMOD_DHT_PIN - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board
; USERMOD_DHT_CELSIUS - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported
@ -11,13 +10,11 @@
[env:d1_mini_usermod_dht_C]
extends = env:d1_mini
build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS
lib_deps = ${env:d1_mini.lib_deps}
https://github.com/alwynallan/DHT_nonblocking
custom_usermods = ${env:d1_mini.custom_usermods} DHT
build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT_CELSIUS
[env:custom32_LEDPIN_16_usermod_dht_C]
extends = env:custom32_LEDPIN_16
build_flags = ${env:custom32_LEDPIN_16.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS -D USERMOD_DHT_STATS
lib_deps = ${env.lib_deps}
https://github.com/alwynallan/DHT_nonblocking
custom_usermods = ${env:custom32_LEDPIN_16.custom_usermods} DHT
build_flags = ${env:custom32_LEDPIN_16.build_flags} -D USERMOD_DHT_CELSIUS -D USERMOD_DHT_STATS

View File

@ -15,7 +15,6 @@ Copy the example `platformio_override.ini` to the root directory. This file sho
### Define Your Options
* `USERMOD_DHT` - define this to include this user mod wled00\usermods_list.cpp
* `USERMOD_DHT_DHTTYPE` - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22
* `USERMOD_DHT_PIN` - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board
* `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees Celsius, otherwise Fahrenheit will be reported

View File

@ -0,0 +1,4 @@
{
"name:": "EXAMPLE",
"dependencies": {}
}

View File

@ -4,7 +4,6 @@ In this usermod file you can find the documentation on how to take advantage of
## Installation
Copy `usermod_v2_example.h` to the wled00 directory.
Uncomment the corresponding lines in `usermods_list.cpp` and compile!
Add `EXAMPLE` to `custom_usermods` in your PlatformIO environment and compile!
_(You shouldn't need to actually install this, it does nothing useful)_

View File

@ -1,10 +1,8 @@
#pragma once
#include "wled.h"
/*
* Usermods allow you to add own functionality to WLED more easily
* See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality
* See: https://github.com/wled-dev/WLED/wiki/Add-own-functionality
*
* This is an example for a v2 usermod.
* v2 usermods are class inheritance based and can (but don't have to) implement more functions, each of them is shown in this example.
@ -71,7 +69,7 @@ class MyExampleUsermod : public Usermod {
// #endif
// in setup()
// #ifdef USERMOD_EXAMPLE
// UM = (MyExampleUsermod*) usermods.lookup(USERMOD_ID_EXAMPLE);
// UM = (MyExampleUsermod*) UsermodManager::lookup(USERMOD_ID_EXAMPLE);
// #endif
// somewhere in loop() or other member method
// #ifdef USERMOD_EXAMPLE
@ -287,11 +285,11 @@ class MyExampleUsermod : public Usermod {
*/
void appendConfigData() override
{
oappend(SET_F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F(":great")); oappend(SET_F("',1,'<i>(this is a great config value)</i>');"));
oappend(SET_F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F(":testString")); oappend(SET_F("',1,'enter any string you want');"));
oappend(SET_F("dd=addDropdown('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F("','testInt');"));
oappend(SET_F("addOption(dd,'Nothing',0);"));
oappend(SET_F("addOption(dd,'Everything',42);"));
oappend(F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(F(":great")); oappend(F("',1,'<i>(this is a great config value)</i>');"));
oappend(F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(F(":testString")); oappend(F("',1,'enter any string you want');"));
oappend(F("dd=addDropdown('")); oappend(String(FPSTR(_name)).c_str()); oappend(F("','testInt');"));
oappend(F("addOption(dd,'Nothing',0);"));
oappend(F("addOption(dd,'Everything',42);"));
}
@ -404,3 +402,6 @@ void MyExampleUsermod::publishMqtt(const char* state, bool retain)
}
#endif
}
static MyExampleUsermod example_usermod;
REGISTER_USERMOD(example_usermod);

View File

@ -1,4 +1,3 @@
#pragma once
#include "TFTs.h"
#include "wled.h"
@ -156,3 +155,7 @@ class ElekstubeIPSUsermod : public Usermod {
const char ElekstubeIPSUsermod::_name[] PROGMEM = "EleksTubeIPS";
const char ElekstubeIPSUsermod::_tubeSeg[] PROGMEM = "tubeSegment";
const char ElekstubeIPSUsermod::_digitOffset[] PROGMEM = "digitOffset";
static ElekstubeIPSUsermod elekstube_ips;
REGISTER_USERMOD(elekstube_ips);

View File

@ -0,0 +1,7 @@
{
"name:": "EleksTube_IPS",
"dependencies": {
"TFT_eSPI" : "2.5.33"
}
}
# Seems to add 300kb to the RAM requirement???

View File

@ -1,11 +1,12 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include "wled.h"
#include <Arduino.h>
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/
#include <DallasTemperature.h> //Dallastemperature sensor
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
//The SCL and SDA pins are defined here.
//Lolin32 boards use SCL=5 SDA=4
#define U8X8_PIN_SCL 5

View File

@ -1,13 +1,13 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include "wled.h"
#include <Arduino.h>
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/
#include <Wire.h>
#include <BME280I2C.h> //BME280 sensor
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
void UpdateBME280Data();
#define Celsius // Show temperature measurement in Celsius otherwise is in Fahrenheit

View File

@ -0,0 +1,4 @@
{
"name:": "Fix_unreachable_netservices_v2",
"platforms": ["espressif8266"]
}

View File

@ -30,41 +30,6 @@ The usermod supports the following state changes:
## Installation
1. Copy the file `usermod_Fix_unreachable_netservices.h` to the `wled00` directory.
2. Register the usermod by adding `#include "usermod_Fix_unreachable_netservices.h"` in the top and `registerUsermod(new FixUnreachableNetServices());` in the bottom of `usermods_list.cpp`.
Example **usermods_list.cpp**:
```cpp
#include "wled.h"
/*
* Register your v2 usermods here!
* (for v1 usermods using just usermod.cpp, you can ignore this file)
*/
/*
* Add/uncomment your usermod filename here (and once more below)
* || || ||
* \/ \/ \/
*/
//#include "usermod_v2_example.h"
//#include "usermod_temperature.h"
//#include "usermod_v2_empty.h"
#include "usermod_Fix_unreachable_netservices.h"
void registerUsermods()
{
/*
* Add your usermod class name here
* || || ||
* \/ \/ \/
*/
//usermods.add(new MyExampleUsermod());
//usermods.add(new UsermodTemperature());
//usermods.add(new UsermodRenameMe());
usermods.add(new FixUnreachableNetServices());
}
```
1. Add `Fix_unreachable_netservices` to `custom_usermods` in your PlatformIO environment.
Hopefully I can help someone with that - @gegu

View File

@ -1,12 +1,4 @@
#pragma once
#include "wled.h"
#if defined(ESP32)
#warning "Usermod FixUnreachableNetServices works only with ESP8266 builds"
class FixUnreachableNetServices : public Usermod
{
};
#endif
#if defined(ESP8266)
#include <ping.h>
@ -16,7 +8,7 @@ class FixUnreachableNetServices : public Usermod
* By this procedure the net services of WLED remains accessible in some problematic WLAN environments.
*
* Usermods allow you to add own functionality to WLED more easily
* See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality
* See: https://github.com/wled-dev/WLED/wiki/Add-own-functionality
*
* v2 usermods are class inheritance based and can (but don't have to) implement more functions, each of them is shown in this example.
* Multiple v2 usermods can be added to one compilation easily.
@ -168,4 +160,11 @@ Delay <input type=\"number\" min=\"5\" max=\"300\" value=\"";
return USERMOD_ID_FIXNETSERVICES;
}
};
static FixUnreachableNetServices fix_unreachable_net_services;
REGISTER_USERMOD(fix_unreachable_net_services);
#else /* !ESP8266 */
#warning "Usermod FixUnreachableNetServices works only with ESP8266 builds"
#endif

View File

@ -0,0 +1,559 @@
#include "wled.h"
#include <INA226_WE.h>
#define INA226_ADDRESS 0x40 // Default I2C address for INA226
#define DEFAULT_CHECKINTERVAL 60000
#define DEFAULT_INASAMPLES 128
#define DEFAULT_INASAMPLESENUM AVERAGE_128
#define DEFAULT_INACONVERSIONTIME 1100
#define DEFAULT_INACONVERSIONTIMEENUM CONV_TIME_1100
// A packed version of all INA settings enums and their human friendly counterparts packed into a 32 bit structure
// Some values are shifted and need to be preprocessed before usage
struct InaSettingLookup
{
uint16_t avgSamples : 11; // Max 1024, which could be in 10 bits if we shifted by 1; if we somehow handle the edge case with "1"
uint8_t avgEnum : 4; // Shift by 8 to get the INA226_AVERAGES value, accepts 0x00 to 0x0F, we need 0x00 to 0x0E
uint16_t convTimeUs : 14; // We could save 2 bits by shifting this, but we won't save anything at present.
INA226_CONV_TIME convTimeEnum : 3; // Only the lowest 3 bits are defined in the conversion time enumerations
};
const InaSettingLookup _inaSettingsLookup[] = {
{1024, AVERAGE_1024 >> 8, 8244, CONV_TIME_8244},
{512, AVERAGE_512 >> 8, 4156, CONV_TIME_4156},
{256, AVERAGE_256 >> 8, 2116, CONV_TIME_2116},
{128, AVERAGE_128 >> 8, 1100, CONV_TIME_1100},
{64, AVERAGE_64 >> 8, 588, CONV_TIME_588},
{16, AVERAGE_16 >> 8, 332, CONV_TIME_332},
{4, AVERAGE_4 >> 8, 204, CONV_TIME_204},
{1, AVERAGE_1 >> 8, 140, CONV_TIME_140}};
// Note: Will update the provided arg to be the correct value
INA226_AVERAGES getAverageEnum(uint16_t &samples)
{
for (const auto &setting : _inaSettingsLookup)
{
// If a user supplies 2000 samples, we serve up the highest possible value
if (samples >= setting.avgSamples)
{
samples = setting.avgSamples;
return static_cast<INA226_AVERAGES>(setting.avgEnum << 8);
}
}
// Default value if not found
samples = DEFAULT_INASAMPLES;
return DEFAULT_INASAMPLESENUM;
}
INA226_CONV_TIME getConversionTimeEnum(uint16_t &timeUs)
{
for (const auto &setting : _inaSettingsLookup)
{
// If a user supplies 9000 μs, we serve up the highest possible value
if (timeUs >= setting.convTimeUs)
{
timeUs = setting.convTimeUs;
return setting.convTimeEnum;
}
}
// Default value if not found
timeUs = DEFAULT_INACONVERSIONTIME;
return DEFAULT_INACONVERSIONTIMEENUM;
}
class UsermodINA226 : public Usermod
{
private:
static const char _name[];
unsigned long _lastLoopCheck = 0;
unsigned long _lastTriggerTime = 0;
bool _settingEnabled : 1; // Enable the usermod
bool _mqttPublish : 1; // Publish MQTT values
bool _mqttPublishAlways : 1; // Publish always, regardless if there is a change
bool _mqttHomeAssistant : 1; // Enable Home Assistant docs
bool _initDone : 1; // Initialization is done
bool _isTriggeredOperationMode : 1; // false = continuous, true = triggered
bool _measurementTriggered : 1; // if triggered mode, then true indicates we're waiting for measurements
uint16_t _settingInaConversionTimeUs : 12; // Conversion time, shift by 2
uint16_t _settingInaSamples : 11; // Number of samples for averaging, max 1024
uint8_t _i2cAddress;
uint16_t _checkInterval; // milliseconds, user settings is in seconds
float _decimalFactor; // a power of 10 factor. 1 would be no change, 10 is one decimal, 100 is two etc. User sees a power of 10 (0, 1, 2, ..)
uint16_t _shuntResistor; // Shunt resistor value in milliohms
uint16_t _currentRange; // Expected maximum current in milliamps
uint8_t _lastStatus = 0;
float _lastCurrent = 0;
float _lastVoltage = 0;
float _lastPower = 0;
float _lastShuntVoltage = 0;
bool _lastOverflow = false;
#ifndef WLED_MQTT_DISABLE
float _lastCurrentSent = 0;
float _lastVoltageSent = 0;
float _lastPowerSent = 0;
float _lastShuntVoltageSent = 0;
bool _lastOverflowSent = false;
#endif
INA226_WE *_ina226 = nullptr;
float truncateDecimals(float val)
{
return roundf(val * _decimalFactor) / _decimalFactor;
}
void initializeINA226()
{
if (_ina226 != nullptr)
{
delete _ina226;
}
_ina226 = new INA226_WE(_i2cAddress);
if (!_ina226->init())
{
DEBUG_PRINTLN(F("INA226 initialization failed!"));
return;
}
_ina226->setCorrectionFactor(1.0);
uint16_t tmpShort = _settingInaSamples;
_ina226->setAverage(getAverageEnum(tmpShort));
tmpShort = _settingInaConversionTimeUs << 2;
_ina226->setConversionTime(getConversionTimeEnum(tmpShort));
if (_checkInterval >= 20000)
{
_isTriggeredOperationMode = true;
_ina226->setMeasureMode(TRIGGERED);
}
else
{
_isTriggeredOperationMode = false;
_ina226->setMeasureMode(CONTINUOUS);
}
_ina226->setResistorRange(static_cast<float>(_shuntResistor) / 1000.0, static_cast<float>(_currentRange) / 1000.0);
}
void fetchAndPushValues()
{
_lastStatus = _ina226->getI2cErrorCode();
if (_lastStatus != 0)
return;
float current = truncateDecimals(_ina226->getCurrent_mA() / 1000.0);
float voltage = truncateDecimals(_ina226->getBusVoltage_V());
float power = truncateDecimals(_ina226->getBusPower() / 1000.0);
float shuntVoltage = truncateDecimals(_ina226->getShuntVoltage_V());
bool overflow = _ina226->overflow;
#ifndef WLED_DISABLE_MQTT
mqttPublishIfChanged(F("current"), _lastCurrentSent, current, 0.01f);
mqttPublishIfChanged(F("voltage"), _lastVoltageSent, voltage, 0.01f);
mqttPublishIfChanged(F("power"), _lastPowerSent, power, 0.1f);
mqttPublishIfChanged(F("shunt_voltage"), _lastShuntVoltageSent, shuntVoltage, 0.01f);
mqttPublishIfChanged(F("overflow"), _lastOverflowSent, overflow);
#endif
_lastCurrent = current;
_lastVoltage = voltage;
_lastPower = power;
_lastShuntVoltage = shuntVoltage;
_lastOverflow = overflow;
}
void handleTriggeredMode(unsigned long currentTime)
{
if (_measurementTriggered)
{
// Test if we have a measurement every 400ms
if (currentTime - _lastTriggerTime >= 400)
{
_lastTriggerTime = currentTime;
if (_ina226->isBusy())
return;
fetchAndPushValues();
_measurementTriggered = false;
}
}
else
{
if (currentTime - _lastLoopCheck >= _checkInterval)
{
// Start a measurement and use isBusy() later to determine when it is done
_ina226->startSingleMeasurementNoWait();
_lastLoopCheck = currentTime;
_lastTriggerTime = currentTime;
_measurementTriggered = true;
}
}
}
void handleContinuousMode(unsigned long currentTime)
{
if (currentTime - _lastLoopCheck >= _checkInterval)
{
_lastLoopCheck = currentTime;
fetchAndPushValues();
}
}
#ifndef WLED_DISABLE_MQTT
void mqttInitialize()
{
if (!WLED_MQTT_CONNECTED || !_mqttPublish || !_mqttHomeAssistant)
return;
char topic[128];
snprintf_P(topic, 127, "%s/current", mqttDeviceTopic);
mqttCreateHassSensor(F("Current"), topic, F("current"), F("A"));
snprintf_P(topic, 127, "%s/voltage", mqttDeviceTopic);
mqttCreateHassSensor(F("Voltage"), topic, F("voltage"), F("V"));
snprintf_P(topic, 127, "%s/power", mqttDeviceTopic);
mqttCreateHassSensor(F("Power"), topic, F("power"), F("W"));
snprintf_P(topic, 127, "%s/shunt_voltage", mqttDeviceTopic);
mqttCreateHassSensor(F("Shunt Voltage"), topic, F("voltage"), F("V"));
snprintf_P(topic, 127, "%s/overflow", mqttDeviceTopic);
mqttCreateHassBinarySensor(F("Overflow"), topic);
}
void mqttPublishIfChanged(const __FlashStringHelper *topic, float &lastState, float state, float minChange)
{
if (WLED_MQTT_CONNECTED && _mqttPublish && (_mqttPublishAlways || fabsf(lastState - state) > minChange))
{
char subuf[128];
snprintf_P(subuf, 127, PSTR("%s/%s"), mqttDeviceTopic, (const char *)topic);
mqtt->publish(subuf, 0, false, String(state).c_str());
lastState = state;
}
}
void mqttPublishIfChanged(const __FlashStringHelper *topic, bool &lastState, bool state)
{
if (WLED_MQTT_CONNECTED && _mqttPublish && (_mqttPublishAlways || lastState != state))
{
char subuf[128];
snprintf_P(subuf, 127, PSTR("%s/%s"), mqttDeviceTopic, (const char *)topic);
mqtt->publish(subuf, 0, false, state ? "true" : "false");
lastState = state;
}
}
void mqttCreateHassSensor(const String &name, const String &topic, const String &deviceClass, const String &unitOfMeasurement)
{
String t = String(F("homeassistant/sensor/")) + mqttClientID + "/" + name + F("/config");
StaticJsonDocument<600> doc;
doc[F("name")] = name;
doc[F("state_topic")] = topic;
doc[F("unique_id")] = String(mqttClientID) + name;
if (unitOfMeasurement != "")
doc[F("unit_of_measurement")] = unitOfMeasurement;
if (deviceClass != "")
doc[F("device_class")] = deviceClass;
doc[F("expire_after")] = 1800;
JsonObject device = doc.createNestedObject(F("device"));
device[F("name")] = serverDescription;
device[F("identifiers")] = "wled-sensor-" + String(mqttClientID);
device[F("manufacturer")] = F(WLED_BRAND);
device[F("model")] = F(WLED_PRODUCT_NAME);
device[F("sw_version")] = versionString;
String temp;
serializeJson(doc, temp);
DEBUG_PRINTLN(t);
DEBUG_PRINTLN(temp);
mqtt->publish(t.c_str(), 0, true, temp.c_str());
}
void mqttCreateHassBinarySensor(const String &name, const String &topic)
{
String t = String(F("homeassistant/binary_sensor/")) + mqttClientID + "/" + name + F("/config");
StaticJsonDocument<600> doc;
doc[F("name")] = name;
doc[F("state_topic")] = topic;
doc[F("unique_id")] = String(mqttClientID) + name;
JsonObject device = doc.createNestedObject(F("device"));
device[F("name")] = serverDescription;
device[F("identifiers")] = "wled-sensor-" + String(mqttClientID);
device[F("manufacturer")] = F(WLED_BRAND);
device[F("model")] = F(WLED_PRODUCT_NAME);
device[F("sw_version")] = versionString;
String temp;
serializeJson(doc, temp);
DEBUG_PRINTLN(t);
DEBUG_PRINTLN(temp);
mqtt->publish(t.c_str(), 0, true, temp.c_str());
}
#endif
public:
UsermodINA226()
{
// Default values
_settingInaSamples = DEFAULT_INASAMPLES;
_settingInaConversionTimeUs = DEFAULT_INACONVERSIONTIME;
_i2cAddress = INA226_ADDRESS;
_checkInterval = DEFAULT_CHECKINTERVAL;
_decimalFactor = 100;
_shuntResistor = 1000;
_currentRange = 1000;
}
void setup()
{
initializeINA226();
}
void loop()
{
if (!_settingEnabled || strip.isUpdating())
return;
unsigned long currentTime = millis();
if (_isTriggeredOperationMode)
{
handleTriggeredMode(currentTime);
}
else
{
handleContinuousMode(currentTime);
}
}
#ifndef WLED_DISABLE_MQTT
void onMqttConnect(bool sessionPresent)
{
mqttInitialize();
}
#endif
uint16_t getId()
{
return USERMOD_ID_INA226;
}
void addToJsonInfo(JsonObject &root) override
{
JsonObject user = root["u"];
if (user.isNull())
user = root.createNestedObject("u");
#ifdef USERMOD_INA226_DEBUG
JsonArray temp = user.createNestedArray(F("INA226 last loop"));
temp.add(_lastLoopCheck);
temp = user.createNestedArray(F("INA226 last status"));
temp.add(_lastStatus);
temp = user.createNestedArray(F("INA226 average samples"));
temp.add(_settingInaSamples);
temp.add(F("samples"));
temp = user.createNestedArray(F("INA226 conversion time"));
temp.add(_settingInaConversionTimeUs << 2);
temp.add(F("μs"));
// INA226 uses (2 * conversion time * samples) time to take a reading.
temp = user.createNestedArray(F("INA226 expected sample time"));
uint32_t sampleTimeNeededUs = (static_cast<uint32_t>(_settingInaConversionTimeUs) << 2) * _settingInaSamples * 2;
temp.add(truncateDecimals(sampleTimeNeededUs / 1000.0));
temp.add(F("ms"));
temp = user.createNestedArray(F("INA226 mode"));
temp.add(_isTriggeredOperationMode ? F("triggered") : F("continuous"));
if (_isTriggeredOperationMode)
{
temp = user.createNestedArray(F("INA226 triggered"));
temp.add(_measurementTriggered ? F("waiting for measurement") : F(""));
}
#endif
JsonArray jsonCurrent = user.createNestedArray(F("Current"));
JsonArray jsonVoltage = user.createNestedArray(F("Voltage"));
JsonArray jsonPower = user.createNestedArray(F("Power"));
JsonArray jsonShuntVoltage = user.createNestedArray(F("Shunt Voltage"));
JsonArray jsonOverflow = user.createNestedArray(F("Overflow"));
if (_lastLoopCheck == 0)
{
jsonCurrent.add(F("Not read yet"));
jsonVoltage.add(F("Not read yet"));
jsonPower.add(F("Not read yet"));
jsonShuntVoltage.add(F("Not read yet"));
jsonOverflow.add(F("Not read yet"));
return;
}
if (_lastStatus != 0)
{
jsonCurrent.add(F("An error occurred"));
jsonVoltage.add(F("An error occurred"));
jsonPower.add(F("An error occurred"));
jsonShuntVoltage.add(F("An error occurred"));
jsonOverflow.add(F("An error occurred"));
return;
}
jsonCurrent.add(_lastCurrent);
jsonCurrent.add(F("A"));
jsonVoltage.add(_lastVoltage);
jsonVoltage.add(F("V"));
jsonPower.add(_lastPower);
jsonPower.add(F("W"));
jsonShuntVoltage.add(_lastShuntVoltage);
jsonShuntVoltage.add(F("V"));
jsonOverflow.add(_lastOverflow ? F("true") : F("false"));
}
void addToConfig(JsonObject &root)
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[F("Enabled")] = _settingEnabled;
top[F("I2CAddress")] = static_cast<uint8_t>(_i2cAddress);
top[F("CheckInterval")] = _checkInterval / 1000;
top[F("INASamples")] = _settingInaSamples;
top[F("INAConversionTime")] = _settingInaConversionTimeUs << 2;
top[F("Decimals")] = log10f(_decimalFactor);
top[F("ShuntResistor")] = _shuntResistor;
top[F("CurrentRange")] = _currentRange;
#ifndef WLED_DISABLE_MQTT
top[F("MqttPublish")] = _mqttPublish;
top[F("MqttPublishAlways")] = _mqttPublishAlways;
top[F("MqttHomeAssistantDiscovery")] = _mqttHomeAssistant;
#endif
DEBUG_PRINTLN(F("INA226 config saved."));
}
bool readFromConfig(JsonObject &root) override
{
JsonObject top = root[FPSTR(_name)];
bool configComplete = !top.isNull();
if (!configComplete)
return false;
bool tmpBool;
if (getJsonValue(top[F("Enabled")], tmpBool))
_settingEnabled = tmpBool;
else
configComplete = false;
configComplete &= getJsonValue(top[F("I2CAddress")], _i2cAddress);
if (getJsonValue(top[F("CheckInterval")], _checkInterval))
{
if (1 <= _checkInterval && _checkInterval <= 600)
_checkInterval *= 1000;
else
_checkInterval = DEFAULT_CHECKINTERVAL;
}
else
configComplete = false;
uint16_t tmpShort;
if (getJsonValue(top[F("INASamples")], tmpShort))
{
// The method below will fix the provided value to a valid one
getAverageEnum(tmpShort);
_settingInaSamples = tmpShort;
}
else
configComplete = false;
if (getJsonValue(top[F("INAConversionTime")], tmpShort))
{
// The method below will fix the provided value to a valid one
getConversionTimeEnum(tmpShort);
_settingInaConversionTimeUs = tmpShort >> 2;
}
else
configComplete = false;
if (getJsonValue(top[F("Decimals")], _decimalFactor))
{
if (0 <= _decimalFactor && _decimalFactor <= 5)
_decimalFactor = pow10f(_decimalFactor);
else
_decimalFactor = 100;
}
else
configComplete = false;
configComplete &= getJsonValue(top[F("ShuntResistor")], _shuntResistor);
configComplete &= getJsonValue(top[F("CurrentRange")], _currentRange);
#ifndef WLED_DISABLE_MQTT
if (getJsonValue(top[F("MqttPublish")], tmpBool))
_mqttPublish = tmpBool;
else
configComplete = false;
if (getJsonValue(top[F("MqttPublishAlways")], tmpBool))
_mqttPublishAlways = tmpBool;
else
configComplete = false;
if (getJsonValue(top[F("MqttHomeAssistantDiscovery")], tmpBool))
_mqttHomeAssistant = tmpBool;
else
configComplete = false;
#endif
if (_initDone)
{
initializeINA226();
#ifndef WLED_DISABLE_MQTT
mqttInitialize();
#endif
}
_initDone = true;
return configComplete;
}
~UsermodINA226()
{
delete _ina226;
_ina226 = nullptr;
}
};
const char UsermodINA226::_name[] PROGMEM = "INA226";
static UsermodINA226 ina226_v2;
REGISTER_USERMOD(ina226_v2);

View File

@ -0,0 +1,66 @@
# Usermod INA226
This Usermod is designed to read values from an INA226 sensor and output the following:
- Current
- Voltage
- Power
- Shunt Voltage
- Overflow status
## Configuration
The following settings can be configured in the Usermod Menu:
- **Enabled**: Enable or disable the usermod.
- **I2CAddress**: The I2C address in decimal. Default is 64 (0x40).
- **CheckInterval**: Number of seconds between readings. This should be higher than the time it takes to make a reading, determined by the two next options.
- **INASamples**: The number of samples to configure the INA226 to use for a measurement. Higher counts provide more accuracy. See the 'Understanding Samples and Conversion Times' section for more details.
- **INAConversionTime**: The time to use on converting and preparing readings on the INA226. Higher times provide more precision. See the 'Understanding Samples and Conversion Times' section for more details.
- **Decimals**: Number of decimals in the output.
- **ShuntResistor**: Shunt resistor value in milliohms. An R100 shunt resistor should be written as "100", while R010 should be "10".
- **CurrentRange**: Expected maximum current in milliamps (e.g., 5 A = 5000 mA).
- **MqttPublish**: Enable or disable MQTT publishing.
- **MqttPublishAlways**: Publish always, regardless if there is a change.
- **MqttHomeAssistantDiscovery**: Enable Home Assistant discovery.
## Understanding Samples and Conversion Times
The INA226 uses a programmable ADC with configurable conversion times and averaging to optimize the measurement accuracy and speed. The conversion time and number of samples are determined based on the `INASamples` and `INAConversionTime` settings. The following table outlines the possible combinations:
| Conversion Time (μs) | 1 Sample | 4 Samples | 16 Samples | 64 Samples | 128 Samples | 256 Samples | 512 Samples | 1024 Samples |
|----------------------|----------|-----------|------------|------------|-------------|-------------|-------------|--------------|
| 140 | 0.28 ms | 1.12 ms | 4.48 ms | 17.92 ms | 35.84 ms | 71.68 ms | 143.36 ms | 286.72 ms |
| 204 | 0.408 ms | 1.632 ms | 6.528 ms | 26.112 ms | 52.224 ms | 104.448 ms | 208.896 ms | 417.792 ms |
| 332 | 0.664 ms | 2.656 ms | 10.624 ms | 42.496 ms | 84.992 ms | 169.984 ms | 339.968 ms | 679.936 ms |
| 588 | 1.176 ms | 4.704 ms | 18.816 ms | 75.264 ms | 150.528 ms | 301.056 ms | 602.112 ms | 1204.224 ms |
| 1100 | 2.2 ms | 8.8 ms | 35.2 ms | 140.8 ms | 281.6 ms | 563.2 ms | 1126.4 ms | 2252.8 ms |
| 2116 | 4.232 ms | 16.928 ms | 67.712 ms | 270.848 ms | 541.696 ms | 1083.392 ms | 2166.784 ms | 4333.568 ms |
| 4156 | 8.312 ms | 33.248 ms | 132.992 ms | 531.968 ms | 1063.936 ms | 2127.872 ms | 4255.744 ms | 8511.488 ms |
| 8244 | 16.488 ms| 65.952 ms | 263.808 ms | 1055.232 ms| 2110.464 ms | 4220.928 ms | 8441.856 ms | 16883.712 ms |
It is important to pick a combination that provides the needed balance between accuracy and precision while ensuring new readings within the `CheckInterval` setting. When `USERMOD_INA226_DEBUG` is defined, the info pane contains the expected time to make a reading, which can be seen in the table above.
As an example, if you want a new reading every 5 seconds (`CheckInterval`), a valid combination is `256 samples` and `4156 μs` which would provide new values every 2.1 seconds.
The picked values also slightly affect power usage. If the `CheckInterval` is set to more than 20 seconds, the INA226 is configured in `triggered` reading mode, where it only uses power as long as it's working. Then the conversion time and average samples counts determine how long the chip stays turned on every `CheckInterval` time.
### Calculating Current and Power
The INA226 calculates current by measuring the differential voltage across a shunt resistor and using the calibration register value to convert this measurement into current. Power is calculated by multiplying the current by the bus voltage.
For detailed programming information and register configurations, refer to the [INA226 datasheet](https://www.ti.com/product/INA226).
## Author
[@LordMike](https://github.com/LordMike)
## Compiling
To enable, compile with `INA226` in `custom_usermods` (e.g. in `platformio_override.ini`).
```ini
[env:ina226_example]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods} INA226
build_flags = ${env:esp32dev.build_flags}
; -D USERMOD_INA226_DEBUG ; -- add a debug status to the info modal
```

View File

@ -0,0 +1,6 @@
{
"name:": "INA226_v2",
"dependencies": {
"wollewald/INA226_WE":"~1.2.9"
}
}

View File

@ -0,0 +1,6 @@
[env:ina226_example]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods} INA226_v2
build_flags =
${env:esp32dev.build_flags}
; -D USERMOD_INA226_DEBUG ; -- add a debug status to the info modal

View File

@ -0,0 +1,197 @@
#include "wled.h"
class InternalTemperatureUsermod : public Usermod
{
private:
static constexpr unsigned long minLoopInterval = 1000; // minimum allowable interval (ms)
unsigned long loopInterval = 10000;
unsigned long lastTime = 0;
bool isEnabled = false;
float temperature = 0.0f;
uint8_t previousPlaylist = 0; // Stores the playlist that was active before high-temperature activation
uint8_t previousPreset = 0; // Stores the preset that was active before high-temperature activation
uint8_t presetToActivate = 0; // Preset to activate when temp goes above threshold (0 = disabled)
float activationThreshold = 95.0f; // Temperature threshold to trigger high-temperature actions
float resetMargin = 2.0f; // Margin below the activation threshold (Prevents frequent toggling when close to threshold)
bool isAboveThreshold = false; // Flag to track if the high temperature preset is currently active
static const char _name[];
static const char _enabled[];
static const char _loopInterval[];
static const char _activationThreshold[];
static const char _presetToActivate[];
// any private methods should go here (non-inline method should be defined out of class)
void publishMqtt(const char *state, bool retain = false); // example for publishing MQTT message
public:
void setup()
{
}
void loop()
{
// if usermod is disabled or called during strip updating just exit
// NOTE: on very long strips strip.isUpdating() may always return true so update accordingly
if (!isEnabled || strip.isUpdating() || millis() - lastTime <= loopInterval)
return;
lastTime = millis();
// Measure the temperature
#ifdef ESP8266 // ESP8266
// does not seem possible
temperature = -1;
#elif defined(CONFIG_IDF_TARGET_ESP32S2) // ESP32S2
temperature = -1;
#else // ESP32 ESP32S3 and ESP32C3
temperature = roundf(temperatureRead() * 10) / 10;
#endif
if(presetToActivate != 0){
// Check if temperature has exceeded the activation threshold
if (temperature >= activationThreshold) {
// Update the state flag if not already set
if (!isAboveThreshold) {
isAboveThreshold = true;
}
// Check if a 'high temperature' preset is configured and it's not already active
if (currentPreset != presetToActivate) {
// If a playlist is active, store it for reactivation later
if (currentPlaylist > 0) {
previousPlaylist = currentPlaylist;
}
// If a preset is active, store it for reactivation later
else if (currentPreset > 0) {
previousPreset = currentPreset;
// If no playlist or preset is active, save current state for reactivation later
} else {
saveTemporaryPreset();
}
// Activate the 'high temperature' preset
applyPreset(presetToActivate);
}
}
// Check if temperature is back below the threshold
else if (temperature <= (activationThreshold - resetMargin)) {
// Update the state flag if not already set
if (isAboveThreshold){
isAboveThreshold = false;
}
// Check if the 'high temperature' preset is active
if (currentPreset == presetToActivate) {
// Check if a previous playlist was stored
if (previousPlaylist > 0) {
// Reactivate the stored playlist
applyPreset(previousPlaylist);
// Clear the stored playlist
previousPlaylist = 0;
}
// Check if a previous preset was stored
else if (previousPreset > 0) {
// Reactivate the stored preset
applyPreset(previousPreset);
// Clear the stored preset
previousPreset = 0;
// If no previous playlist or preset was stored, revert to the stored state
} else {
applyTemporaryPreset();
}
}
}
}
#ifndef WLED_DISABLE_MQTT
if (WLED_MQTT_CONNECTED)
{
char array[10];
snprintf(array, sizeof(array), "%f", temperature);
publishMqtt(array);
}
#endif
}
void addToJsonInfo(JsonObject &root)
{
if (!isEnabled)
return;
// if "u" object does not exist yet wee need to create it
JsonObject user = root["u"];
if (user.isNull())
user = root.createNestedObject("u");
JsonArray userTempArr = user.createNestedArray(FPSTR(_name));
userTempArr.add(temperature);
userTempArr.add(F(" °C"));
// if "sensor" object does not exist yet wee need to create it
JsonObject sensor = root[F("sensor")];
if (sensor.isNull())
sensor = root.createNestedObject(F("sensor"));
JsonArray sensorTempArr = sensor.createNestedArray(FPSTR(_name));
sensorTempArr.add(temperature);
sensorTempArr.add(F("°C"));
}
void addToConfig(JsonObject &root)
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[FPSTR(_enabled)] = isEnabled;
top[FPSTR(_loopInterval)] = loopInterval;
top[FPSTR(_activationThreshold)] = activationThreshold;
top[FPSTR(_presetToActivate)] = presetToActivate;
}
// Append useful info to the usermod settings gui
void appendConfigData()
{
// Display 'ms' next to the 'Loop Interval' setting
oappend(F("addInfo('Internal Temperature:Loop Interval', 1, 'ms');"));
// Display '°C' next to the 'Activation Threshold' setting
oappend(F("addInfo('Internal Temperature:Activation Threshold', 1, '°C');"));
// Display '0 = Disabled' next to the 'Preset To Activate' setting
oappend(F("addInfo('Internal Temperature:Preset To Activate', 1, '0 = unused');"));
}
bool readFromConfig(JsonObject &root)
{
JsonObject top = root[FPSTR(_name)];
bool configComplete = !top.isNull();
configComplete &= getJsonValue(top[FPSTR(_enabled)], isEnabled);
configComplete &= getJsonValue(top[FPSTR(_loopInterval)], loopInterval);
loopInterval = max(loopInterval, minLoopInterval); // Makes sure the loop interval isn't too small.
configComplete &= getJsonValue(top[FPSTR(_presetToActivate)], presetToActivate);
configComplete &= getJsonValue(top[FPSTR(_activationThreshold)], activationThreshold);
return configComplete;
}
uint16_t getId()
{
return USERMOD_ID_INTERNAL_TEMPERATURE;
}
};
const char InternalTemperatureUsermod::_name[] PROGMEM = "Internal Temperature";
const char InternalTemperatureUsermod::_enabled[] PROGMEM = "Enabled";
const char InternalTemperatureUsermod::_loopInterval[] PROGMEM = "Loop Interval";
const char InternalTemperatureUsermod::_activationThreshold[] PROGMEM = "Activation Threshold";
const char InternalTemperatureUsermod::_presetToActivate[] PROGMEM = "Preset To Activate";
void InternalTemperatureUsermod::publishMqtt(const char *state, bool retain)
{
#ifndef WLED_DISABLE_MQTT
// Check if MQTT Connected, otherwise it will crash the 8266
if (WLED_MQTT_CONNECTED)
{
char subuf[64];
strcpy(subuf, mqttDeviceTopic);
strcat_P(subuf, PSTR("/mcutemp"));
mqtt->publish(subuf, 0, retain, state);
}
#endif
}
static InternalTemperatureUsermod internal_temperature_v2;
REGISTER_USERMOD(internal_temperature_v2);

Some files were not shown because too many files have changed in this diff Show More