* 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
* 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
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.
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.
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.
* 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
* 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
- 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)
- 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
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.
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.
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.
* 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
- 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
* 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()
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.
* 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
* 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
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.
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.
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.
* 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
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.
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
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
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
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.
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.
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
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.
- 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.
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.
- 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
- 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
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.
- 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
- 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
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.
* 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
* 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"
- 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()`
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>
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.
-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.
* fixed the positioning of the download button
* fixed space after "Download the latest binary:" disapering after building
* fixed typo
---------
Co-authored-by: maxi4329 <maxi4329>
- `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
- 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)
- 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
* 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)
- 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()`
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
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.
- 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.
- 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
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.
- 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
- 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.
- 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)
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)
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)
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.
- 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.
* 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.
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)
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)
* 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.
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
* 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)
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.
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.
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.
* 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()
Simplified the code by removing an unnecessary function definition and instead using direct assignment in the place where the function was previously called.
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.
# 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.
- 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
- 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)
- 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)
* 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.
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
- 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
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.
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!
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.
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
* 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
- 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.
-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).
- 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
Fix use-after-free issue and slightly improve code size. Note that the
version is changed to a hard pin, so future updates can be validated
before getting picked up by new clones, and old version builds
are reproducible.
By explicitly listing an unversioned framework dependency in
'platform_packages', we were overriding the selection via the 'platform'
specification, allowing PlatformIO to select any random version.
Remove this line to allow 'platform' to add the framework dependency
with the expected version.
use latest platformIO package, to avoid build errors due to missing 'scons'
> Tool Manager: Installing platformio/tool-scons @ ~4.40400.0
> Error: Could not find the package with 'platformio/tool-scons @ ~4.40400.0' requirements for your system 'linux_x86_64'
> Error: Process completed with exit code 1.
If the source never sends the push flag, WLED buffers the update but
never publishes it to the LEDs. This causes the confusing case where
the peek display shows one thing but the LEDs themselves something else.
Add a static flag that tracks if we've seen a push from the source;
until we do, apply every update as soon as it's received, per the DDP
specification.
There were three problems here:
- AsyncWebServer is going to copy to a heap buffer anyways, so we might
as well just pass it one it can use
- The buffer size estimate was wrong -- we need 9 bytes per pixel
("RRGGBB",), so the buffer could overflow, and it was not
considering the extra 2D requirements
- On ESP8266, the stack allocation was overflowing the stack, causing
corruption and crashes.
-added minimum threshold, had some crashes when setting threshold to zero before
-moved interrupt detach to GPIO deallocation where it belongs
-added check for touchbutton before detaching interrupt
-moved thochThreshold readout up so it gets updated before passing it to the system call
Release the json buffer lock as soon as we've finished serializing.
This should slightly reduce the number of lock collisions as the
response class isn't destructed until after the last packet is ack'd.
-added fully random palette function ('the old way', currently just used for initialization)
-changed randomness values to make it a little less random
-added 10% chance for pastel color palette
-now using swap() from std library for shuffeling
-changed function name
-moved update check from loadPalette() to handleRandomPalette() saving CPU cycles
There is a version of the Olimex ESP32-POE board with an ESP32-WROVER
module which has a the ethernet clock connected to a different IO than
the version with an ESP32-WROOM module.
This commit adds a new runtime selectable variant for the WROVER version.
Due to the midi interface being difficult/impossible to increment on
values of 1 because it has 7-bits of granularity, this commit moves all
the bitfields for configuring segment options left by one which
guarantees that every option has 2 values next to each other.
This allows midi controllers to more easily select an individual segment
option for 2D arrays.
Before this commit it was only possible to control mirror and reverse on
a 1d segment. All of the other options for 2d effects could not be set
and thus they would be kept disabled.
This commit replaces the Effect Option dmx channel with a bitfield which
allows for each segment option to be individually toggled depending on
which bit is set in the field. Backwards compatibility has been
maintained with existing 1d segment options.
Upgrade the MPU6050 usermod to provide configuration settings for
interrupt pin selection and calibration, a polled mode, and data
output for consumption by other usermods.
The MPU6050 library happens to choose the same defines as WLED, which
collide and result in nothing printing. Un- and re-define the macros
to work around this.
Add JSONBufferGuard, an RAII lock guard class for JSONBufferLock
analogous to std::lock_guard. This permits binding the guard to a scope,
such as an object life cycle or function body, guaranteeing that the
lock will be released when the scope exits.
Allows for "pixel perfect" liveview instead of diffused view, to better match what's shown at https://kno.wled.ge/features/effects/. This will make it easier to see what the LEDs are doing, although it may not be as accurate a representation for installations with diffused LEDs. Includes fallback to CSS gradient method for browsers that don't support canvas.
- CSS adjustments
- Removal of some html
- Correction of CORS error when using the file locally, it was unable to generate the images that are saved in WLED
- Among others that I don't remember now
- Correction in animation generation that was actually breaking
- Button to return to WLED if pxmagic.htm is accessed via url (http://), if accessed via external (file://) the button will not show
- Adjustments to CSS and some features
commit 1dab26bcbcac051f2b7be47a2d5c757a9938bf1f
Author: Christian Schwinne <dev.aircoookie@gmail.com>
Date: Thu Oct 19 13:29:46 2023 +0200
Update Discord invite links to point to guidelines channel
Remove sync receive
Disallow 2D effects on non-2D segments
Optimisations
Sync clarification
AR palettes
Return of 2 audio simulations
Bugfix in sync #3344
- remove excessive segments
- ignore inactive segments if not syncing bounds
- send UDP/WS on segment change
- pop_back() when removing last segment
Add pairing support for ESP-NOW sync
Reduce string RAM footprint
UDP parse optimisation
Make WizMote work with sync.
ESP-NOW wireless sync POC.
- caveat: devices have to be on the same channel
- clashes with WizMote handling ATM
@ -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.
// Waveform generator can create tones, PWM, and servos
typedefstruct{
uint32_tnextPeriodCcy;// ESP clock cycle when a period begins.
uint32_tendDutyCcy;// ESP clock cycle when going from duty to off
int32_tdutyCcys;// Set next off cycle at low->high to maintain phase
int32_tadjDutyCcys;// Temporary correction for next period
int32_tperiodCcys;// Set next phase cycle at low->high to maintain phase
uint32_texpiryCcy;// For time-limited waveform, the CPU clock cycle when this waveform must stop. If WaveformMode::UPDATE, temporarily holds relative ccy count
WaveformModemode;
boolautoPwm;// perform PWM duty to idle cycle ratio correction under high load at the expense of precise timings
}Waveform;
namespace{
staticstruct{
Waveformpins[17];// State of all possible pins
uint32_tstates=0;// Is the pin high or low, updated in NMI so no access outside the NMI code
uint32_tenabled=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_ttoSetBits=0;// Message to the NMI handler to start/modify exactly one waveform
int32_ttoDisableBits=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
# Check if Node.js is installed and present in PATH if it failed, abort the build
ifnode_exisNone:
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
${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.default_partitions} ;; if you get errors about "out of program space", change this to ${esp32.extended_partitions} or even ${esp32.big_partitions}
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.
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)!
// 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
// 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)
- 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`)
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.
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.
<palign="center"><imgsrc="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.
<palign="center"><imgsrc="pics/pic3.png"></p>
A device with the following sensors appears in HomeAssistant. Please note that MQTT must be activated in HomeAssistant.
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.
<palign="center"><imgsrc="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.
<palign="center"><imgsrc="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`)
- 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.
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"
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"
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"
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"
// between 0 and 1, to control strength of voltage smoothing filter
floatalpha=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
// 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
// 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
@ -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;
floatrawValue=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
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
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)
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 |
// 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)
@ -285,13 +283,13 @@ class MyExampleUsermod : public Usermod {
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');"));
@ -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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.