Compare commits

..

2237 Commits

Author SHA1 Message Date
cb267a20c7 readme.md aktualisiert 2023-11-21 17:27:11 +01:00
24cb3ae8e0 readme.md aktualisiert 2023-11-21 17:26:41 +01:00
16a3148235 readme.md aktualisiert 2023-11-21 17:25:59 +01:00
Christian Schwinne
1dab26bcbc
Update Discord invite links to point to guidelines channel 2023-10-19 13:29:46 +02:00
Frank
3847bfc41a npm run build
plus fixing a small typo in VERSION
2023-10-13 13:55:13 +02:00
Frank
783424dd26 version bump 0.14.0 (release) 2023-10-13 13:45:25 +02:00
Frank
5dadf92a62
also change second discord link in readme
seems this was missing in the previous PR.
2023-10-11 21:09:56 +02:00
Frank
76821addd7
Merge pull request #3437 from chrishultin/fix_discord_invite
Updating "Discord" invite to point to #general
2023-10-11 21:07:22 +02:00
Christopher
a769c55c72 Updating "Discord" invite to point to #general 2023-10-11 09:58:58 -06:00
Frank
4245767357
fix for partly uninitialized sound sync packets (audioreactive)
audioSyncPacket contains four "invisible" padding bytes added by the compiler. These need to be initialized to zero, as future versions of the protocol will make use of these fields.
2023-10-08 19:54:14 +02:00
Frank
74d196ad50 npm run build
chores
2023-10-06 16:37:12 +02:00
Frank
3c4649748d
Merge pull request #3420 from mountainash/fix/duplicate-viewport-declaration
Remove duplicate `viewport` declaration, put lang=en into the right place
2023-10-06 16:27:25 +02:00
Frank
22985900a8
Merge pull request #3425 from mountainash/fix/git-ignore
.gitignore Reordered & grouped
2023-10-06 16:26:04 +02:00
Mountain/\Ash
32ab2ae201 Allow /wled00/html_*.h files 2023-10-05 11:55:48 +02:00
Mountain/\Ash
23e4a2e28e Reordered & grouped 2023-10-05 10:26:51 +02:00
Mountain/\Ash
40515e62ac Ignoring HTML build output 2023-10-05 10:21:24 +02:00
Mountain/\Ash
b5751795b5 Fix: lang moved to the correct HTML element 2023-10-04 21:42:15 +02:00
Mountain/\Ash
43d6151506 Fix: removing duplicate viewport declaration
- removed unneeded self-closing slash
2023-10-04 21:37:10 +02:00
Frank
26e766ee19
Merge pull request #3406 from Aircoookie/sunset_accuracy_fix
fix for #3400 - wrong sunset time 00:00
2023-10-02 19:58:06 +02:00
Frank
1c3fdb73fb optimization: only use "float" math functions
- saves 5KB flash and some RAM
-allow to build with -D WLED_USE_UNREAL_MATH, to restore old behaviour and save another 6KB flash
2023-10-01 19:04:30 +02:00
Blaz Kristan
332be7edd6 Build bump. 2023-10-01 13:38:10 +02:00
Blaz Kristan
7e6eb65950 Fix for #3403 2023-10-01 13:26:31 +02:00
Blaz Kristan
b0a56a431b Fix for #3405 2023-10-01 13:04:05 +02:00
Frank
166316e0c5 fix for #3400
replace low_accuracy math functions (sint_t, cos_t, atan_t, ...) with standard libm functions that have higher accuracy.
2023-09-30 23:34:02 +02:00
Blaz Kristan
5eadbe7ecd FX update
- Meteor: trail & 0.13 behaviour
- Meteor Smooth: train & 0.13 behaviour
- Scrolling Text: rotation
2023-09-24 16:48:59 +02:00
Frank
ea7e0c6204 npm run build
regenerate UI files from latest sources.
2023-09-23 21:22:14 +02:00
Frank
2dcb126e6d version bump 0.14.0-b6
beta release preparation.
2023-09-23 21:08:11 +02:00
Frank
438525e8ec
AR: use bandpass filter for analog input
Many bad quality analog mics are not centered properly at 1.6V, but stuck at 0V or stuck at 3.3V in silence. The bandpass filter removes DC offsets and improve signal quality.
2023-09-23 16:48:45 +02:00
Frank
eb66a403d9
Merge pull request #3377 from christianpatterson/audioreactive-initialize-i2ssource-bugfix
Fix ES8388Source & ES7243 initialization.
2023-09-19 16:32:10 +02:00
Frank
26ac612474 fix wrong signature of SPH0654::initialize()
* debug messages added to different initializers
* SPH0654::initialize() was having a wrong signature: uint8 instead of int8.

C++ can be a real bastard ;-)
2023-09-19 15:27:41 +02:00
Frank
43613e3b10
Matrix effect speedup
Typically, more than 50% of pixels are black. 
This optimization avoids to fade and rewrite already black pixels.
2023-09-18 15:56:50 +02:00
Frank
555dd2e726
matrix: fix for a corner case (e.g. gapmaps)
workaround for a corner case; if the reference pixels falls into a "gap" then gPC returns BLACK. Solutions is to reject BLACK.
2023-09-18 15:34:53 +02:00
Frank
3260f46543 bugfix for #3375
* improves robustness of the Matrix effect, by dynamically adjusting the "reference color" used to identify "falling code" head pixels.
* a bit faster, as I've removed the need to scan all pixels a second time for "black screen" detection.

Its still not perfect, and the main loop could be simplified a lot by leveraging on the fact that all changes actually happen in the top row, and "falling" is actually just moving everything down by one pixel.
2023-09-18 14:57:15 +02:00
Christian Patterson
f9de23402a Remove obsolete I2C parameters from AudioSource::initialize and all overriding methods. 2023-09-17 19:10:18 -05:00
Christian Patterson
9e155cf94a Fix ES8388Source & ES7243 initialization.
Update ES8388Source::initialize and ES7243::initialize method signatures to match I2SSource::initialize so that when initialize is called on a AudioSource pointer the child class's method is used.
2023-09-17 14:12:20 -05:00
Frank
527e3d6cd0
Merge pull request #3373 from Aircoookie/ripple-tweak
2D Ripple and Meteor effect tweak
2023-09-17 18:48:43 +02:00
Blaz Kristan
c7d45c28cf Meteor effect change
- remedy for #3374
2023-09-16 12:30:57 +02:00
Blaz Kristan
87cc3fd714 2D Ripple effect tweak
for #3370
2023-09-16 00:21:10 +02:00
Frank
282d58a6fe
audioreactive: stack size tuning
This gives ~3KB extra free heap on -S2.
2023-09-14 18:26:57 +02:00
Blaz Kristan
fc4ed1c50b Fix for #3369 2023-09-12 16:48:32 +02:00
Frank
60c47cfca1 npm run build
regenerated UI files
2023-09-10 16:59:31 +02:00
Frank
720abd4e04 version bump 0.14.0-b5
preparations for releasing -beta5
2023-09-10 16:54:59 +02:00
Frank
b4fe694d1b esp32 buildenv with audioreactive
To make it better readable and prevent copy&paste errors, all needed flags can be referenced from the "esp32" buildenv:
  ${esp32.AR_build_flags}
  ${esp32.AR_lib_deps}
2023-09-10 16:30:04 +02:00
Frank
c117785554 8266 optional build flags to increase IRAM
related to #3364
2023-09-10 02:00:09 +02:00
Frank
e9723de6c3 minor updates for audioreactive
* remove "not supported" warning on -S2
* minor tweaking of beat detector
* optimized parameters for arduinoFFT
* fixed a few implicit "double" promotions
* minor UDP protocol optimizations
* small optimization for fft task create / suspend
* completely remove analogmic settings for -S3/-S2/-C3 where analog is not supported

changes were already tested extensively in the MM fork.
2023-09-09 21:07:20 +02:00
Frank
da0cf01eee fixing a few implicit promotions to double
any expression with at least on "double" is evaluated as double, which is slow.
2023-09-09 20:48:17 +02:00
Blaz Kristan
e40f266042 Better bugfix in mode blending when _t is unallocated 2023-09-08 16:01:11 +02:00
Frank
69fb15d3cb debug message optimizations for 8266
as discussed in previous commit.
2023-09-08 14:06:57 +02:00
Frank
188956a4af bugfix for random crash when switching between presets
this is a band-aid fix for random crashes when switching between presets with multiple segments - crossfade disabled.

!! adding type initializers fixed it for me on -S3, however I still see (less frequent) crashes on esp32, due to heap corruption.

It took me hours to get a meaningful stackdump:

assert failed: heap_caps_free heap_caps.c:360 (heap != NULL && "free() target pointer is outside heap areas")

Backtrace: 0x40084ee1:0x3ffb2570 0x4008e341:0x3ffb2590 0x40094709:0x3ffb25b0 0x4008534a:0x3ffb26e0 0x40094739:0x3ffb2700 0x400e9037:0x3ffb2720 0x400e917c:0x3ffb2740 0x400eaeeb:0x3ffb2760 0x40117ec5:0x3ffb27c0 0x401184ea:0x3ffb2800 0x4013509d:0x3ffb2820

  #0  0x40084ee1:0x3ffb2570 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
  #1  0x4008e341:0x3ffb2590 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128
  #2  0x40094709:0x3ffb25b0 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
  #3  0x4008534a:0x3ffb26e0 in heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:360
      (inlined by) heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:345
  #4  0x40094739:0x3ffb2700 in free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39
  #5  0x400e9037:0x3ffb2720 in Segment::deallocateData() at wled00/FX_fcn.cpp:189
  #6  0x400e917c:0x3ffb2740 in Segment::resetIfRequired() at wled00/FX_fcn.cpp:206
      (inlined by) Segment::resetIfRequired() at wled00/FX_fcn.cpp:203
  #7  0x400eaeeb:0x3ffb2760 in WS2812FX::service() at wled00/FX_fcn.cpp:1216 (discriminator 2)
  #8  0x40117ec5:0x3ffb27c0 in WLED::loop() at wled00/wled.cpp:115 (discriminator 3)
  #9  0x401184ea:0x3ffb2800 in loop() at C:/src/wled00/wled00.ino:20
  #10 0x4013509d:0x3ffb2820 in loopTask(void*) at C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50

ELF file SHA256: 18c20b536f4c6ef4
2023-09-08 12:06:23 +02:00
Frank
c7dd4a7f2b potentiometer: check that pin supports ananlogread
newer esp32 frameworks will throw lots of warnings when trying to read from a non-analog pin.
2023-09-07 18:55:13 +02:00
Frank
111f1729c9
Update CHANGELOG.md
small correction
2023-09-07 17:51:28 +02:00
Blaz Kristan
164372b46a Update changelog 2023-09-07 16:32:59 +02:00
Frank
1af3794fed
Merge pull request #1039 from pjhatch/PJH_ADD_Linearbounce
Pjh add linearbounce
2023-09-06 11:14:43 +02:00
Blaz Kristan
885f4ded0c Merge branch 'main' into PJH_ADD_Linearbounce 2023-09-05 21:20:55 +02:00
Frank
9bb018d8d9 bump to build 2309050 2023-09-05 19:15:22 +02:00
Frank
58187e00e6 optional ball trails (rolling balls) 2023-09-05 19:11:44 +02:00
Frank
5110a8c636 Squashed commit of the following:
commit 84148ad07a
Author: Blaz Kristan <blaz@kristan-sp.si>
Date:   Sun Sep 3 12:34:17 2023 +0200

    Implement palette colors

commit af3c8f66f7
Author: Blaz Kristan <blaz@kristan-sp.si>
Date:   Tue Aug 1 18:18:41 2023 +0200

    revert wled00.ino

commit 3097a1b17e
Author: Blaz Kristan <blaz@kristan-sp.si>
Date:   Tue Aug 1 18:13:37 2023 +0200

    minor aesthetic fixes

commit 54b80f74b2
Author: Blaz Kristan <blaz@kristan-sp.si>
Date:   Tue Aug 1 18:09:32 2023 +0200

    remove unused variable

commit 9a78d28cd7
Merge: 56a74bc5 1ed81793
Author: Blaz Kristan <blaz@kristan-sp.si>
Date:   Tue Aug 1 18:08:29 2023 +0200

    Merge branch 'main' into PJH_ADD_Linearbounce

commit 56a74bc54c
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Sat Aug 15 12:34:13 2020 -0500

    Update FX.cpp

    Added the improvements suggested by Gregor Hartmann

commit a20358b61b
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Sun Jul 12 08:33:48 2020 -0500

    Adding 2 ball track modes

    With and without collisions

commit 341d9d1697
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Sun Jul 5 14:55:14 2020 -0500

    Update FX.cpp

    Still 1 bug to fix - this was a test.

commit 9cee424383
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Sun Jul 5 14:53:14 2020 -0500

    Update FX.cpp

commit 37cb51cfd6
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Thu Jul 2 14:16:25 2020 -0500

    Adding Collision

    A couple of bugs still need sorting

commit 84b7bfb989
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Sun Jun 28 19:59:46 2020 -0500

    update for lost balls

    Added some protection - so that when intensity is lowered and raised some time later balls that have moved way off the track are recovered.

commit 04d17e4839
Author: pjhatch <66844564+pjhatch@users.noreply.github.com>
Date:   Sun Jun 28 19:43:56 2020 -0500

    Added Ball Track V1

    In this version the balls bounce of the edges and do not interact with one another.
2023-09-05 18:39:51 +02:00
Frank
ddbe883d47 Merge branch 'fx-blending' 2023-09-05 18:37:55 +02:00
Frank
945ac82b6a
fix small typo in MQTT override code
bracket was on wrong position, resulting in this warning:

wled00/set.cpp:357:79: warning: value computed is not used [-Wunused-value]
     strlcpy(mqttGroupTopic, request->arg(F("MG")).c_str(), MQTT_MAX_TOPIC_LEN)+1;
2023-09-05 17:15:12 +02:00
Blaz Kristan
84148ad07a Implement palette colors 2023-09-03 12:34:17 +02:00
Blaž Kristan
25553a28a1
Merge pull request #3351 from PSandro/pr_info_time
show current local time in info page ⏲️
2023-09-02 20:52:33 +02:00
Blaz Kristan
c2f5846a8e Add optional compile flag 2023-09-02 20:20:51 +02:00
Blaž Kristan
3f98e9451a
Merge pull request #3348 from djasonic/staircase-toggle-pr 2023-09-02 18:52:16 +02:00
Blaž Kristan
6c72194346
Add compile time MQTT override (#3354)
- for max server name length
- for max topic length

Fix for #3353
2023-09-02 01:05:45 +02:00
Dimitry
822dd24756
Add Internal Temperature usermod (#3246)
* Add Internal Temperature usermod

* Fix line endings

* Update readme

* Format readme
2023-09-01 19:43:21 +02:00
Blaz Kristan
262ed38429 Fix for #3352 2023-08-31 19:10:22 +02:00
Sandro Pischinger
5ff66ce4dd recreate html_ui.h & html_simple.h 2023-08-30 20:58:32 +02:00
Sandro Pischinger
ca73b8e0b8 rename 'Current local time' -> 'Time' 2023-08-30 20:57:54 +02:00
Sandro Pischinger
2d49ace0e3 recreate html_ui.h & html_simple.h 2023-08-30 20:45:05 +02:00
Sandro Pischinger
d52f22044e Revert "recreate web ui files"
This reverts commit 2bf052aac9.
2023-08-30 20:43:22 +02:00
Sandro Pischinger
2bf052aac9 recreate web ui files 2023-08-29 23:52:32 +02:00
Sandro Pischinger
a79c9d5f4f info page: add time 2023-08-29 23:44:08 +02:00
Blaz Kristan
6f9bcf1858 Merge branch 'main' into fx-blending 2023-08-28 17:59:02 +02:00
Blaz Kristan
d1b00ba95d Bugfix.
- feed WDT even if strip is updating
- provide custom palette names
- handle interface cooldown properly
- rotary encoder ALT fix for custom palettes
2023-08-28 17:58:30 +02:00
Frank
bb45bee7f8 oappend() debug message when buffer is full
oappend() silently discards strings when the buffer is full, leading to strange effects like half-working UI pages.

The new debug message will help developers to understand what could be wrong.
2023-08-27 23:01:55 +02:00
Jason Cobb
246f0b21fd staircase toggle power on/off option bool 2023-08-26 22:19:52 -05:00
Blaz Kristan
394443b6d1 Merge branch 'main' into fx-blending 2023-08-25 18:34:56 +02:00
Blaz Kristan
fc1dd2daac Fix for #3346 2023-08-25 18:34:11 +02:00
Blaz Kristan
ba1b6f321e Button bugfix. 2023-08-23 14:50:46 +02:00
Blaz Kristan
06402cf1c6 Making buffer fix easy to maintain and portable.
Thanks to @softhack007
2023-08-17 17:10:29 +02:00
Blaz Kristan
dfc33389d8 Optimisation. 2023-08-17 16:46:31 +02:00
Blaz Kristan
4e83752655 Merge branch 'main' into fx-blending 2023-08-17 16:24:47 +02:00
Blaz Kristan
7e28718681 Too long metadata string bugfix. 2023-08-17 16:24:16 +02:00
Blaz Kristan
bf452e922a Playlist saving bugfix.
Fixes #3324
2023-08-16 22:11:16 +02:00
Blaz Kristan
4911a74cac Scrolling text enhancement.
- breaking change
- remove leading 0 checkmark
- add reverse scroll checkmark
- add vertical scroll if text fits into segment (intensity ==0 or ==255)
- rotated characters
- leading 0 check added to short texts (i.e. #DDMM0)
Fixes #3322
2023-08-16 21:02:00 +02:00
Blaž Kristan
a2bda5a4db
Merge pull request #3317 from chroma-tech/group-masks-api
Add send and receive groups to json api
2023-08-14 13:01:16 +02:00
Shlomo Zippel
800abc605f Add send and receive groups to json api 2023-08-13 11:44:02 -07:00
Blaz Kristan
ac83b67632 Cleaner transition code.
Fixed skipped pixel flashing.
2023-08-12 12:45:11 +02:00
Blaz Kristan
00bc7dccb9 Merge branch 'main' into fx-blending 2023-08-12 11:36:40 +02:00
cschwinne
04aa9f0e61 Release of WLED beta 0.14.0-b4 2023-08-11 23:11:08 +02:00
Blaz Kristan
353e97a4c1 Clear status pixels 2023-08-11 00:48:32 +02:00
Blaz Kristan
7b28387bb4 Comments from Aircoookie addressed 2023-08-09 17:23:21 +02:00
Christian Schwinne
1889fe23c5
Merge branch 'main' into fx-blending 2023-08-09 16:58:21 +02:00
Blaz Kristan
9832fbe042 Segment reset 2023-08-08 20:40:19 +02:00
Blaz Kristan
084070475d Chasing memory corruption/leaks. 2023-08-07 16:50:18 +02:00
Blaz Kristan
cb42ca8765 FX optimisation 2023-08-06 19:11:44 +02:00
Frank
45d7e66488 effects bugfix: prevent crash when SEGLEN==1
* Blurz and a few other effects would crash (or behave unexpectedly) for single pixel segments
* replaced a few "MAX" by "max", because MAX will evaluate its arguments twice so its very inefficient.
2023-08-05 23:33:50 +02:00
Blaz Kristan
93a1616933 Blend tweaking. 2023-08-05 21:01:06 +02:00
Blaz Kristan
9a87a2ff0d Blending 2023-08-05 17:35:14 +02:00
Blaz Kristan
bdff05feaf Palette blending optimisation. 2023-08-05 13:53:12 +02:00
Blaz Kristan
937e3d0b94 FX blending POC 2023-08-05 13:50:08 +02:00
Blaz Kristan
8503aba583 Better random palette handling.
Remove unnecessary debug timing.
2023-08-03 22:28:53 +02:00
Blaz Kristan
bb8223d4ff Soap bugfix. 2023-08-02 22:01:15 +02:00
Blaz Kristan
af3c8f66f7 revert wled00.ino 2023-08-01 18:18:41 +02:00
Blaz Kristan
3097a1b17e minor aesthetic fixes 2023-08-01 18:13:37 +02:00
Blaz Kristan
54b80f74b2 remove unused variable 2023-08-01 18:09:32 +02:00
Blaz Kristan
9a78d28cd7 Merge branch 'main' into PJH_ADD_Linearbounce 2023-08-01 18:08:29 +02:00
Frank
5df197e814
disable ESP-NOW remotes in ethernet build (will crash without wifi) 2023-08-01 13:11:06 +02:00
Frank
5fe09e9787
esp-now remote: fix crash with AP = Always
initialize ESPNOW only when Wifi (STA or AP) is running
2023-08-01 11:53:32 +02:00
Frank
1ed817932b esp-now remote: reduce number of exported functions
too many global variables and functions ... this makes stuff 'static' that can remain at file scope
2023-07-30 21:47:18 +02:00
Aiden
0ccadb246f
Add WireGuard VPN usermod (#3270)
* added wireguard VPN usermod

* add example PIO override & edit readme

* add contact information and improve usermod performance
2023-07-27 11:35:52 +02:00
dependabot[bot]
b67235a7e5
Bump certifi from 2022.12.7 to 2023.7.22 (#3301)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.12.7 to 2023.7.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2022.12.07...2023.07.22)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 16:29:21 +02:00
Christian Schwinne
93853613bd
Merge pull request #3280 from Aircoookie/alt-buffer
Bus-level global buffering
2023-07-25 17:01:49 +02:00
Frank
1ecb4fedcc
2D Drift: minor optimization
moving "t/20" out of the main loop gives some speedup.
2023-07-21 16:09:01 +02:00
Frank
c8fdf3731a upgrade to FastLED 3.6.0
changes from 3.50 to 3.6.0:
* bugfixes
* removed "register" keyword
* some speedups
* explicit bool() and uint32_t() operators, see https://github.com/FastLED/FastLED/issues/819

FX.cpp:  bugfix for "wled00/FX.cpp:4906:36:
error: cannot convert 'CRGB' to 'uint32_t' {aka 'unsigned int'} in initialization"
2023-07-20 22:36:47 +02:00
Frank
f8e766ffc0 add -S3 PSRAM (qio_opi) to nightly builds 2023-07-20 22:21:02 +02:00
Frank
050489dd80 allow Lolin Wifi Fix on -S3 2023-07-20 22:09:48 +02:00
Frank
2db966ba47 Improvements for -S3 with PSRAM
qio_opi:   PSRAM  8MB or 16MB
qio_qspi:  PSRAM  2MB or 4MB

fun fact: _opi and _qspi modes both require a special bootloader.
2023-07-20 22:09:14 +02:00
Frank
aa54d65f63 upgrade -S3/-S2/-C3 to platform 5.3.0
platform 5.3.0 = arduino-esp32 v2.0.6 + esp-idf v4.4.3

--> you will need new bootloader files for arduino-esp32 v2.0.6

--> coredumps are supported now, if you leave 64Kb of flash at the end of your partitions file (see example in wled_esp32_8MB.csv)
2023-07-20 21:39:25 +02:00
cschwinne
e3ee48b52e Deallocate relay, button and IR pins prior to reallocation in JSON config parser (#3294) 2023-07-19 18:02:57 +02:00
cschwinne
8ccf349458 Always repaint NPB buffer on brightness change
Fix bus re-init causing full brightness (every show() now attempts to set the brightness, bus will ignore this if it stays the same)
2023-07-19 17:25:25 +02:00
cschwinne
2fce15db94 Restore brightness immediately after show() 2023-07-19 16:22:34 +02:00
Blaz Kristan
0cf50e8000 FX Fireworks optimisation 2023-07-19 16:06:41 +02:00
cschwinne
5b9630cf46 Repaint NPB buffer on brightness updates 2023-07-19 13:50:09 +02:00
Blaz Kristan
7dcbb409a9 Trying to solve ABL bug.
(no more pulsing)
2023-07-18 23:33:28 +02:00
Blaž Kristan
286e057fae
Merge pull request #3216 from netmindz/AC-ES8388
ES8388 Support
2023-07-18 18:48:40 +02:00
Will Tatam
7d4fe341f1 Remove direct setup for I2C from ES8388 driver 2023-07-18 17:21:45 +01:00
Will Tatam
76acb7bb58 Merge branch 'main' into AC-ES8388 2023-07-18 16:36:42 +01:00
Frank
5ef7cd7bdd blur bugfix
turns out that fastLED 3.6.0 has an explicit uint32_t operator that returns RGBA, however  3.5.0 does not have this and the conversion returned only the "red" component".
2023-07-18 13:12:52 +02:00
Frank
ebb4628e66 Minor correction (slider names)
"Time delay" is actually "speed" - bigger values make the effect run faster.
2023-07-18 13:12:52 +02:00
Frank
0928060c75 blur bugfix
turns out that fastLED 3.6.0 has an explicit uint32_t operator that returns RGBA, however  3.5.0 does not have this and the conversion returned only the "red" component".
2023-07-18 11:29:08 +02:00
Frank
d8f9a9a03c
Minor correction (slider names)
"Time delay" is actually "speed" - bigger values make the effect run faster.
2023-07-17 20:38:34 +02:00
Blaz Kristan
abfb8bbc34 Fix (almost good) for unbuffered ABL calculations. 2023-07-17 17:06:04 +02:00
Blaz Kristan
82e01f7b17 Fixed ABL calculation. 2023-07-17 16:15:17 +02:00
dependabot[bot]
a97609e920
Bump semver from 5.7.1 to 5.7.2 (#3289)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-15 20:10:32 +02:00
Blaz Kristan
f1e1bd41b9 Slight optimisation in BusDigial::getPixelColor() 2023-07-14 15:58:03 +02:00
Blaz Kristan
57d35858d8 Merge branch 'main' into alt-buffer 2023-07-14 15:39:18 +02:00
Blaz Kristan
0b956c66c1 changelog update 2023-07-14 13:07:33 +02:00
Blaž Kristan
b1dfa1db61
Merge pull request #3291 from Aircoookie/onoff-nodes
Add ability to toggle devices from nodes view.
2023-07-14 12:41:15 +02:00
Blaz Kristan
cb579ecc62 Broadcast change. 2023-07-14 11:07:35 +02:00
cschwinne
ae235aa58c Fix UI handling of in-between inactive segments 2023-07-14 01:12:19 +02:00
Blaz Kristan
6302056182 Add ability to toggle devices from nodes view. 2023-07-13 22:21:15 +02:00
cschwinne
5e20abd7f1 Move segment bounds queuing to WS2812FX 2023-07-13 13:08:36 +02:00
Frank
72a72dbc88
proper rounding of FPS 2023-07-13 12:49:19 +02:00
cschwinne
4766666913 Static queued segment bounds
(saves 180 bytes of RAM)
Fixed segment index not increasing on inactive segments
2023-07-13 03:09:42 +02:00
Blaz Kristan
fa6070c680 Multiple updates:
- additional debug timings
- removed local leds[] buffer
- async segment bounds change (crashes seen otherwise)
- added isActive() check to Segment drawing methods
- ABL simplification
- palette option for Black hole (FX)
- (possible) crash mitigation is Segment handling (rapid preset changes)
2023-07-12 20:52:34 +02:00
cschwinne
6267d11e51 Fix compilation and ABL scaling 2023-07-09 12:32:28 +02:00
Christian Schwinne
822298ab66
Merge branch 'main' into alt-buffer 2023-07-09 11:31:02 +02:00
Blaz Kristan
2ad3ab7f0d Correct scaling for peek. 2023-07-06 22:48:13 +02:00
Blaz Kristan
f437fd6cd6 Code readability.
Fix for peek.
Loop timing.
2023-07-06 21:16:29 +02:00
Frank
42b247756a blur speedup
it seems that SEGMENT.blur() is the main bottleneck for many 2D effects.

This change optimizes performance of the function:
* avoid to re-write unchanged pixels
* early exit when blur_amount == 0 (=nothing to do)
* use _fast_ types where possible

I've seen up to 20% speedup with this change.
2023-07-06 19:51:37 +02:00
Frank
fbbf2d5eb3 2DPlasmaball - optimize out float 2023-07-06 19:07:09 +02:00
Frank
788a276616 fix power calculation for NeoPixelBusLg
power estimation results from estimateCurrentAndLimitBri() were too low (example: estimated 1.3Amp, measured 1.6Amp). This change corrects the power calculation. Due to the changed behavior of getPixelColor, powerSum must be used as-is, not scaled down again by brightness.
2023-07-06 19:06:31 +02:00
Frank
196779ffb6
XY: minor bugfix
properly handle width=0 OR height=0
2023-07-06 09:54:12 +02:00
Blaz Kristan
59a144baed Disable global buffer on ESP8266 by default
Remove global dependency from Bus class and subclasses
Remove timings
2023-07-05 23:57:46 +02:00
Blaz Kristan
ad825b80b0 Added a few debug timings. 2023-07-05 17:16:54 +02:00
Frank
45a0061660
reverting _restaurationBri change
see previous discussion
2023-07-05 14:26:09 +02:00
Frank
8831c76fb4 restoreColorLossy small optimization
minor optimizations that give up to 10% speedup in my tests
* use "fast" integer types (where possible)
* replaced _bri with _restaurationBri (no use of globals)
2023-07-04 16:22:19 +02:00
Blaz Kristan
66616e1cab Some timings added. 2023-07-03 21:13:01 +02:00
Frank
fa281a0df0 ABL optimization
this optimization avoids to apply brightness two times .

NeoPixelBusLg has already applied global brightness at sPC. Due to internal working of the Lg bus, its sufficient to only post-apply scaling, and set the new (scaled) brightness for the next frame.
2023-07-03 19:23:57 +02:00
Frank
d48a96599f prevent races on leds buffer (looptask vs. async_tcp)
I still see strange crashes in setPixelColor/GetpixelColor, which ssem to come from race conditions between async_tcp (change presets) and looptask (strip.service).
To make the situation better, its important that any global pointers are reset to NULL immediately after free().
2023-07-03 19:15:50 +02:00
Frank
7de7ef8e8c fix some crashes when changing presets
This fixes some of the crashes I had when changing presets.

still not a full solution ...
2023-07-03 17:00:43 +02:00
Frank
406a254523 inactive segments robustness improvement
* Avoid uint16 underflow in width() and height(): stop > start is possible, and means "inactive segment".

Without these checks, it was possible that width() and height() produce VERY large values due to underflow.
2023-07-03 15:43:47 +02:00
Frank
eabd6f60ef soudsim bugfix
FFT_MajorPeak was just going from 0..255.
Now it simulates the full range from 21hz ... 8Khz
2023-07-03 15:07:14 +02:00
Frank
e416d06aa9
Merge pull request #3274 from Aircoookie/ABL_hotfixPlus
some optimizations for ABL hotfix
2023-07-03 14:36:46 +02:00
Frank
65e073e6b8 de-optimization
first version still cased some flickering.
This de-optimization makes LEDs more stable.
2023-07-03 14:01:45 +02:00
Frank
45ac0d5dc6 fix for #3276
due to `if (strip.isUpdating()) return;` reading the encoder did not happen in time if the strip was active - with high number of LEDs, this means "always updating". Similar observation that we had with the audioreactive usermod, and similar solution.
2023-07-02 19:14:32 +02:00
Blaz Kristan
c9ef034ab8 Build bump/fix 2023-07-02 13:43:29 +02:00
Titanium177
c89f38f4f8
Edited Metadata for effect 5 & 8 to be availible on just 1 Pixel (PWM) (#3275) 2023-07-01 23:18:02 +02:00
Blaz Kristan
858b57d77a Return of local leds[] 2023-07-01 21:48:30 +02:00
Frank
9b87892036 optimization for ABL hotfix
* adding an optional parameter to setBrightness(). ApplyPostAdjustments() will only be called if `immediate=true`. Only ABL will use immediate=true, to ensure electrical safety of equipment.

This allows some optimizations of performance, as ApplyPostAdjustments() is time consuming.

* busses.setBrightness(bri) --> applied to all future pixels (fast, lossless)
* busses.setBrightness(bri, true) --> applied directly to all previously set pixels (slower, lossy)
2023-07-01 20:09:52 +02:00
Blaz Kristan
272f96b405 Double buffering at bus level. 2023-06-30 21:12:59 +02:00
Andre Lackmann
3e519001a3
Removed current cycle assignment that clears current value (#3262) 2023-06-30 15:03:32 +02:00
Blaz Kristan
f442aad962 Misc.
- larger stack buffer for oappend
- increase max segment name for ESP32
2023-06-27 16:01:20 +02:00
Christian Schwinne
fa9b151c36 Slightly more efficient buffer copy to busses 2023-06-27 01:57:05 +02:00
Christian Schwinne
481bd6f57a
Add WiFi network scan RPC command to Improv Serial (#3271) 2023-06-27 01:51:44 +02:00
Blaž Kristan
f015227fc8
Missing WS connection fallback for liveview (#3267)
* Missing WS connection fallback for liveview
- fix for #3250

Remove (conditional WLED_ENABLE_LEGACY) legacy URI

Replace /sliders with /?sliders

* Merge liveview and liveviewws pages

Remove /url string subpage
Enable /json/live by default

* WS retry count
Removed appended ws from URL

* Also reset WS retries on successful WS connection

---------

Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2023-06-27 01:51:24 +02:00
Christian Schwinne
61ba16b779 Global buffer and ABL fixes 2023-06-27 00:38:30 +02:00
Christian Schwinne
f6e86bfcf8 First global buffer iteration 2023-06-26 22:12:32 +02:00
Christian Schwinne
498dd76730 Decouple segment led buffer from global led buffer 2023-06-26 18:16:38 +02:00
Christian Schwinne
ebd909dfe7 Remove obsolete Visual Studio files 2023-06-26 00:17:34 +02:00
Blaz Kristan
067ed1258b Temporary bugfix for #3264 2023-06-24 21:04:46 +02:00
Blaz Kristan
ef3c72a24f Fix for #3265 2023-06-23 23:49:54 +02:00
Blaz Kristan
b257f476c9 Bugfix for #3259 2023-06-22 19:06:07 +02:00
Alerson Jorge
d3af2be79a
Adding Pixel Magic Tool to WLED (#3249)
* Adding Pixel Magic Tool to WLED

* Revert "Adding Pixel Magic Tool to WLED"

This reverts commit b4f08fa8d5.

* Adding Pixel Magic Tool to WLED

* Corrections and performance improvements

* Remove IE compatibility tag

(saves a few bytes and IE10 is over 10 years old and unsupported)
Correct HTML language attribute
(Chrome would show a popup asking to translate from Portugese)

* Corrections and performance improvements

* Enable pxmagic by default

---------

Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2023-06-22 11:26:24 +02:00
Clayton Sims
e4ee392c27
Support for ESP-NOW Wireless Remote Control (#3237)
* Initial checkin for ESP-NOW remote feature

* cleanup irrelevant comment

* don't bring in espnow package includes when feature disabled

* Formatting and removing inaccurate call mode hardcoding

* Fork ESP Now code by platform (8266 v. esp32)

* compiled html update

* Disable ESP-NOW remote by default on ESP32 until tested

* Enable ESP-NOW remote for ESP32

* Rename ESP NOW define

---------

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2023-06-22 10:06:19 +02:00
Blaz Kristan
cf48ad06ed New SPI display SSD1309 for 4LD.
Fixed global I2C usage (no pin allocation in usermods).
Enabled option dor Multi relay.
2023-06-21 23:31:15 +02:00
Will Tatam
63df85f7f9 AC lacks i2sMaster param to I2SSource 2023-06-19 13:33:46 +01:00
Will Tatam
b29611509e AC lacks ERRORSR_PRINTLN 2023-06-19 13:33:16 +01:00
Will Tatam
dd1cf0ec56 AC lacks ERRORSR_PRINTF 2023-06-19 13:27:54 +01:00
cschwinne
c04c73bbd7 WS logic: No resending, improved ESP8266 stability
Update ESP8266 core to 3.1.2
2023-06-18 01:07:50 +02:00
Blaz Kristan
4ea5723b7f Enhance pin dropdowns.
- add pins for PCF8574 (POC)
- bugfix for saving
Reduced maximum relays to 8.
Changed MultiRelay config parameter name.
2023-06-16 22:06:26 +02:00
Blaz Kristan
75244853c1 Fix for #3251 2023-06-16 10:24:56 +02:00
Aircoookie
264b3a785b Code style: define constants for settings subpage IDs 2023-06-15 23:58:22 +02:00
Frank
bb15e1d8ac
minor comment update
Small corrections in Lissajous comments
2023-06-15 09:30:44 +02:00
Blaz Kristan
7538649e81 Add optional leading 0 on time and date for Scrolling Text
- replaces #2994
2023-06-14 21:58:32 +02:00
Blaz Kristan
31efbe915e Minor string optimisation. 2023-06-14 20:45:00 +02:00
Frank
9e69627626
2D Lissajous improvements
* allow user to control rotation speed (c3 slider)
* preserve accuracy by performing division _after_ multiplication: " (i * speed) / 32", instead of " i * (speed / 32)"
* proper rounding of "map" results, for better visual appearance
* avoid division by zero in map() function
2023-06-14 20:21:43 +02:00
Aircoookie
dd9da2853a Support settings pin unlock via JSON
Also supports locking by providing any incorrect pin
2023-06-14 11:53:39 +02:00
Blaž Kristan
670461c66f
Merge pull request #3238 from Aircoookie/beta-3
Beta 3
2023-06-13 21:38:10 +02:00
Blaz Kristan
f6092b9128 Build bump & updated changelog 2023-06-13 21:10:11 +02:00
Blaz Kristan
a690cb36ff changelog 2023-06-12 22:29:55 +02:00
Blaz Kristan
5ca8f4a3aa Merge branch 'pin-dropdown' into beta-3 2023-06-12 22:22:47 +02:00
Blaz Kristan
ba6e2f0a54 Pin dropdown updates for LED pins.
Updated pxmagic
2023-06-12 19:21:14 +02:00
Blaz Kristan
149f4e38a0 Merge branch 'main' into dev-2 2023-06-11 09:54:44 +02:00
Blaz Kristan
b5ee170726 Merge branch 'main' into beta-3 2023-06-11 09:53:39 +02:00
Blaž Kristan
04961880fe
Merge pull request #3242 from jkoelker/mitigate_xss
fix(settings): mitigate xss
2023-06-11 09:52:19 +02:00
Blaz Kristan
e22e8ffa0e npm 2023-06-11 09:44:15 +02:00
Jason Kölker
d18d800947
fix(settings): mitigate xss
Mitigate XSS on wifi scanning from injecting arbitrary code by using
`textConent` instead of `innerHTML`.

Partially Fixes #3233
2023-06-10 23:40:02 +00:00
Blaz Kristan
3ca58ee65f Pin dropdowns POC.
NeoPixelBusGammaMethod POC.
PixelMagic POC.
Button reassign POC.
2023-06-10 20:43:27 +02:00
Blaz Kristan
21387b9a83 Bugfix download backup json 2023-06-08 09:41:38 +02:00
Blaz Kristan
ccb0d491ed Port bugfix. 2023-06-08 07:14:03 +02:00
Blaz Kristan
daa3200713 Sync page bugfix 2023-06-08 07:06:23 +02:00
Blaz Kristan
fec2d1f7ee Bugfix
- respect Settings PIN lock in /json/cfg
2023-06-07 21:43:32 +02:00
Blaz Kristan
eb8e95723c Bugfix reverse proxy path detection 2023-06-07 21:37:54 +02:00
Blaž Kristan
999bec19f1
Merge pull request #3232 from david-sawatzke/ws2801_eth_fix
Fix WS2801 output on boards with ethrnet
2023-06-06 21:18:17 +02:00
Blaz Kristan
dfb8de2349 Fix for #3204 2023-06-06 20:56:33 +02:00
David Sawatzke
59f1cdcc82 Fix WS2801 output on boards with ethrnet (similar to #2542)
and the corresponding fix d1fed11d0d
2023-06-06 16:34:22 +02:00
Blaz Kristan
3eb8be6239 Bump version and update changelog 2023-06-04 20:14:10 +02:00
Blaz Kristan
7dfc4a651d Merge branch 'main' into beta-3 2023-06-04 20:11:27 +02:00
Blaz Kristan
189d145393 Merge branch 'main' into beta-3 2023-06-04 18:43:28 +02:00
Blaz Kristan
26bec11d76 Reverse proxy support. 2023-06-04 18:40:29 +02:00
Blaz Kristan
1e7071bff3 Transition bugfix. 2023-06-04 18:36:46 +02:00
Blaz Kristan
92390d1d59 Bugfix in DDP handling. 2023-06-04 17:55:29 +02:00
Blaz Kristan
b9b072119b Add pin mode. 2023-06-03 22:46:17 +02:00
Blaz Kristan
b6d9fd8030 Usermod fixes
- 4LD: prevent corruption on fast Rotary changes
- Rotary: implement ISR for I2C reading
2023-06-03 17:01:29 +02:00
Aircoookie
d383bc93c7 Changelog update
Reduce width of ethernet mode dropdown
2023-06-02 10:51:37 +02:00
Sebastian
af88c68fca
Buttons: Trigger on button press (instead of release) if all configured presets are the same (#3226)
* Buttons: Trigger when pressing if all configured presets are the same

* Add debounce for immediate rising-edge short press

---------

Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
2023-06-02 10:51:16 +02:00
Blaz Kristan
24537c4fdc Debug data for rotary. 2023-06-01 22:19:09 +02:00
Blaz Kristan
130f495fb6 Bugfix multi relay. 2023-06-01 22:17:41 +02:00
Sebastian
9d22a06969
Changes for allowing Alexa to change light color to White when auto-calculating from RGB (#3211)
* Changes for allowing Alexa to change light color to White when auto-calculating from RGB

* Update alexa.cpp

Indention

* Do not rely on global auto white override

(gets white mode from segment light capabilities)

* alexa.cpp: Removed unnecessary whitespaces

---------

Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
2023-05-31 20:12:17 +02:00
dvdavide
e3783e0236
Fix for displaying 1bpp bmp files (usermod EleksTube IPS) (#2988)
* Fix for displaying 1bpp bmp files

* EleksTubeIPS optimizations

* Fixed incorrect paletteSize

* stray tab

---------

Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
2023-05-31 20:11:30 +02:00
Justin Mutter
a5161eb7f1
Use constant for mDNS name to allow setting from my_config.h (#3145) 2023-05-31 17:35:43 +02:00
Blaz Kristan
82e448de7c Beta-3 changes
- remove I2C init  from usermods
- PCF8574 (&co) port expander support
- refactor PIR &  Rotary encoder & 4LD
- reboot race condition
- optimisations
2023-05-30 19:36:14 +02:00
Blaž Kristan
680afe972e
Merge pull request #3220 from Aircoookie/feature
Feature implementation
2023-05-30 16:52:13 +02:00
Blaž Kristan
69ab2ce402
Merge branch 'main' into feature 2023-05-30 16:20:20 +02:00
Blaz Kristan
4374930065 npm build 2023-05-30 16:18:11 +02:00
Blaz Kristan
9f3520cba5 Update comments. 2023-05-30 16:09:51 +02:00
Blaz Kristan
d20cdc099d Merge branch 'main' into feature 2023-05-30 15:55:39 +02:00
Blaž Kristan
926e9ff3de
Merge pull request #3171 from Aircoookie/seg-groups
Add support for segment sets (groups of segments)
2023-05-30 15:53:39 +02:00
Frank
70c277d8a1
bugfix: don't hide sound sim options for "double note" effects
There was is a typo in this line - apparently the "\u" was missing, so the search string was interpreted as octal char instead of unicode.
2023-05-30 13:23:26 +02:00
Blaz Kristan
0a5aac724a Merge branch 'main' into seg-groups 2023-05-29 21:35:52 +02:00
Christian Schwinne
bb91d5495f
Merge branch 'main' into feature 2023-05-29 21:31:40 +02:00
Blaz Kristan
995d94c124 Repeat segment button fix 2023-05-29 21:23:11 +02:00
Aircoookie
ee7036f13d CSS tweaks
Fix repeat segment button remaining hidden
Fix third segment row (offset) alignment in 1D mode
Keep disabled sound simulation modes as comment for reference
New local var for 2D seg UI, improves code legibility
2023-05-29 21:06:10 +02:00
Blaz Kristan
5a8a8dc292 Feature implementation
- #2236
  - #1984
Better PSRAM handling
platformio.ini update
On/Off bus handling
2023-05-28 22:50:19 +02:00
coral
7d84de6690
Fix errors in DDP implementation (#3193)
* fix DDP spec

* Adjust DDP type byte to latest spec

Allow receiving of RGBW DDP with either old or new bits per channel value

---------

Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
2023-05-26 14:58:40 +02:00
dependabot[bot]
3520f9e9c2
Bump requests from 2.28.2 to 2.31.0 (#3213)
Bumps [requests](https://github.com/psf/requests) from 2.28.2 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.28.2...v2.31.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-26 12:32:59 +02:00
Blaz Kristan
b2df7981a9 Add support for PCF8574 I2C port expander
- for Multi Relay usermod.
2023-05-24 23:40:23 +02:00
TroyHacks
9831e7bc3b Warnings about AudioKit rubbish 2023-05-23 23:49:57 +01:00
TroyHacks
90e37439e5 Better ES8388 init and mic support 2023-05-23 23:49:40 +01:00
TroyHacks
65f2490e89 It's offically the LyraT, not Lyra-T. 2023-05-23 23:49:29 +01:00
TroyHacks
c14a921e5a Mic settings for ES8388. Also ALC, pass-thru, etc. 2023-05-23 23:49:14 +01:00
TroyHacks
2bc8ffefce Some fixes for LyraT and also better inits/docs 2023-05-23 23:46:37 +01:00
TroyHacks
b88d8c85cb ES8388 init optimizations and fixes 2023-05-23 23:42:01 +01:00
Ewoud
693f52d984 Merge pull request #5 from netmindz/ES8388
WiP - ES8388
2023-05-23 23:41:46 +01:00
Blaz Kristan
56a3bff42e Multi-packet MQTT fix.
Solves #3205
2023-05-23 18:37:24 +02:00
Blaz Kristan
bffeec1615 Remove PSRAM use from global LED buffer. 2023-05-21 18:37:18 +02:00
Frank
e4a9f115cb fx functions: avoid memory corruption
* PSRAM_Allocator was missing the "reallocate" method, which lead to undefined behaviour when dynamic JSON doc needed to grow/shrink
* Segment::setUpLeds() quickfix for length() == 0 (should not happen, but it did happen for me once)
* leds in PSRAM causes major slowdown on wrover boards - disabled.
2023-05-21 14:33:25 +02:00
Frank
a717238f76 espalexa robustness improvements
* prevent string buffer overflows (stack corruption)
* avoid division by zero (program might crash)
* avoid log(0) which is undefined, too
* use faster math routines for float (logf, powf)
2023-05-21 13:21:38 +02:00
Blaz Kristan
4a567ab97c Merge branch 'main' into seg-groups 2023-05-15 17:06:38 +02:00
Blaz Kristan
90431b662b Rename "group" to "set" 2023-05-15 17:06:29 +02:00
Blaz Kristan
1c8f349a62 Bugfix.
- prevent LED flash on realtime end
2023-05-14 20:30:57 +02:00
Blaz Kristan
217004c70c Bugfix.
- disbled transitions/crossfade prevented segment off
2023-05-14 18:18:09 +02:00
Blaž Kristan
a75608628e
Merge pull request #3199 from Aircoookie/serg-eth
Serg74 ethernet board.
2023-05-13 15:29:13 +02:00
Blaž Kristan
33130f39ee
Merge pull request #3190 from Aircoookie/octopus
Octopus & Waving Cell 2D effects
2023-05-13 15:27:16 +02:00
Blaz Kristan
cae43e97cd Corner fix 2023-05-13 15:17:49 +02:00
Blaz Kristan
cdfc0f6b71 Temperature usermod rewrite 2023-05-11 17:33:09 +02:00
Blaz Kristan
bf6a18a414 Bugfix
- SHT enable/disable crash
2023-05-10 21:09:28 +02:00
Blaz Kristan
16b66afa7a Octopus offset 2023-05-10 21:06:48 +02:00
Frank
9e446210fb
refresh build number 2023-05-09 17:57:17 +02:00
Frank
b0118d2d57 use size_t as file index type (might prevent corruption)
* use size_t instead of uint16_t -> prevents random behaviour (corruption) in case that JSON files get larger than 64Kbytes.
* use a constant for max large file space (was UINT16_MAX)
* reduced the scope of some functions and variables to "static" - avoids name clashes and may support better optimization by the compiler
2023-05-09 17:44:26 +02:00
Frank
bc90309dd6 fix error message in latest platformio
fix for "Error: Invalid environment name 'codm-controller-0.6-rev2'. The name can contain alphanumeric, underscore, and hyphen characters (a-z, 0-9, -, _)"
2023-05-09 17:34:30 +02:00
Frank
52c4093fb0
minor bugfix for usermod_v2_Battery.h
missing semicolon - caused compile errorsin debug mode.
2023-05-08 20:59:57 +02:00
Blaz Kristan
b47c12cbee Serg74 ethernet board. 2023-05-08 08:48:52 +02:00
Blaž Kristan
fb14bc6016
Merge pull request #3116 from Erwin-Repolust/main
Changing voltage calculation to a weighted running average
2023-05-07 10:20:26 +02:00
Blaz Kristan
cd6862b1a7 Merge branch 'main' into octopus 2023-05-06 12:56:35 +02:00
Blaz Kristan
3d9160f2fa Merge branch 'main' into seg-groups 2023-05-05 23:01:17 +02:00
Blaž Kristan
157a5d9902
Merge pull request #3164 from werkstrom/cpal
Custom Palette Editor
2023-05-05 22:44:52 +02:00
Blaz Kristan
f4972e2be2 Code size reduction.
Save in hex notation.
2023-05-05 22:37:47 +02:00
Blaz Kristan
85c8e6ba42 Merge branch 'main' into cpal 2023-05-05 21:35:18 +02:00
Blaž Kristan
8e79bd8785
Merge pull request #3162 from wled-install/main
Add LAN8720 reset and new ethernet board
2023-05-05 21:32:06 +02:00
Frank
1ace7ce254
Merge pull request #3194 from billythekid/patch-1
Update palettes.h (typo in a comment)
2023-05-05 20:08:09 +02:00
Blaz Kristan
a00be5b60c Improved Tartan FX 2023-05-03 21:43:21 +02:00
Billy
aabe8d1d5e
Update palettes.h
just a typo-fix
2023-05-02 21:52:39 +01:00
Blaz Kristan
3da086438b Add rotating to Octopus
Soap optimization
2023-05-02 11:16:24 +02:00
Blaz Kristan
c257c86387 Fix for mirroring 2023-05-01 20:43:03 +02:00
Blaz Kristan
ff3ae14c29 Merge branch 'main' into octopus 2023-05-01 19:23:12 +02:00
Frank
cd82a34392 fixing github CI builds for -S3/-S2/-C3
explicitly adding `toolchain-riscv32-esp @ 8.4.0+2021r2-patch5` seems to do the trick.

Suggested here:
* https://github.com/platformio/platform-espressif32/issues/1081#issuecomment-1518601054
2023-05-01 16:54:30 +02:00
Blaz Kristan
baacd55910 Minor UI fix 2023-05-01 14:17:52 +02:00
Blaž Kristan
511b7c4d92
Merge pull request #3142 from xxv/xxv/dancing-shadows-default-color
Set Dancing Shadows default palette to Party
2023-04-30 18:43:04 +02:00
Blaz Kristan
f38851b7c6 Merge branch 'main' into cpal 2023-04-30 17:52:28 +02:00
Blaz Kristan
432c5837f0 Bugfix
- WiFi power for Lolin S2 & C3 (use -DLOLIN_WIFI_FIX)
- web response buffer size (corruption when websockets not used)
2023-04-30 17:30:36 +02:00
Blaz Kristan
cc599f544a Tweak in Soap. 2023-04-30 13:28:04 +02:00
Blaz Kristan
e886c85134 Tweaks. 2023-04-30 13:25:08 +02:00
Blaz Kristan
05eb716b85 Noise array bugfix.
Fire2012 tweak.
2023-04-30 13:22:42 +02:00
Blaz Kristan
61eb7b0a6a Waving Cell FX 2023-04-29 17:04:16 +02:00
Blaz Kristan
f0dade5856 Uneven matrix fix. 2023-04-29 15:51:25 +02:00
Henrik
8567f6b13c Ability to use static palettes as templates 2023-04-29 13:28:45 +02:00
Blaz Kristan
b740316918 Soap fix 2023-04-29 11:11:03 +02:00
Blaz Kristan
2119d08543 Octopus 2D effect
- by Stepko
2023-04-28 22:00:35 +02:00
wled-install
599ff66522
Add files via upload 2023-04-28 17:15:31 +02:00
wled-install
6d2eb04ada
Add files via upload 2023-04-28 17:13:50 +02:00
Blaz Kristan
0aea75edb7 NeoPixelBus 2.7.5
UI bugfix
2023-04-28 16:52:48 +02:00
Mattstir
2ca8231ab4
Improve indent (#3118)
* Improve indent

Improve indent, so its more allignend and correctly indented according to logic groups

* Spaces to tabs

---------

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2023-04-28 01:40:51 +02:00
Blaž Kristan
e00116551c
Add Ucs890x support and swaps NeoPixelBrightnessBus with NeoPixelBusLg (#3091)
* Add UCS890x support.

* Fixes

* Update NeoPixelBus to 2.7.3 for UCS8904 support.
Update ESP8266 core to 4.1.0

* ESP8266 compile fixes.
- use PlatformIO framework and toolchain
- add compiler warning suppression
- remove IRAM_ATTR to fit in IRAM

* Replace NeoPixelBrightnessBus with NeoPixelBusLg
Resolves #3087

* Update to NPB 2.7.4

* Internal NPB color conversions.

* Fix errors due to merge with SPI Hz methods

Regenerate settings page HTML

---------

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2023-04-28 01:28:57 +02:00
cschwinne
4d55e05b07 Fix CI properly
Small 2D Soap FX optimizations
2023-04-28 00:51:34 +02:00
Blaž Kristan
9ff3f85432
Allow SPI clock speed selection. (#3173)
* Allow SPI clock speed selection.

* Bump NPB to 2.7.4
2023-04-28 00:27:19 +02:00
Blaz Kristan
65c584aeda 2D enhancement (internal)
- move() wrapping
- dual addPixelColorXY()
2023-04-27 17:31:55 +02:00
Blaž Kristan
2540a2dfd9
Soap, new 2D effect (#3184)
* Soap, new 2D effect

* Fix Soap FX on matrices with edges < 8 LEDs

* Add palette support to Soap FX

---------

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2023-04-27 01:22:33 +02:00
Blaz Kristan
70e9187bcb Merge branch 'main' into seg-groups 2023-04-26 19:50:22 +02:00
Blaz Kristan
5e2fa13471 Bugfix.
- allow saving of reboot preset
- return Spread slider
2023-04-26 19:47:12 +02:00
Blaž Kristan
4f8610f895
Merge pull request #3134 from strikeout/DMX_MODE_PRESET_FIX
Fixes DMX_MODE_PRESET preset and brightness selection via DMX controller
2023-04-26 19:30:14 +02:00
Blaz Kristan
95f9e97af8 typeOf bugfix 2023-04-26 14:45:39 +02:00
Marcos Castro
695b073080
Apply correct iOS scroll to all tabcontent (#3182) 2023-04-26 10:53:49 +02:00
Stefan Riese
3a28935bfe
Wordclock - Issue with "Norddeutsch" (#3161)
* - fix word clock for "viertel vor" and "viertel nach"
- adjust wording of parameters

* - revert changes for parameter names

* enclose JSON property strings in F() macro to reduce RAM usage.

* add parameter info for "norddeutsch" and "LedOffset"
2023-04-26 10:53:18 +02:00
Christian Schwinne
468ed1a9ce
Restore Github actions CI build (#3187)
* Update dependencies

* Do not fail fast

* Disable ESP32 variant CI builds
2023-04-26 10:52:54 +02:00
Blaz Kristan
a6052d7900 Update info text. 2023-04-25 14:27:33 +02:00
Blaz Kristan
e42836b07f Allow hex strings for palette 2023-04-25 13:02:09 +02:00
Henrik
16373919d4 Removed as requested 2023-04-23 21:36:19 +02:00
Henrik
92f9c908f6 Custom palettes now editable 2023-04-23 21:32:52 +02:00
Henrik
480e1e17c8 Error on missing css file 2023-04-23 11:40:07 +02:00
Blaz Kristan
274f5f2f1f Bugfix. 2023-04-22 16:06:13 +02:00
Blaz Kristan
02d4f9cbba Merge branch 'main' into seg-groups 2023-04-20 17:21:20 +02:00
Blaz Kristan
d10daf0991 Bugfix
- skip regular button handling while waiting for analog read
2023-04-17 16:25:05 +02:00
Blaz Kristan
8c9656b799 Cleanup. Return after upload. 2023-04-14 18:33:03 +02:00
Blaz Kristan
396ea3d0ee Add webserver cpal support 2023-04-14 17:21:07 +02:00
Blaz Kristan
3efee4a855 Merge branch 'main' into cpal 2023-04-14 17:16:20 +02:00
Blaz Kristan
ece6759fa7 UI update. 2023-04-14 17:15:02 +02:00
Frank
246d945f39 another "inner var shadows outer var"
Seems this is not causing bugs, however its still bad style to re-define existing vars in an inner loop. Solved to improve code readability.
2023-04-14 14:13:45 +02:00
Frank
4a3bc486d0 two more "shadowed locals"
In these case, there seem to be no bug, but  simply renaming the "inner" variables improves code readability.
2023-04-14 13:09:25 +02:00
Frank
996d041581 bugfix for art-net transmit
art-net transmit was not sending out LEDs, but only transmitted headers repeatedly (thanks @troyhacks for noticing).

Actually such problems can be found by newer compilers, so i've added the warning option to [esp32_idf_V4].

wled00/udp.cpp: In function 'uint8_t realtimeBroadcast(uint8_t, IPAddress, uint16_t, uint8_t*, uint8_t, bool)':
wled00/udp.cpp:824:40: warning: declaration of 'byte buffer [12]' shadows a parameter [-Wshadow=compatible-local]
         byte buffer[ART_NET_HEADER_SIZE];
                                        ^
wled00/udp.cpp:720:85: note: shadowed declaration is here
 uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8_t *buffer, uint8_t bri, bool isRGBW)  {
2023-04-14 11:39:12 +02:00
Frank
d48e4adcd4 CI build fix
seems that NPB 2.7.4 introduces new incompatibilities that break our gh build action.
2023-04-13 12:16:32 +02:00
Blaz Kristan
7f84b7ab83 Merge branch 'main' into seg-groups 2023-04-12 15:37:56 +02:00
Blaz Kristan
3e26bd6a17 Quick compile fix.
- ESP32 DMA HSPI method in NeoPixelBus requires IDF 4.4.1
2023-04-12 15:35:27 +02:00
Henrik
e964c62907 Fixes 2023-04-12 09:15:38 +02:00
Blaz Kristan
fbb4965263 Merge branch 'main' into seg-groups 2023-04-11 21:40:29 +02:00
Blaz Kristan
88139d95a7 Build bump. 2023-04-11 21:35:44 +02:00
Blaz Kristan
5875b1988b Change log update 2023-04-11 21:34:43 +02:00
Blaž Kristan
2a2091595b
Merge pull request #3153 from Aircoookie/ipad-pcmode
iPad/tablet with 1024 pixel UI PC mode.
2023-04-11 21:11:19 +02:00
Blaz Kristan
d77883dd7a Merge branch 'main' into ipad-pcmode 2023-04-11 21:03:09 +02:00
Blaz Kristan
adea7dadec Bugfix.
- top buttons not working on mobile
2023-04-09 23:58:24 +02:00
Blaz Kristan
cf4ce2dc08 Revert float none. 2023-04-09 23:55:53 +02:00
Henrik
e74dfb2ba6 Small adjustments to UI mainly 2023-04-09 16:49:41 +02:00
Henrik
aaea9ff018 Added info on usage of IDs 2023-04-09 14:18:22 +02:00
Blaz Kristan
206b88eba2 Bugfix.
- top buttons not working on mobile
2023-04-09 11:06:42 +02:00
Henrik
8f5373f034 Custom Palette Creator 2023-04-08 20:02:49 +02:00
Blaz Kristan
dfa0a16487 Reduce sound sim options to increase 2D mapping. 2023-04-04 17:16:50 +02:00
Blaz Kristan
8b9f6f49ef Minor CSS tweaks 2023-04-04 15:53:03 +02:00
Blaz Kristan
bcac978810 Merge branch 'main' into seg-groups 2023-04-02 18:17:47 +02:00
Blaž Kristan
d17a41f7f1
Merge pull request #3155 from werkstrom/patch-1
Adjustments to Pixel Art Converter
2023-04-02 18:13:22 +02:00
Blaz Kristan
503f71f004 Npm run build 2023-04-02 18:07:48 +02:00
Blaz Kristan
4543288ea7 Merge branch 'ipad-pcmode' into seg-groups 2023-04-02 18:05:59 +02:00
Henrik
9307105b3f Redone in Patch-1 2023-04-02 13:52:20 +02:00
Henrik
567daf9946
Merge branch 'Aircoookie:main' into patch-1 2023-04-02 13:35:31 +02:00
Blaz Kristan
558b22c36a POC: Implemented segment groups (4).
Sacrificed 1 bit on sound simulation and 1D to 2D mapping each.
2023-04-01 23:40:43 +02:00
Blaz Kristan
f076dddfe3 Filter updates. 2023-04-01 11:02:49 +02:00
Frank
af44730418 platformio.ini minor cleanups
- fixed a few typos, trailing spaces and bad alignments
- added the previous 8266 platform packages as a comment, just in case
- [env:esp32dev_V4_qio80] is actually "dio" --> renamed to [env:esp32dev_V4_dio80]
- all esp32dev targets use the same ${esp32.platform} now (3.2.0 would not compile any more)
2023-03-31 15:44:21 +02:00
Blaz Kristan
4ec1140cb4 Optimizations & bugfix. 2023-03-31 13:26:03 +02:00
Blaz Kristan
2a5d20058f iPad/tablet with 1024 pixel UI PC mode.
Optimizations.
2023-03-30 21:35:23 +02:00
Frank
51f38e0a76
Merge pull request #3144 from Aircoookie/esp8266-core
ESP8266 core 4.1.0, ESP32 core 5.2.0 (S2,S3,C3)
2023-03-30 00:24:43 +02:00
Frank
54eb42d658 build env for -C3 with only 2MB flash
based on proposal from  in PR #2951 by @andyshinn.
2MB does not allow to have an OTA partition, so this feature is disabled.
2023-03-30 00:20:01 +02:00
Frank
a7a6f4cec6 small re-organization of build flags
* -Wno-attributes added to common flags
* USB_MSC and USB_DFU flags moved to common board sections (does not make sense with WLED to ernable these)
2023-03-30 00:03:04 +02:00
Christian Schwinne
3968a8e0dc
Attempt fixing GitHub actions ESP8266 build (#3151)
(explicit toolchain version)
2023-03-28 23:19:00 +02:00
Blaz Kristan
9e8ff27a7f Change log update 2023-03-27 15:49:02 +02:00
Blaz Kristan
7dd3d2b040 Merge branch 'main' into esp8266-core 2023-03-26 10:20:09 +02:00
Blaz Kristan
13678cb8d5 Add adjustable Random Cycle time.
- solves #3147
2023-03-25 21:28:30 +01:00
Frank
890aa6f9ac experimental esp32 buildenv with platform = espressif32@5.2.0
experimental ESP32 buildenv using ESP-IDF V4.4.x / arduino-esp32 v2.0.5
Warning: this build environment is not stable!!
2023-03-22 00:46:27 +01:00
Frank
646cf44b83 moved register override into 8266 section,
so it cannot destroy builds for ESP32 devices
2023-03-22 00:06:25 +01:00
Frank
bf789ca97b minor cleanup 2023-03-21 23:36:50 +01:00
Frank
9b90ff10f4 buildenv improvements for -S3/-S2/-C3
- corrected some broken references
- added `platform_package =` --> use default packages
- renamed env:esp32c3 to env:esp32c3dev to avoid confusion
- added lolin_s2_mini to CI builds
2023-03-21 23:15:08 +01:00
Blaz Kristan
0cc719a823 Remove "register" override 2023-03-21 20:01:16 +01:00
Blaz Kristan
4cd026dfe9 ESP8266 core 4.1.0, ESP32 core 5.2.0 (S2,S3,C3)
NeoPixelBus 2.7.3 (adding UCS890x support)
2023-03-21 17:28:04 +01:00
Aiden
3120b49dba
Add some Athom devices (#3114)
Add some compile configurations for Athom's devices
2023-03-20 23:44:12 +01:00
Christian Schwinne
fb1999c474
Merge pull request #3107 from Aircoookie/onepx-segment
Tweaks & bugfixes.
2023-03-20 23:42:30 +01:00
Steve Pomeroy
2c37961f7b Set Dancing Shadows default palette to Party 2023-03-19 17:37:29 -04:00
Frank
1abc863f82
comment updated
Also "Serial JSON" is not possible when reading from RX pin is disabled.
2023-03-19 15:51:39 +01:00
Frank
c9be03c0bc
typo 2023-03-19 14:48:47 +01:00
Frank
fd89209233 adding WLED_DISABLE_ADALIGHT (issue #3128
This flag disables reading commands from serial interface (RX = gpio 3)

Add -D WLED_DISABLE_ADALIGHT to your custom pio build environment.
2023-03-19 14:42:01 +01:00
Blaz Kristan
2e362fbb64 Fix for #3074 2023-03-19 14:26:54 +01:00
Blaz Kristan
11b687cdc2 Float vs. double. 2023-03-19 11:24:59 +01:00
Blaz Kristan
747c920420 Bugfix.
- white overrides & CCT
2023-03-19 11:23:59 +01:00
Blaž Kristan
cac51737cb
Merge pull request #3138 from codekane/mpu6050_imu 2023-03-19 07:38:44 +01:00
Ryan Horricks
7789379914 Fix typing to resolve build errors after installing the mpu6050_imu usermod. 2023-03-18 18:29:19 -06:00
Blaz Kristan
08e2bfe9a2 Scale 2D peek for large matrices. 2023-03-18 18:22:31 +01:00
strikeout
56a854ec88 limit max. selectable preset ID to 250, according to WLED capabilities 2023-03-17 13:40:21 +01:00
strikeout
de4ff4e58d Fixes preset and brightness selection via DMX controller to DoS WLED, now same packets are discarded 2023-03-16 17:56:29 +01:00
Frank
991c2afedb adding wled00.ino.cpp to gitignore
to avoid future accidents in GH Desktop
2023-03-16 13:10:33 +01:00
Frank
cded92662f workaround for issue #3128 2023-03-16 13:08:34 +01:00
Erwin Repolust
2c3fa0fd8f added function for voltage reads 2023-03-16 01:33:57 +01:00
Erwin Repolust
ec08432f92 added voltage multiplier to gui and set defaults 2023-03-14 01:44:41 +01:00
Blaz Kristan
1bab4d6937 Merge branch 'main' into onepx-segment 2023-03-12 13:14:22 +01:00
Blaz Kristan
d1fed11d0d Fix for #2542.
UI rebuild.
2023-03-12 13:10:40 +01:00
Blaž Kristan
e96053e268
Merge pull request #3121 from troyhacks/2023-03-10-Art-Net_Transmit
Art-Net transmit support for network LEDs
2023-03-11 22:50:07 +01:00
Blaž Kristan
9b98cbb894
PROGMEM for header 2023-03-11 22:35:22 +01:00
Blaž Kristan
349578fb6e
whitespace cleanup 2023-03-11 22:33:06 +01:00
Blaz Kristan
7c186e4fcc Fix for smaller number of pixeld than matrix size. 2023-03-11 15:03:28 +01:00
TroyHacks
a4fcbb9f67 Art-Net transmit support for network LEDs
Like DDP, this allows WLED to address network systems using the Art-Net protocol.

Universe starts at zero, because that's the first universe in Art-Net.

Works with RGB. It's coded to also work with RGBW, but I couldn't find a great place to enable it without mucking with things I don't understand.
2023-03-10 13:29:00 -05:00
Blaz Kristan
763b64cc57 Combat low memory condition on ESP8266. 2023-03-10 15:20:50 +01:00
Blaž Kristan
d57e6c5bf2
Merge pull request #3106 from lost-hope/klipper
Usermod: Klipper percentage
2023-03-10 14:14:31 +01:00
Blaz Kristan
80711cc00a Whitespace. 2023-03-10 14:08:52 +01:00
Erwin Repolust
8b61b9ebfe Added code for esp8266 2023-03-10 01:28:04 +01:00
Erwin Repolust
e00e778bce Less operations and better readable 2023-03-08 03:54:48 +01:00
Erwin Repolust
81e70925c4 Changed to running average to improve accuracy 2023-03-08 03:24:16 +01:00
Blaz Kristan
ddd32bd600 Multiple fixes.
- compiler warning fixes (gcc17)
- revert min heap size to 8k
- fix form submitting in 2D settings
- remove IRAM_ATTR for ESP8266 core 4.1.0
2023-03-05 22:56:14 +01:00
Frank
2713573b9b
Delete wled00.ino.cpp
accident
2023-03-05 22:38:36 +01:00
Frank
cf2e8bbc0b update build nr
and npm run build
2023-03-05 22:35:59 +01:00
Frank
bc56c1a0e1 bugfixes
* xml.cpp: correct type for checkbox global led buffer" (was not shown correctly)
* fx.cpp: 2D floating blobs - correct swapped x/y coordinates (did not render correctly on non-square matrix)
2023-03-05 22:30:08 +01:00
Blaz Kristan
bfbf7af411 Revert palette conditional load.
Playlist load bugfix.
2023-03-03 19:57:09 +01:00
Blaz Kristan
c151221d12 UI fixes & revert forcing ULTRAWHITE for on/off bus
Reduce min heap for 8266
2023-03-02 18:21:55 +01:00
Blaz Kristan
b8489724ef Slider BG fix. 2023-02-28 23:04:12 +01:00
Blaz Kristan
7a2f556682 Bugfix for 1 pixel segment capabilities. 2023-02-28 19:08:41 +01:00
Blaz Kristan
92d883db87 Bugfix for 1D setup.
- incorrcet max segment length calc
2023-02-28 15:25:11 +01:00
lost-hope
cb931d7af0 Merge branch 'main' of https://github.com/Aircoookie/WLED into klipper 2023-02-27 21:21:45 +01:00
Soeren Willrodt
6b54b57cb9
fixing the PR conflict 2023-02-27 21:01:32 +01:00
Blaz Kristan
1ca4348ca0 Add Segment functions hasRGB() and hasWhite()
Makes code cleaner.
2023-02-25 17:58:51 +01:00
Blaz Kristan
3ca7006e3a Tweaks & bugfixes.
One pixel segment handling.
- added 0D FX metadata (1 pixel effects)
- ignore palettes for White only segment
- ignore color for non-RGB & non-White segment (on/off)

Bugfix
- proper auto segment creation
- hide palettes for non RGB segments
- some tweaks for #2984
- force Solid for some FX (causing crash) on 1 pixel segment

UI Optimisations
- slider tooltips
- tiny bit smaller tooltips
- hide segment power if only one segment
- gap between sliders
2023-02-25 09:41:15 +01:00
lost-hope
339d2a7bf3 Added spreading from center and fixed the enable 2023-02-23 19:47:27 +01:00
mx
0d3debf9b9
sACN/E1.31 Port Priority (#3052)
* Added E1.31 port priority handling #768

* Ignore E1.31 data when priority doesn't match #768

* Enable E1.31 priority handling for WLED_ENABLE_DMX

* Only handle e131Priority for P_E131 protocol

* Corrected comments

* Highest priority package first handling

* Removed obsolete code & comments

* Improved comments

* Reduce priority timeout to be uint8_t

* Optimized code & comments

* E1.31: Ignore non-zero start code and preview data
These are not level data, they have other purposes

* Style change cca41508 preview & ignore non-zero start code

---------

Co-authored-by: RichardTea <31507749+RichardTea@users.noreply.github.com>
2023-02-21 17:13:15 +01:00
underritoSR
7f74a4f4b5
removing DLS for CST_TimeZone_GMT-6 (#3082)
* removing DLS for CST_TimeZone_GMT-6

* Adjust Mexico timezone name

---------

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2023-02-21 17:09:04 +01:00
Christian Schwinne
220718cb58
Remove Blynk support (#3102)
Change default palette for Railway to Colors 1 and 2
2023-02-21 17:07:32 +01:00
dependabot[bot]
be2acbd3eb
Bump cacheable-request and nodemon (#3089)
Removes [cacheable-request](https://github.com/jaredwray/cacheable-request). It's no longer used after updating ancestor dependency [nodemon](https://github.com/remy/nodemon). These dependencies need to be updated together.


Removes `cacheable-request`

Updates `nodemon` from 2.0.4 to 2.0.20
- [Release notes](https://github.com/remy/nodemon/releases)
- [Commits](https://github.com/remy/nodemon/compare/v2.0.4...v2.0.20)

---
updated-dependencies:
- dependency-name: cacheable-request
  dependency-type: indirect
- dependency-name: nodemon
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 16:48:00 +01:00
Christian Schwinne
9249c74b7b
Merge pull request #3088 from Aircoookie/led-gaps
LED matrix gaps
2023-02-21 16:46:58 +01:00
lost-hope
2b87817ba2 enabled IP Change and updated the Readme 2023-02-19 09:08:40 +01:00
Blaz Kristan
883c0f9dfe Bugfix
- gamma value not showing
2023-02-17 20:36:35 +01:00
Blaz Kristan
3ffc58d442 Bugfix
- segment capabilities on 2D segments and ledmaps
- UI segment update
- auto segment creation 2D + 1D
2023-02-15 20:36:54 +01:00
Blaz Kristan
1bb4b0156f Bugfix 2023-02-14 20:25:26 +01:00
Blaz Kristan
92d2be3f5e Add ledmap names
Bugfix
- reset segments upon 2D ledmap allocation error
- fix invlid 2D segments
2023-02-14 17:11:58 +01:00
Blaž Kristan
a7cded21f7 Merge branch 'main' into led-gaps 2023-02-14 14:28:10 +01:00
Christian Schwinne
74156b7ed8
Support white addressable LED strips (#3073)
* Support white addressable LED strips

* Various white handling tweaks

Allow RGB controls for white-only busses depending on AWM (makes palette-only FX work on non-RGB addressable busses)
Fixed RGB controls hidden if segment contained any non-RGB bus (even though there is also an RGB bus in that segment)
New Max auto white mode
Added hasCCT() bus method
Rename methods to be clearer
WS2811 White getPixelColor fix()

* Fix merge conflict (bus manager cpp)
2023-02-14 01:33:06 +01:00
Blaz Kristan
821f320347 Add user selectable Gamma
Add panel visualisation (@ewoudwijma, #3090)

Bugfix:
- PIR onStateChange() ignored until inited
- remove matrix orientation
- ignore removing ledmap 0 if 2D
- _globalLeds size
2023-02-12 13:18:30 +01:00
Blaz Kristan
eee9274098 Bugfix.
- compiler warnings
- loading nonexistent default ledmap in 2D will revert to built ledmap
- making autosements after 2D set up change
2023-02-11 18:41:30 +01:00
Blaz Kristan
8dd1f89225 Update.
- allow ledmap selection in UI
- upload gap file
- expand matrix generator
2023-02-10 19:49:43 +01:00
Blaž Kristan
f2459ea904 Add ability to use SHT temp. sensor in PWM fan 2023-02-10 09:33:27 +01:00
Blaz Kristan
e51f7bfbff LED matrix gaps. 2023-02-09 20:15:55 +01:00
Ulrich Baumann
e2215ced34
allow alternative northern style ("viertel vor ..." instead of (#3085)
"dreiviertel ..")

Co-authored-by: Uli Baumann <github@uli-baumann.de>
2023-02-09 00:23:53 +01:00
Blaz Kristan
b14c8e82a0 Bugfix.
- correct WLED_DEBUG_PORT override
2023-02-08 10:25:59 +01:00
Blaz Kristan
e7d50d2614 Bugfix.
- respect net debug on/off state
2023-02-08 10:18:41 +01:00
Blaž Kristan
bca92883d2
Merge pull request #3081 from Aircoookie/usermod-enhance
Usermod enhancements
2023-02-06 07:25:24 +01:00
dependabot[bot]
ed865e38de
Bump http-cache-semantics from 4.1.0 to 4.1.1 (#3076)
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-05 23:52:48 +01:00
Blaž Kristan
dec45109d3
Refactor busmgr (#3079)
* Refactor bus manager.

* Fix for net debug

* Fix 8266 compile

* Move bus static members to proper cpp

---------

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2023-02-05 23:48:43 +01:00
Blaz Kristan
48c267c5c1 Bugfix. 2023-02-05 17:57:22 +01:00
Blaz Kristan
c041d39cab Usermod enhancements
- added onStateChange() callback
- added examples & comments to usermod_v2_example.h
- PIR sensor cancels countdown on state change
2023-02-05 12:23:05 +01:00
Blaz Kristan
52c18e77ae Compile fix for net_debug 2023-02-04 23:59:28 +01:00
Blaz Kristan
52a189cdd2 Playlist bugfix.
- another attempt at #3058
2023-02-04 10:56:07 +01:00
Blaž Kristan
dca8a47da8
Dual mode 2D + 1D with auto segment creation. (#3060)
* Dual mode 2D + 1D with auto segment creation.

* Bugfix.
- stop when seglen
2023-02-01 19:30:56 +01:00
Christian Schwinne
6be9317fd7
Merge pull request #3037 from Aircoookie/indentation
Whitespace/indentation cleanup.
2023-02-01 16:07:30 +01:00
Christian Schwinne
bee99ca8d0
Merge branch 'main' into indentation 2023-02-01 15:57:58 +01:00
cschwinne
48dc89cf13 Fix merge conflict (apply changes from 901ce23) 2023-02-01 15:55:44 +01:00
Blaž Kristan
fc7f609234 Disable 1D/2D mapping for individual pixel control 2023-01-31 12:49:36 +01:00
Blaz Kristan
0bed9b3c2e FX tweak.
- Fireworks 1D
2023-01-30 23:10:45 +01:00
Blaz Kristan
31fa73518b Bugfix. #3064 2023-01-30 17:11:14 +01:00
Blaz Kristan
c6fd11157a Bugfix.
- incorrect palette blending in Palette effect (#3055)
2023-01-29 11:58:47 +01:00
Blaz Kristan
ca73a57de7 Bugfix.
- reduce playlist repetition count on save #3058
2023-01-29 11:27:14 +01:00
Henrik
38a545af92 Fix regen on out format change 2023-01-26 16:11:54 +01:00
Blaž Kristan
b91b340afd Update changelog. 2023-01-25 13:18:54 +01:00
Blaz Kristan
8e7b1c97df Merge branch 'fx-upd' 2023-01-24 21:13:12 +01:00
Blaz Kristan
c9c55fe0c9 Bump version to 0.14.0-b2 2023-01-24 21:08:26 +01:00
Blaz Kristan
d553160d65 Update to changelog 2023-01-24 20:41:10 +01:00
Blaž Kristan
b8a4df2f50
Merge pull request #3042 from werkstrom/patch-1
WLED PixelArtCreator
2023-01-24 18:56:05 +01:00
Blaz Kristan
36edbf6ea9 Merge branch 'main' into patch-1 2023-01-24 18:49:49 +01:00
Blaz Kristan
f966535ea9 Fix resize input on segment load. 2023-01-24 17:15:38 +01:00
Blaz Kristan
07cc26a144 Merge branch 'main' into fx-upd 2023-01-24 16:39:49 +01:00
Blaz Kristan
178c4d15b7 Bugfix.
- missing Transpose (seglen)
- reduce flickering for static text (ScrollingText FX #3050)
2023-01-24 16:35:31 +01:00
Henrik
b0b68c695c Size optimizations and cleanup 2023-01-23 21:30:55 +01:00
Blaž Kristan
219a3658d6 Code compression. 2023-01-23 11:41:41 +01:00
Henrik
d2310fc2ea Revert changes 2023-01-22 21:12:03 +01:00
Henrik
3fe0ccd934 Added ability 2 output minified htm file 4 testing 2023-01-22 20:28:23 +01:00
Henrik
f902ebadcc UI, simpler process, get more data from device 2023-01-22 18:47:34 +01:00
Blaz Kristan
57323af167 Reset segments on 2D set-up change. #3028
Bugfix for 2D segment creation.
2023-01-22 11:29:31 +01:00
Blaz Kristan
20b0b5fc8e Boost tweaking. 2023-01-21 22:38:04 +01:00
Henrik
bb72b8cc93 Segment selection and touch ups 2023-01-21 16:33:59 +01:00
Blaz Kristan
fec5516da9 Fire 2012 boost. 2023-01-21 15:39:59 +01:00
Henrik
ec9a092751 - Removed unused code
- Changed rendering of large preview image
2023-01-21 12:10:22 +01:00
Blaz Kristan
c692cc6a70 Inline fixes. 2023-01-20 22:33:30 +01:00
Blaz Kristan
2b8d8d4e9c Merge branch 'main' into pixart 2023-01-20 16:23:51 +01:00
Blaz Kristan
2ae8032ace Compile fix. 2023-01-20 16:22:19 +01:00
Blaz Kristan
c4416584de Merge branch 'patch-1' into pixart 2023-01-20 15:53:56 +01:00
Blaž Kristan
86d8b49113 Pixelart
- full implementation
2023-01-20 14:40:45 +01:00
Blaz Kristan
7a5d870f67 DJ Light optimisation.
GoL mutations.
cleanup.
2023-01-19 22:22:24 +01:00
Henrik
b43459232a
Create file for PixelArtCreator 2023-01-19 22:09:47 +01:00
Frank
e2b4e60c9e pulser bugfix and minor optimizations
* pulser bugfix: " % cols" was missing so the effect would simply run out of visible range
* float math: use optimized functions: sqrtf, fabsf
* two more comments where code could be optimized, but I'm not sure what is thecorrect solution
2023-01-19 12:26:14 +01:00
Blaz Kristan
17543535e3 FX update
- Dynamic & Dynamic Smooth
- Dissolve & Dissolve Rnd
- Juggles
- Game of Life
- Colorful
- Fireworks & Rain
2023-01-18 22:56:49 +01:00
Blaz Kristan
901ce23cd2 Bugfix.
- incorrect ro_pins in settings
2023-01-18 22:23:34 +01:00
Blaz Kristan
1b52d8065e Ecternal MOSFET for parasite DS18B20 2023-01-18 17:36:04 +01:00
Blaz Kristan
c6db901051 Added gradient to drawCharacter()
Ability to select gradient text on Scrolling Text FX.
2023-01-17 19:54:44 +01:00
Blaž Kristan
39edb1ad37
Merge pull request #2891 from mxklb/pr_fxsegs
Refactored DMX effect mode + new segment controls
2023-01-16 22:38:02 +01:00
Blaz Kristan
a397aa188c Whitespace/indentation cleanup. 2023-01-16 22:12:02 +01:00
Blaz Kristan
dd08751f3f Hide 2D if not compiled. 2023-01-16 22:09:43 +01:00
Blaz Kristan
ef6a9184ba A few more flash bytes saved. 2023-01-16 21:55:12 +01:00
Blaž Kristan
575fb6fc60
Merge pull request #3022 from Aircoookie/disable-more
Disable MQTT more.
2023-01-16 21:44:00 +01:00
Blaz Kristan
4147d6c67e FX: GameOfLife
- better glider detection
- correct behaviour during transition
- optimisations
2023-01-16 18:53:52 +01:00
mxklb
115c17ab90 Corrected wrong comments 2023-01-16 17:30:55 +01:00
mx
d892c7290c
Merge branch 'Aircoookie:main' into pr_fxsegs 2023-01-16 17:28:44 +01:00
Blaz Kristan
63d8a902d5 Loading defaults on "fxdef". 2023-01-15 15:21:39 +01:00
Blaz Kristan
43152fcf19 Bugfix.
- d.max_gpio in usermod settings.
2023-01-15 15:19:48 +01:00
Blaz Kristan
1f135f1fa5 "i" start index bugfix #3024 2023-01-14 16:01:46 +01:00
Blaz Kristan
c71d378eab New FX Distortion Waves
Updated FX Lissajous
2023-01-12 21:58:54 +01:00
Blaz Kristan
6fa5689aaf Bugfix.
- segment off
2023-01-12 20:36:50 +01:00
Blaz Kristan
d78bef72ea Disable MQTT more.
Disable Alexa more.
2023-01-12 20:35:34 +01:00
Blaz Kristan
e410de9552 Bugfix.
- fadePixelColorXY()
- clearing 2D segment on mirror or reverse change
- FX update (DNA Spiral, Colored bursts)
2023-01-12 19:13:07 +01:00
Blaz Kristan
8dc262b415 Bugfixes.
- faster random palette blends
- remove UI ledmap selection for 2D
- FX updates (DNA Spiral, Colored bursts, Metaballs)
2023-01-11 23:08:08 +01:00
Abhi Gulati
7fa494815f
Fix a typo (#3014) 2023-01-11 11:21:45 +01:00
Blaž Kristan
929bb70e5a
Merge pull request #3012 from spdustin/fix-tooltip-pointer-events
Fixes tooltip interfering with pointer events
2023-01-10 06:11:53 +01:00
Dustin Miller
36fb262fa0 Fixes tooltip interfering with pointer events 2023-01-09 18:38:00 -06:00
Frank
b8cc783583 pio: minor update for -C3
adding optional platform version that seems to help in some special cases.
2023-01-09 13:20:02 +01:00
Blaž Kristan
67b3d383e4 Minor fix for (obsolete) Solid Glitter 2023-01-09 13:17:08 +01:00
Frank
9144ccac6b
Merge pull request #3006 from Aircoookie/fx-update
FX updates, 2nd try.
2023-01-08 23:44:42 +01:00
Blaz Kristan
04020d5ae2 Universal glitter. 2023-01-08 21:58:55 +01:00
Blaž Kristan
de4f1d09af
Merge pull request #3005 from Aircoookie/whitespace 2023-01-07 08:13:17 +01:00
Blaz Kristan
27d7f5f190 Fixes.
Prevent flickering if segment off.
2023-01-06 18:11:52 +01:00
Blaz Kristan
c43c4c42c8 Renamed No Bg to Overlay 2023-01-06 17:23:24 +01:00
Blaž Kristan
613283f656 typo fix 2023-01-06 09:44:26 +01:00
Blaž Kristan
506b6b51ce whitespace cleanup 2023-01-06 09:24:29 +01:00
Blaž Kristan
c7eccfb714 FX updates:
- Ripple (2D & no Bg)
- Glitter (no Bg)
- Sparkle (no Bg)
- Scan (no Bg)
- Two dots (no Bg)
- ICU (no Bg)
- Lightning (no Bg)
- Halloween eyes (no Bg)
- Spots (no Bg)
- Bouncing Balls (no BG)
- Popcorn (no Bg)
- Starburst (no Bg)
- Drip (no Bg)
- Whitespace cleanup
- draw_circle()

"no Bg" will allow overlapping segments if checked.
2023-01-06 09:10:39 +01:00
Blaz Kristan
98be19b29f Fix switching off for PIR usermod. 2023-01-05 22:46:30 +01:00
dekay
66406d86c1
Update comment for 44-key remote (#2999)
Defs for this remote appear to be complete and are not "to be done later".
2023-01-05 16:49:53 +01:00
Frank
35832b07b9 UM Battery: basic support for LiPo cells
* Lipo cells (1S) should not be discharged below 3V
* LiPo cells have a different voltage/discharge rate curve
2023-01-04 19:57:33 +01:00
Frank
357683cbb9 UM Battery: more bugfixing, and improvements for esp32
- improved support for esp32 (read calibrated voltage)
- corrected config saving (measurement pin, and battery min/max were lost)
2023-01-04 17:30:08 +01:00
Frank
15bc6159f9 UM Battery: fix for deprecated function call
wled00/../usermods/Battery/usermod_v2_Battery.h:446:48: warning: 'void PinManagerClass::deallocatePin(byte)' is deprecated: Replaced by two-parameter deallocatePin(gpio, ownerTag)
2023-01-04 12:54:02 +01:00
Frank
7cdafa76a5 UM Battery - improvements for esp32
* added missing pinMode(.., INPUT) on esp32
* do not try reading from pin = -1 (ESP32-S2 shows very allergic reactions to this)
* Info page - show "n/a" when pin = -1
* readme: esp32 default pin = 35
2023-01-04 12:32:31 +01:00
cschwinne
e84b0c91f8 Update year 2023-01-03 17:36:24 +01:00
cschwinne
cecffee3d3 Merge branch 'main' of https://github.com/Aircoookie/WLED 2023-01-03 17:16:14 +01:00
cschwinne
d039a40d7c Invert pull up config value, fixes #2996
Cronixie usermod format change fix
2023-01-03 17:15:55 +01:00
Blaz Kristan
90463d8613 Battery UM fix for MQTT voltage topic. 2023-01-03 17:14:24 +01:00
Blaz Kristan
90c965a6ba Bugfix editing 2D set-up. 2023-01-03 17:12:35 +01:00
Frank
e961691645
Battery, second try 2023-01-03 15:36:35 +01:00
Frank
6270d2408f
UM Battery: fix build error on linux
Fixes build error on linux:
wled00/usermods_list.cpp:15:54: fatal error: ../usermods/battery/usermod_v2_battery.h: No such file or directory
compilation terminated.
2023-01-03 15:29:15 +01:00
Frank
7ef1842237 comments updated
see discussion in faf616cbea
2023-01-03 15:16:45 +01:00
Frank
faf616cbea fixing a potential stack corruption
.. overlooked this one when reviewing the PR.
@blazoncek, @ctjet : three questions on the new code remain, because its not clear to me if its correct. Please check.
2023-01-03 14:17:42 +01:00
Frank
4a09e18d9a
UM Battery: fix compilation error + bad snprintf 2023-01-02 22:52:37 +01:00
Blaz Kristan
983aca515d Compile fix for disabled 2D. 2023-01-02 21:24:02 +01:00
Frank
eb184d3c68 build number, npm run build 2023-01-02 21:01:39 +01:00
Caleb Marting
187ecf511f
2d Mapping with Matrix Gaps (#2892)
* New 2d mapping
* panel matrix generator
* add todos, fix vert/horz swap
* Fix 2d mapping to matrix in settings 2D
* add correct index mapping to pixels per panel
* fix panel bug in led layout
* formatting and change max panels
* add per panel width and height
* fix using length instead of custom mapping size
* fix: panel dimensions location

* panel[] implemented as a vector.
Removed matrixWidth & matrixHeight.
Panel structure update.
* Fixes.

Co-authored-by: Blaz Kristan <blaz@kristan-sp.si>
2023-01-02 20:56:00 +01:00
lost-hope
0ab35a3ca3 added klipper usermod 2023-01-01 15:13:57 +01:00
Blaž Kristan
8e208bc76d
Merge pull request #2993 from spdustin/fix-analog-clock-hours
fixes typo in Analog_Clock.h
2023-01-01 00:35:14 +01:00
Dustin Miller
1b4d92007e
updates strings to use F() 2022-12-31 15:24:35 -06:00
Dustin Miller
4101d7664d
fixes typo in Analog_Clock.h
Retrieving the config in `readFromConfig()` results in defaults being set to both `hourMarksEnabled` (`false`) and `hourMarkColor` (`#0000FF`) due to differences in capitalization compared to how they're saved in `addToConfig()`
2022-12-31 13:47:48 -06:00
Blaz Kristan
e128c3094a Typo fix. 2022-12-31 18:58:52 +01:00
Blaz Kristan
95869eeb70 Allow more virtual buses. 2022-12-31 17:06:18 +01:00
Blaž Kristan
d977bbd61c
Merge pull request #2990 from relax81/main
added #DDMM & #HHMM to scrolling text
2022-12-31 14:10:51 +01:00
Leif
a16a6211e2 added #MMDD view to the scrolling text effect 2022-12-31 03:30:26 +01:00
Leif
a75013e43e Merge remote-tracking branch 'upstream/main' into main 2022-12-31 03:25:21 +01:00
Mark Breen
1e157e95b6
minor spelling fix (#2991) 2022-12-30 12:29:02 +01:00
Leif
04dbfcd0e6 added #DDMM & #HHMM to scrolling text 2022-12-30 00:04:22 +01:00
Maximilian Mewes
73440e2287
Update Usermod Battery (#2975)
* auto-off feature and usermod rename
* low-power-indicator, voltage fine tuning, clean-up

* corrected small mistakes
* Bugfixes, added usermod logo, update readme
* minor changes, implemented change requests, optimizationz
2022-12-28 22:40:13 +01:00
Blaž Kristan
ee4459691f
Merge pull request #2982 from itCarl/task-fixing-comments-in-pin_manager-header
Fix Hex values in comments in pin_manager.h
2022-12-28 22:36:55 +01:00
Maximilian Mewes
379c6045b9
Merge branch 'Aircoookie:main' into task-fixing-comments-in-pin_manager-header 2022-12-28 01:53:12 +01:00
Maximilian Mewes
00d0ddb4b5 fixed pinowner comments (hex is not correct and the order is wrong) 2022-12-28 01:50:04 +01:00
Blaz Kristan
be08c01be6 Fix for #2979 2022-12-28 01:01:31 +01:00
Blaž Kristan
fb6abe34df
Merge pull request #2966 from Aircoookie/hex-palette
Hex custom palettes and smooth random palette change
2022-12-28 00:53:01 +01:00
Blaz Kristan
b0d107f916 Merge branch 'main' into hex-palette 2022-12-26 10:26:01 +01:00
Blaz Kristan
6d1ff7c3f3 Railway FX
- slower minimum speed
- allow color 1 & 2 in UI
2022-12-26 10:25:26 +01:00
Blaz Kristan
6f67132f4b PROGMEM string optimisation. 2022-12-26 10:20:45 +01:00
Blaž Kristan
859d21162c
Merge pull request #2963 from ezcGman/um-sht
SHT Usermod: Fixed MQTT discovery using correct unit; Added getters and isEnabled() check
2022-12-25 22:49:24 +01:00
Blaz Kristan
c739a7ea2f Erroneous ) 2022-12-25 11:05:25 +01:00
Blaz Kristan
7e48875fd4 Minor optimisation. 2022-12-25 11:02:50 +01:00
Blaz Kristan
474e86306f Bugfix: incorrect maxWidth after switching from 2D 2022-12-24 22:00:35 +01:00
Blaz Kristan
b436a660f1 Merge branch 'main' into hex-palette 2022-12-23 21:35:52 +01:00
Blaz Kristan
d36460e30b Minor optimisation.
Fix for #2969
2022-12-23 16:37:13 +01:00
cschwinne
0e236f9d88 0.14.0-b1 2022-12-23 04:38:30 +01:00
cschwinne
72eb61951b Dynamically show hidden color slots for * palettes
Disable Blynk by default in release builds
Single quote strings everywhere for classList
2022-12-23 02:59:24 +01:00
Blaz Kristan
22b2503839 Bugfix & code optimisation. 2022-12-22 18:13:32 +01:00
Frank
d7b5719dfd add mandatory build flags for -S2 and -C3 (virtual USB)
I was wondering why sometimes the new MCUs still work better in Arduino IDE, so compared our build flags to what is used in Arduino IDE:

-S2 always has -DARDUINO_USB_MODE=0
-C3 always has -DARDUINO_USB_MODE=1
-S3 supports all possible modes
2022-12-21 22:07:15 +01:00
Blaz Kristan
4322d195d3 Smooth random palette changes
Bugfix loading string palettes
JS optimization.
2022-12-21 21:00:28 +01:00
ezcGman
4ecad65926 UM SHT: Codestyle 2022-12-21 00:34:22 +01:00
ezcGman
f12025b86e UM SHT: Added getters and isEnabled check 2022-12-21 00:05:26 +01:00
ezcGman
5cfea54b06 UM SHT: Apply PR feedback 2022-12-20 23:58:11 +01:00
mxklb
c24b75953a Merge branch 'main' into pr_fxsegs 2022-12-20 01:06:46 +01:00
ezcGman
f3d52f4932 UM SHT: MQTT re-publish values on unit change 2022-12-19 22:30:11 +01:00
ezcGman
ea6d339b9c UM SHT: Fixed MQTT discovery using correct unit 2022-12-19 22:15:39 +01:00
Blaž Kristan
284a9999b3
Merge pull request #2960 from mrbubble62/main
Fixed typo when WLED_ENABLE_FS_EDITOR disabled
2022-12-19 14:07:19 +01:00
Blaž Kristan
b241872a00
Merge pull request #2942 from ezcGman/um-sht
New Usermod: SHT temperature & humidity sensors
2022-12-19 07:11:10 +01:00
ezcGman
b7034d3213 UM SHT: Check for IOs gt zero 2022-12-18 21:33:25 +01:00
Blaz Kristan
0a0ced3e8e Hex string custom palette option 2022-12-18 21:02:19 +01:00
Blaž Kristan
e7449b4d56
Merge pull request #2959 from Aircoookie/selall-bugfix
maximum segments reached and Select all bugfix
2022-12-18 19:24:14 +01:00
mrbubble62
fab34c9e49
Merge branch 'Aircoookie:main' into main 2022-12-18 12:38:45 -05:00
mrbubble62
7df08c2120 Fixed typo when WLED_ENABLE_FS_EDITOR disabled 2022-12-18 12:37:05 -05:00
Frank
b94e0ef797
Merge pull request #2955 from ezcGman/i2c-build-flags
Add build flags for global i2c & SPI pins
2022-12-18 12:33:33 +01:00
Blaz Kristan
00fed4f995 Carifications and implicit HW_PIN... definition 2022-12-18 11:33:13 +01:00
Blaz Kristan
e8a7802e94 Loxone bugfix. 2022-12-18 11:07:32 +01:00
Blaz Kristan
bfbc1ebb13 Fix all segments checkbox 2022-12-16 23:20:49 +01:00
Blaz Kristan
a802bb2736 Merge branch 'main' into selall-bugfix 2022-12-16 22:32:15 +01:00
Blaz Kristan
3c5838cafd Remove "strip" dependency in Segment class 2022-12-16 22:31:07 +01:00
ezcGman
9217e8336d Merge branch 'um-sht' of github.com:ezcGman/WLED into um-sht 2022-12-16 02:22:44 +01:00
ezcGman
13cfc2d7bc UM SHT: Improved pin de/allocation 2022-12-16 02:22:13 +01:00
ezcGman
171cebed1c Add build flags for global i2c & SPI pins 2022-12-15 15:50:44 +01:00
Andy Hofmann
1dcef87e1c
UM SHT: Fixed typo in readme 2022-12-15 11:27:35 +01:00
ezcGman
23fb602a33 Merge branch 'main' of https://github.com/Aircoookie/WLED into um-sht 2022-12-15 01:38:54 +01:00
ezcGman
a8a549e8fc UM SHT: Lots of documentation added 2022-12-15 01:38:41 +01:00
ezcGman
44790e99ea UM SHT: use snprintf_P instead of sprintf_P 2022-12-15 00:52:21 +01:00
ezcGman
a3f6717c59 UM SHT: Avoid inline methods 2022-12-15 00:42:27 +01:00
ezcGman
9587480e29 UM SHT: Updated ReadMe 2022-12-15 00:41:08 +01:00
mxklb
c51dbae8b6 Removed bad code comments 2022-12-14 22:55:42 +01:00
Blaž Kristan
8619e8fc0b
Merge pull request #2947 from eibanez/main
Update wizlights user mod so it compiles
2022-12-14 06:30:16 +01:00
Eduardo Ibanez
10dace6de6
Merge pull request #1 from Aircoookie/main
Pull upstream changes
2022-12-13 16:02:47 -06:00
Blaz Kristan
f6e843b5e2 No simple UI detection. 2022-12-13 22:25:12 +01:00
Blaz Kristan
a7bad5df61 Bugfix. #2945 2022-12-13 14:40:41 +01:00
Christian Schwinne
f50c9e855c
Use "pd" JSON API call for direct preset apply (#2946) 2022-12-13 14:27:44 +01:00
Eduardo Ibanez
3653666ffe Update wizlights user mod so it compiles 2022-12-12 22:04:25 -06:00
ezcGman
2123e43490 UM SHT: Added Fahrenheit support 2022-12-12 02:33:31 +01:00
ezcGman
19146d8012 UM SHT: Made type a setting instead of buildflag 2022-12-12 02:05:02 +01:00
ezcGman
987dd36401 UM SHT: Using F() helper on some strings 2022-12-11 22:32:03 +01:00
Blaz Kristan
6bb158786b Fix for switching WLED off when in nighttime only mode. 2022-12-11 20:10:24 +01:00
Bill Thomson
f66d091717
Update README.md (#2943)
This change corrects of one of my earlier edits. (removes an extra word in the sentence)
2022-12-11 18:03:35 +01:00
Blaz Kristan
0a3d911602 UM settings page update.
- capitalize every word in parameters
- replace - and _ to space for legibility

Swapped includes in FX.cpp
2022-12-11 10:43:16 +01:00
ezcGman
e8edb99bb0 UM SHT: Added SHT usermod 2022-12-11 01:16:14 +01:00
Frank
917cd96a3d don't complain about button pin = -1 2022-12-10 21:03:58 +01:00
Frank
20ad6d239d minor cleanup
removing a misleading comment
2022-12-10 19:23:00 +01:00
Frank
eea3968bfb delete accidentially created wled.ino.cpp
github desktop sucks
2022-12-10 19:19:02 +01:00
Frank
7ac8f6dd19 improvements for new MCU support (-S3/-S2/-C3)
- switch off debug messages to USBCDC, if WLED_DEBUG is not set
- ensure that analogread pins are valid - invalid pins cause lots of error messages and finally lead to watchdog reset on some MCUs.
2022-12-10 19:16:02 +01:00
Frank
cafa78c3f3 fixing CI build. really now.
-check IDF target after including arduino.h
-add missing build flags in [env:esp32s2_saola]
2022-12-10 19:00:48 +01:00
Frank
e808f7655c fix CI build
make sure SparkFunDMX driver is not compiled on -S2 and -C3
2022-12-10 18:20:00 +01:00
Frank
4f28bf7ab4 missing word in comment 2022-12-10 18:00:48 +01:00
Frank
9380b2b4e8 SparkFunDMX: fix for issue #2928
* make SparlFunDMX driver more robust:
- made variables static (so they don't overlap with other global variables)
- made sure all valriables are properly initialized
- do not apply pinMode and digitalRead to invalid pins (as this creates problems on -S3, -C3 and -S2)
* disable DMX sending code (unneeded code that may case troubles)
2022-12-10 17:55:14 +01:00
srg74
8caeddde15
Spelling check by @wthomson (#2940)
A lot of spelling corrections. Now repo will sound like educated person :)

Co-authored-by: Bill Thomson <bt@kattt.org>
2022-12-10 16:12:55 +01:00
Blaz Kristan
b637398a9c Optimisations. 2022-12-09 18:37:53 +01:00
dependabot[bot]
2e5b19575f
Bump qs from 6.5.2 to 6.5.3 (#2939)
Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-09 15:30:35 +01:00
dependabot[bot]
102a69996a
Bump certifi from 2022.6.15 to 2022.12.7 (#2938)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.6.15 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2022.06.15...2022.12.07)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-09 15:29:34 +01:00
Blaž Kristan
37af48f3fb Bugfix.
- missing selall with maximum segments reached
2022-12-09 08:15:14 +01:00
mxklb
f38747aa28 Fixed bug: Last segment in universe skipped 2022-12-09 02:11:16 +01:00
Frank
88d05578a8
platformio.ini: do not redefine "register" as it break ASM code and affects methods called "register" as well
unfortunately this breaks build for -C3 and -S3

/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32c3/include/riscv/include/riscv/semihosting.h:75:19: warning: ignoring asm-specifier for non-static local variable 'a0'
     register long a0 asm ("a0") = id;
                   ^~
.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32c3/include/riscv/include/riscv/semihosting.h:76:19: warning: ignoring asm-specifier for non-static local variable 'a1'
     register long a1 asm ("a1") = (long) data;
2022-12-08 22:00:44 +01:00
Blaž Kristan
b24c8b3410
BobLight protocol (#2917)
* BobLight ambilight protocol implementation for WLED

* Added usermod ID

* Add realtime locking
Add port config
Bugfixes

* Minor optimisation.

* Fix WiFiServer start.

* Bugfix

* Working boblight.

* npm run

* Add readme

* Undo PIR sensor modification.
Undo npm run build.

* Fix parentheses.

* Comments.
Cancel realtime when disabled.
2022-12-08 19:41:50 +01:00
Blaz Kristan
2c8dbb94fc Tetix & FX option bugfix.
- mono color with palette option
2022-12-08 17:17:54 +01:00
Frank
3da2ec5112 upps
forgot to remove this.
2022-12-08 13:20:50 +01:00
Frank
c3545ef060 build env update for -S3 without serial-to-USB chip
small -S3 like Adafruit "QT Py ESP32-C3" seems to need USBCDC.
2022-12-08 12:47:34 +01:00
Frank
4308a7cf79
bug.yml: adding new MCUs do boards dropdown. 2022-12-06 18:05:32 +01:00
Blaz Kristan
e629c90a71 Missing UDP sync notifications bugfix. 2022-12-05 22:56:44 +01:00
Frank
e7f07f5bfc pinmanager robustness improvement
make sure that array bounds are not violated in pinManager class.
2022-12-05 17:04:54 +01:00
Frank
da7972c119 use latest NeoPixelBus for -S3
NeoPixelBus 2.7.1 is the first release that has official support for ESP32-S3
2022-12-05 16:20:58 +01:00
cschwinne
efc476e50b Disable register keyword to reduce compiler warnings
Minor formatting improvements
"ps" string optimization
Removed travis envs
2022-12-03 20:55:17 +01:00
Frank
33f4e8cf73 pinmanager bugfix for -S2/-S3
pinmanager ran out out array bounds on -S2 and -S3, as these MCUs have more than 40 GPIO. As consequence, memory was overwriten, and pins > 39 were reported as "allocated" but not "owned".

Thisfixes the problem, by extending internal arrays so that up to 50 pins can be managed.
2022-12-02 20:08:11 +01:00
Blaz Kristan
643f300792 Playlist creation bugfix (preset 0 selected). 2022-11-30 19:34:32 +01:00
Ardi Loot
bd601ad2da
PWM outputs usermod (#2912)
* first commit of PWM outputs

* fix pin deallocation issue

* refactoring

* removed debug prints

* fix compile error

* added readme

* added compile error for ESP8266

* added overloaded SetDuty method

* convert state to separate nested object

* Revert "added overloaded SetDuty method"

This reverts commit e8ea32f577.

* move constant strings to flash

* reworked json info and config

* bugfixes

* more bugfixes

* updated readme

* use C strings instead of String

* added uint8 and uint16 overloads for SetDuty

* removed ambiguous overload
2022-11-30 09:15:07 +01:00
Blaž Kristan
9f1a7a1c20 Swap info. 2022-11-29 15:02:56 +01:00
mx
bd721c1310
Merge branch 'Aircoookie:main' into pr_fxsegs 2022-11-29 00:54:15 +01:00
Frank
98138a02e3
audioreactive usermod update (align with MoonMod code) (#2907)
* audioreactive driver update

- Better handling of PDM and I2S Line-in
- Bugfixes for ES7243 (allocateMultiplePins)
- More error messages for ES7243
- sample scaling (needed for sources that use full scale of samples)

* audiorective update

* align SR_DEBUG with WLED_DEBUG
* optional bandpass filter (needed for PDM mics)
* sample scaling for PDM and Line-In
* small improvements for analog input
* bugfixes and small performance improvements
* code for FFT task refactored, for better readablity. Introduces separate functions for filtering and post-processing
* small improvement for beat detection
* default mic settings can be configured at compile time
* correct mic type if MCU does not support PDM or ADC
* hide analog PIN config if not supported by MCU

* audioreactive updates

- minor updates to source code (see discussion in PR #2907)
- usermod readme improvements

* small readme update

* one think I overlooked

* ok, another edit. Now its final. Hopefully.

* small upps

wrong parameter order in debug message.
2022-11-28 20:52:33 +01:00
Blaz Kristan
f7004e7a7c Allow disable internal pull-up resistors.
Fixes #2896 and #2899
2022-11-26 23:56:55 +01:00
Christian Schwinne
1db25d4b20
FX data optimization (#2908)
* Do not require commas between ! in fxdata

* Updating fxdata: Halfway through the FX list

* fxdata flags and optimizations

* Revert optional commas after !
2022-11-26 21:31:45 +01:00
mxklb
507e198b70 Minor cleanups 2022-11-26 17:22:03 +01:00
mx
5c721ee435
Merge branch 'Aircoookie:main' into pr_fxsegs 2022-11-26 17:15:55 +01:00
Frank
9a44f0c869 small update for env:esp32s3dev_8MB_PSRAM
- corrected board
- added link to workaround
2022-11-26 15:13:54 +01:00
mxklb
8c5f9b4501 Added missing DMX effect options and 3rd color 2022-11-26 14:41:59 +01:00
cschwinne
713bf66a12 Increase QL buffer to allow unicode characters
Fixes #2906
2022-11-26 03:57:17 +01:00
Ewoud
78e9f5bd1a
Clean up UserMod settings: grouping of variables and add preInfo to variables (#2894)
* Grouping um settings, add pre and post Info, update  SR & 4LD settings

Settings_um.htm: 
- modify addField (grouping)
- addInfo (pre and post texts)

Add preInfo to audio reactive and 4ld usermod

Extra:
platformio: wemos_shield: add audio reactive usermod and update to alt display

* um settings: cpp: lowercase, js: initcap

* um settings: txt only pre, txt2 only post and initCap as function

* Fix rotary encoder info string

Co-authored-by: Blaž Kristan <blaz@kristan-sp.si>
2022-11-26 03:44:04 +01:00
Frank
f03abf2600 workaround for broken env esp32s3dev_8MB_PSRAM
- Error: Unknown board ID 'esp32-tinys3'
temporarily use `` until a working solution is found.
2022-11-26 01:33:46 +01:00
JPZV
d5eee5b56c
Fixes platformio.ini for the ESP32 S3 (#2905)
* Update missing package for ESP32-S3
There was a missing package version for env:esp32s3dev_8MB. platformio/framework-arduinoespressif32@3.20004.220825 doesn't exist any more

* Fixes Compiling error for ESP32 S3 with octal (qspi_opi) memory mode
For details: platformio/platform-espressif32#912 and platformio/platform-espressif32#914

* Added env:esp32s3dev_8MB_PSRAM to platformio.ini
Also, reverted back to espressif32@5.1.1 for env:esp32s3dev_8MB

* small maintainer edit
Co-authored-by: Frank <91616163+softhack007@users.noreply.github.com>
2022-11-25 23:49:49 +01:00
Blaz Kristan
8899684092 Select custom palette bugfix. 2022-11-25 17:33:29 +01:00
Blaz Kristan
8e30e4925c BME280 fixes and optimisations
- MQTT not required
- minor string optimisations
- added enable option
2022-11-25 16:45:21 +01:00
Blaz Kristan
906c7a8ea1 Merge branch 'main' of https://github.com/aircoookie/WLED 2022-11-24 17:43:16 +01:00
cschwinne
324fc149b3 Shorter JSON keys for 1d2d map and sound sim
(smaller fxdata, saves 100b flash, slightly shorter json doc)
2022-11-24 04:15:24 +01:00
Jason Kölker
29b1f2afae
feat(json): add wifi scanning (#2895)
* feat(json): add wifi scanning

Adds wifi scanning to the JSON api at `/json/networks`. The initial
request will trigger a scan, subsequent requests will scan or return the
results depending on the state of the `WiFiScan`.

Add a `Scan` button next to the client ssid input, on click, scan for
networks, and change the input to a select with the found ssids.

Fixes: #1964

* Added option to go back to manual SSID input

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2022-11-24 02:50:24 +01:00
mxklb
87fa14b281 Use up-to-date fashion for segment dmx control 2022-11-23 23:19:53 +01:00
Blaz Kristan
b6db86da50 Allow matrix bigger than LED count (missing panels) 2022-11-23 16:54:32 +01:00
mxklb
043947fdcb Added missing brightness to preset DMX mode 2022-11-23 00:38:42 +01:00
Blaz Kristan
713509527a Bugfix for missing ledmap. 2022-11-22 22:17:30 +01:00
mx
ae7eedf523
Merge branch 'Aircoookie:main' into pr_fxsegs 2022-11-20 23:48:06 +01:00
Blaz Kristan
0a1bd748d7 Fix loading transitionDelay on boot 2022-11-20 19:40:54 +01:00
Blaz Kristan
1b351b7743 Broadcast presence on WiFi (re)connect immediately 2022-11-20 18:12:01 +01:00
Jason Kölker
e409bd298a
feat(wifi): add compile time configurtation (#2889)
* feat(wifi): add compile time configurtation

Add `WLED_AP_SSID` and `WLED_AP_PASS` defines to allow configuring the
SoftAP SSID and Password at compile time. Default to existing values.

Add `WLED_AP_SSID_UNIQUE` flag to append the device portion of the mac
address to `WLED_AP_SSID`.

Exampleof all flags (note the quoting to preserve
"stringification"):

```
build_flags =
    -D WLED_AP_SSID='"MyAP"'
    -D WLED_AP_PASS='"MyPassword"'
    -D WLED_AP_SSID_UNIQUE
```

* Removed two error defines

Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2022-11-20 15:55:38 +01:00
Blaz Kristan
caef289b9b Autosave enable/disable UI button 2022-11-20 15:50:42 +01:00
mxklb
84628bd9fc Refactored DMX effect mode + new segement controls (#2325) 2022-11-19 14:10:40 +01:00
Blaz Kristan
43582b6319 Add segment bounds check. 2022-11-19 11:57:38 +01:00
cschwinne
c14c4425a4 Fix minor UI issues
Logo margin in info page
copy to clipboard button text on two lines
noslide on preset API textfield
Preset margins
2022-11-19 01:59:58 +01:00
Blaz Kristan
c47d6cffa8 Missing presets.json on factory reset bugfix.
Clarification on loading ledmaps in UI.
Added manual ledmap loading.
2022-11-16 20:55:21 +01:00
Constantin Wolf
f104fb0586
SD card support: MMC or configurable SPI (#2877)
Co-authored-by: constantin wolf <constantin.wolf@pwc.com>
2022-11-14 02:30:35 +01:00
degraafm76
75e410e4b4
Analog clock time offset bugfix + optional hour mark feature (#2860)
* Implement optional hour marks
Time offset did not work

* removed undefined error int in hexstringtocolor

* revert cosmetic changes

* minor cosmetic changes

Co-authored-by: mdegraaf <mdegraaf@proxsys.nl>
2022-11-14 02:30:18 +01:00
Ewoud
740316ae2b
Effect ID's back to 0.13 numbering (#2856)
* Effect ID's back to 0.13 numbering

Needed for sync between versions and allow 0.13 presets to work in 0.14

* Effect ID's back to 0.13 numbering (part2)
2022-11-14 02:29:59 +01:00
Blaz Kristan
b141ec7ea7 Fix for #2880 (stateChanged on segment on/off)
Added comments.
Added X1, X2, X3, M1, M2, M3 segment options to HTTP API.
Added "on" handling with "ps".
2022-11-13 12:13:49 +01:00
Frank
50875d5759
Sync Interfaces settings: hide sections for disabled features (#2865)
* Add network debug printer

* hide settings for disabled features

If not enabled at compile time, this change hides "Sync interfaces" settings for Alexa, MQTT, Blynk, HueSync.
The html sections are just hidden by a <div> with style display:none.

* Update Animated Staircas for 0.14

* Faster strip updates.

* Add ESP32 variant display in update page.

* Net debug optimizations

Fix ESP8266 (unaligned progmem flash string reads)
Do not send an extra package for \n in println
Only resolve IP/hostname once

* Compile time option for PIR sensor off timer

* Fix Gitpod compiling (#2875)

* Install Platformio not in Gitpod Image

* Install platformio at runtime

remove outdated extensions

* Bugfix for color transitioning.
Return palette option for Candle.
Fix for "* Color..." palette hiding.
Comment out debug output.

* Optimization & bugfix for net debug.
- Inherited from Print class.
- Added UI option to disable net  debug output.

* Reduce fxdata size by about 200 bytes

Removed redundant commas before semicolon delimiter (`,;` -> `;`)
No need to transmit `@` in /json/fxdata

* NetworkDebugPrinter packet optimization.

* Revert NetworkDebugPrinter changes.

* Remove flush() in bus manager.

* Optimizations.

Co-authored-by: Shaheen Gandhi <shaheen@fb.com>
Co-authored-by: Blaz Kristan <blaz@kristan-sp.si>
Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
2022-11-11 20:20:11 +01:00
Blaz Kristan
61b5e5ad7e Remove flush() in bus manager. 2022-11-11 18:42:00 +01:00
Blaz Kristan
6403d18d15 Revert NetworkDebugPrinter changes. 2022-11-11 18:17:12 +01:00
Blaž Kristan
77f04d913a NetworkDebugPrinter packet optimization. 2022-11-11 14:39:47 +01:00
cschwinne
c0a783198e Reduce fxdata size by about 200 bytes
Removed redundant commas before semicolon delimiter (`,;` -> `;`)
No need to transmit `@` in /json/fxdata
2022-11-11 03:10:41 +01:00
Blaz Kristan
d370f67f60 Optimization & bugfix for net debug.
- Inherited from Print class.
- Added UI option to disable net  debug output.
2022-11-10 21:50:21 +01:00
Blaz Kristan
5f4199183c Bugfix for color transitioning.
Return palette option for Candle.
Fix for "* Color..." palette hiding.
Comment out debug output.
2022-11-09 20:09:01 +01:00
Jason2866
d097f8bf1e
Fix Gitpod compiling (#2875)
* Install Platformio not in Gitpod Image

* Install platformio at runtime

remove outdated extensions
2022-11-09 17:59:31 +01:00
Blaz Kristan
1e104bdd9e Compile time option for PIR sensor off timer 2022-11-07 16:56:41 +01:00
Christian Schwinne
8143be29d9
Merge pull request #2870 from Aircoookie/net_debug
UDP Network debugging
2022-11-06 22:50:35 +01:00
cschwinne
1d8c9ac020 Net debug optimizations
Fix ESP8266 (unaligned progmem flash string reads)
Do not send an extra package for \n in println
Only resolve IP/hostname once
2022-11-06 16:50:12 +01:00
Blaz Kristan
7fcc8be73c Merge branch 'netdebug' of https://github.com/visigoth/WLED into net_debug 2022-11-06 10:58:19 +01:00
Blaz Kristan
e5f9cfd5b6 Add ESP32 variant display in update page. 2022-11-05 18:31:38 +01:00
Blaž Kristan
edd487c1f4
Merge pull request #2863 from Aircoookie/staircase-fix
Staircase fix
2022-11-04 22:45:04 +01:00
Blaž Kristan
71d84fecba Bugfix.
Use default nightLightDelay if ND present.
2022-11-04 08:33:55 +01:00
Blaž Kristan
d30e219d7b Faster strip updates. 2022-11-04 08:27:35 +01:00
Benjamin G
0cfda55b3a
Automatically set PC Mode if unset (#2861)
* Automatically set PC Mode if unset

based on the UserAgent

* slight reduction

Reduce flash usage a bit.

Co-authored-by: Blaž Kristan <blaz@kristan-sp.si>
2022-11-03 23:01:32 +01:00
Blaz Kristan
17d1ca82a6 Update Animated Staircas for 0.14 2022-11-03 21:04:40 +01:00
Blaž Kristan
81d2a67948 Minor adjustment in UDP segment options sync.
Added support for node type for S2, S3 and C3.
2022-11-02 14:56:50 +01:00
Blaz Kristan
3bae3aa9aa UDP Sync fix
- sync new sliders
- sync 2D options
2022-10-31 07:13:12 +01:00
Blaž Kristan
7211e6b929
Merge pull request #2853 from Aircoookie/PIR-HA-discovery
Add HA discovery option to PIR sermod
2022-10-26 07:16:25 +02:00
siggel
82af52a0bc
Feature/nine additional alexa devices for presets (#2787)
* add 9 further alexa devices for calling presets 1-9

* use preset names from WLED for Alexa preset device names instead of hardcoded names

* update readme and version

* call alexaInit() at end of savePreset() to keep Alexa in sync with the preset IDs and names

* This reverts commit f8db06c7c5.

* change order to configured Alexa WLED name first, preset names afterwards

* fix status of devices when shown within Alexa, i.e. switching one preset on switches others off (except for alexaInvocationName)

* re-add getPresetName() after merge with master

* restore original readme for pull request

* restore original platformio.ini for pull request

* Logic simplification

* Pass string by reference

* Added number of presets check

* fix alexaInit() in case of alexaNumPresets==0

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-10-25 23:42:26 +02:00
Blaz Kristan
e88d34ea19 Correct HA discovery topic & minor adjutments.
Publish on MQTT connect.
2022-10-25 21:47:25 +02:00
Christian Schwinne
e1d7d9511f
Save config.json with default values on initial boot (#2854)
* Save config.json with default values on first boot

* Init Ethernet on first boot
2022-10-25 17:11:31 +02:00
cschwinne
22d7d2c1f6 Fix FAQ link 2022-10-25 11:53:24 +02:00
cschwinne
2b10a0c513 No blank issues 2022-10-25 11:49:00 +02:00
cschwinne
6e59cfc66c Updated issue templates 2022-10-25 11:47:34 +02:00
cschwinne
51d8344515 Fixed ESP8266 async preset loading
Improved name label visibility on gray images
2022-10-25 03:27:16 +02:00
Blaz Kristan
535f285287 Add HA discovery option to PIR sermod 2022-10-24 21:25:23 +02:00
Blaž Kristan
779fd78091
Merge pull request #2850 from ahadcove/fix/restoring_cfg_json
fix: restoring cfg.json #2847
2022-10-24 21:08:50 +02:00
Blaž Kristan
69a111ee35
Merge pull request #2851 from albarlow/BH1750-Enabled-Bugfix
Fix Enabled Toggle on BH1750
2022-10-24 19:45:10 +02:00
Alex Barlow
7288e5a8fd Fix Enabled Toggle
Adjusted inherited 'disabled' to fix saving bug.
2022-10-24 18:17:37 +01:00
Christian Schwinne
ac57da8713
No F() and numeric comparison 2022-10-24 19:12:27 +02:00
Blaž Kristan
2000d02768
Strings in flash 2022-10-24 18:49:02 +02:00
Christian Schwinne
5ba1ebd525
equals for /presets.json instead of indexof 2022-10-24 18:44:11 +02:00
ahadcove
92329a8dd0 chore: condense the if statement 2022-10-24 11:34:56 -04:00
ahadcove
21de073784 fix: restoring cfg.json #2847 2022-10-24 11:13:33 -04:00
Dominik Nussbaumer
3d502a41c5
add static_cast<uint8_t> in order to fix warnings (#2843) 2022-10-23 15:57:42 +02:00
Christian Schwinne
8570f9256d
Fix funding.yml 2022-10-23 11:38:52 +02:00
bwente
fe09c417ff
Create v2 usermod_word_clock_matrix.h (#2473)
* Create usermod_word_clock_matrix.h

Tried using the old usermod on the new build, found out a lot has changed since then. My best attempt to update it. Still needs some help, but it is working. I would like to preconfigure some of the default settings. I am also having an issue with  Error 12: Preset Not Found

* Update readme.md
2022-10-22 11:21:46 +02:00
Blaz Kristan
ca891b0e70 Merge branch 'audioreactive-prototype' of https://github.com/blazoncek/WLED into audio-fix 2022-10-22 11:13:02 +02:00
Blaz Kristan
af3ee35c50 Merge branch 'dev' into audioreactive-prototype 2022-10-21 23:47:31 +02:00
Frank
ba0bc31525 UDP sound sync: added decoder for legacy packets
support decoding of sound sync data from SR version > 0.13.0
2022-10-21 12:12:02 +02:00
cschwinne
3905cad68d Ethernet profile for QuinLed-Dig-Octa Brainboard-32-8L and LilyGO-T-ETH-POE
Un-F() a string that already exists in RAM
2022-10-21 03:56:00 +02:00
albarlow
30a029c19f
BH1750 upgrades (#2725)
* BH1750 upgrades

Moved the definitions into the main usermods_list.cpp instead of having a section to copy across.

Added Home Assistant Discovery topic for light sensor.  This is toggleable from the usermod menu.

* Configure pin, other enhancements, readme

Implemented pin manager
Made pins configurable at runtime
Improved info screen outputs
Added F() around strings
Updated readme

* Resolve conflict

* Merge branch 'main'

* Missing comma

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2022-10-21 03:32:44 +02:00
Dimitry
7cac609c06
Add ADS1115 usermod (#2752)
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-10-21 03:25:36 +02:00
c3n
e1365f185c
Add define to set data pins to HIGH when relay is off (#2478)
* Add ESP32_DATA_IDLE_HIGH to enable data pin to go HIGH when relay is off

* forgot to remove Serial.print for ESP32_DATA_IDLE_HIGH

* forgot another ifdef preventing compilation on non-esp32 boards

* Extra checks that the bus is actually an RMT bus

Could still blow on new ESP32 variants, but now in a mergable state.

Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2022-10-21 03:16:31 +02:00
Sebastian Schmailzl
c2ac215d43
Usermod: Ping Pong Clock (#2746)
* Starting on Ping Pong Clock Usermod, still having to check the led indices and test the stuff out of it

* Adding some attributes to be configured, Added platformio_override

* Fixed LED Numbering, Changed Color to RGB to Work with Settings

* Removing LED Positions from Config

* Some documenting

* Removed example comments to make ping pong clock mod more readable

Co-authored-by: Schmailzl, Sebastian <sebastian.schmailzl@wk-it.com>
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2022-10-21 01:47:25 +02:00
Egor
c47972d500
Adapting for the new WLED release: (#2802)
Removed longPressMacro call
  Fix debug calls
  Fix typos
2022-10-21 01:31:43 +02:00
Ahad
3c36030977
fix: filename uploads (#2831)
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-10-21 01:25:39 +02:00
lordjaxom
7b2836c63c
Usermod: Analog clock (#2736)
* implement analog clock as a usermod

* fix some bugs, use toki for time measurement, implement fading seconds

* added timezone handling to analog clock

* fixed looping second pointer, lower refresh rate

* removed mqtt debug code

* implement seconds effect choice

* adapt to 0_14 branch

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-10-20 10:12:17 +02:00
Steven Dashevsky
38e2fc6812
Implemented usermod for integration with smartnest.cz (#2800)
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-10-20 01:07:32 +02:00
Bartłomiej Wiśniewski
b0037c75a3
Upgrade DHT usermod (#2833)
* Implent publishing DHT data to MQTT broker

* Fix naming and add description
2022-10-20 01:02:52 +02:00
Christian Schwinne
d7f6cd944c
Merge pull request #2841 from Aircoookie/0_14
Merge 0.14 to main
2022-10-20 00:51:59 +02:00
Christian Schwinne
0de928a674
Merge branch 'main' into 0_14 2022-10-20 00:44:40 +02:00
Aircoookie
5c542d60e5 Add PKT timezone (see PR #2840) 2022-10-19 11:11:25 +02:00
Squall-DA
b3a29188a2
Add number of UDP retries (#2830)
* Release of WLED v0.13.3

* Fixed a type in the file name (#2781)

* Fixed the dependency (#2782)

* Usermod Wordclock update to use an alternatve wiring pattern (#2757)

* Update

* update readme file

* readme update

* Update readme.md

* Update readme.md

* Update readme.md

* Update readme.md

* Update platformio.ini

* Add number of UDP retries

Add a configurable number of retries to the UDP WLED sync function.

* Add migration from old eeprom settings

* Revert some accidental carry overs

* Correct issues found in pull request

Change default number of retries
Fix migration from old settings

* Make the minimum number of retries 0

* Import notify twice setting

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
Co-authored-by: Soren Singh Dary <67230851+sorensd@users.noreply.github.com>
Co-authored-by: Patrick <40436536+paeppi88@users.noreply.github.com>
2022-10-19 01:31:23 +02:00
Blaz Kristan
8417589789 Fix fork version. 2022-10-18 20:54:23 +02:00
Christian Schwinne
c982e022fe
Merge pull request #2834 from Aircoookie/async-psave
Async preset saving
2022-10-18 16:21:43 +02:00
Blaz Kristan
a4c3fd4493 Change max number of buses.
Added correct debug on failed digital init.
2022-10-18 12:10:11 +02:00
Blaz Kristan
7de35b4830 Merge branch 'dev' of https://github.com/blazoncek/WLED into async-psave 2022-10-13 17:22:51 +02:00
Blaž Kristan
3841780fe6 Merge branch 'async-psave' into dev 2022-10-13 14:25:01 +02:00
Blaž Kristan
2440d8e3d1 Merge branch '0_14' of https://github.com/Aircoookie/WLED into dev 2022-10-13 07:51:52 +02:00
Blaž Kristan
5012418ed2 Reintroduce color 2 & 3 for Dancing shadows.
Allows palette selection.
2022-10-13 07:33:23 +02:00
Blaž Kristan
a6ab4feca5 Bugfix. Unload playlist on "ps" JSON. 2022-10-13 07:06:49 +02:00
Renaud11232
cd0471386d
Fix SSDR usermod compilation (#2825) 2022-10-12 18:18:43 +02:00
cschwinne
d6749d30ab Fixed AEST and NZST DST change dates (resolves #2820 ) 2022-10-12 17:54:39 +02:00
Blaž Kristan
37a4a4dcdf Fix max bus limits for C3, S2 & S3 2022-10-11 09:46:48 +02:00
cschwinne
cebceb3ec3 Proper RMT channel checks for ESP32-C3 and S3 2022-10-10 17:04:25 +02:00
Blaz Kristan
426635871b Bus corrections for C3, S2 & S3.
Minor hostname tweak.
2022-10-10 16:46:23 +02:00
Blaz Kristan
701c90d18d Another string optimisation. 2022-10-09 13:39:17 +02:00
Blaz Kristan
d00a708177 Minor string optimisations. 2022-10-09 12:09:46 +02:00
Blaz Kristan
1f32f96487 Temporary preset bugfix. 2022-10-08 21:31:59 +02:00
Blaz Kristan
7642f8d702 Async preset saving.
Minor bugfixes.
2022-10-08 18:25:51 +02:00
cschwinne
e78bf240ca ESP32-C3: Do not default LEDPIN to reserved pin 16 2022-10-07 04:22:59 +02:00
Blaz Kristan
4fb44d98db Merge branch '0_14' of https://github.com/aircoookie/WLED into merge-0_14 2022-10-06 18:25:51 +02:00
Blaz Kristan
113ee73609 Newer AsyncWebServer. 2022-10-06 18:25:19 +02:00
Frank
64441b39ac critical bugfix
it's possible that volume samples become negative. In this scenario, our simple noise gate does stupid things, and it looks like "effects temporarily lost the sound".
This fix improves the situation, and makes sure that volume samples are always >= 0.
2022-10-06 15:39:28 +02:00
Blaž Kristan
b4e3cccf4b Remove testing entry. 2022-10-06 12:22:02 +02:00
Blaž Kristan
6a3ef2a2e4
Merge pull request #2809 from ingDIY/0_14
defines improvement
2022-10-06 12:15:30 +02:00
Blaž Kristan
1dd00c2ea9
Merge pull request #2814 from srg74/patch-2
Update usermod_PWM_fan.h
2022-10-05 21:40:08 +02:00
srg74
5038e4396e
Update usermod_PWM_fan.h
Changed values for proper work.
2022-10-05 15:30:09 -04:00
Blaz Kristan
bd025309fb Custom palette name bugfix. 2022-10-04 22:10:20 +02:00
Frank
1ae0dd574d fix for ADC analog
the "wait until I2S buffer fills" trick does not work for ADC sources, as the I2S sampling does not run in background for ADC.
2022-10-04 16:00:36 +02:00
Frank
7d5ce994ab WLED_DEBUG: fix for crash after LittleFS formating
This fixes a "division by zero" in WLED_DEBUG code.

LittleFS init seems to take some time, so we can arrive at "Loops/sec" with 0 loops executed --> crash.
2022-10-04 13:50:01 +02:00
Frank
78e0c3dcca make MIC_LOGGER work again
- EVERY_N_MILLIS somehow does not work. Replaced it,
- make sure that WLED_DEBUG does not report "fake FFT times" whrn FFT code was not running
2022-10-04 13:47:07 +02:00
ingDIY
edbb96bcd9 Update const.h
added #if case to exclude warning in case of ABL=0
2022-10-03 19:34:52 +02:00
ingDIY
bdb1e839ed Update readme.md
added description about the configuration of setting:
-D USERMOD_ROTARY_ENCODER_GPIO
2022-10-03 19:22:52 +02:00
ingDIY
1880740561 Update wled.h
reverted back settings to enable Alexa, Blynk, Huesync, IR.
The user shuld #define -D in platformio_override.ini to disable them
2022-10-03 19:17:28 +02:00
ingDIY
503835d47e submitting PR
Here they are the PR #2776, #2803 and #2804 rebased for 0_14 branch,
I hope that now they are OK!
2022-10-02 23:23:24 +02:00
Blaz Kristan
8d372bee67 Merge branch '0_14' of https://github.com/aircoookie/WLED into merge-0_14 2022-09-29 15:53:51 +02:00
Blaž Kristan
f385af595a Add setMode() and setPalette() methods
- automatically start transition
Implement load FX defaults for HTTP API (FXD)
2022-09-29 12:49:12 +02:00
Blaz Kristan
4cd6bafc15 Merge branch '0_14' of https://github.com/aircoookie/WLED into merge-0_14 2022-09-27 18:34:03 +02:00
Blaz Kristan
dc700c41fb Invalid FX bugfix. 2022-09-26 21:26:00 +02:00
ChuckMash
7cd9e8860d
Update wled_serial.cpp (#2667)
Add Continuous Serial Streaming feature to wled_serial.

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-09-26 10:08:31 +02:00
Stefan Riese
b6adbc926f
Usermod wordclock: support for upfront LEDs (#2668)
* - add ledOffset to support LEDs that are not effected by the usermode before the wordclock LEDs

* - adjust readme
2022-09-26 09:35:42 +02:00
Blaz Kristan
c253464b2a PinManager::isPinOk() rewrite
Button pullup/pulldown fix for ESP32.
2022-09-24 12:25:06 +02:00
Blaz Kristan
6306cfff96 Remove Octal SPI pins.
Whitespace.
2022-09-24 12:16:53 +02:00
Blaz Kristan
d86d88c7b7 New isPinOk() 2022-09-23 14:35:17 +02:00
Christian Schwinne
5f606bb0b7
DMX improvements (merge #2619) (#2794)
* Art-Net improvements

* Fix brightness level

* Update cfg.cpp

Co-authored-by: 4lloyd <github@lloydpost.nl>
2022-09-23 01:02:49 +02:00
Patrick
1daa97545b
Usermod Wordclock update to use an alternatve wiring pattern (#2757)
* Update

* update readme file

* readme update

* Update readme.md

* Update readme.md

* Update readme.md

* Update readme.md

* Update platformio.ini
2022-09-22 20:43:40 +02:00
4lloyd
d0189b0719
Add ArtPoll support (#2615)
* Add ArtPoll support

* Improved calculations

* Add support for legacy DMX start address 0

* Small efficiency improvement

* ESP8266 doesn't like yield

* Optimized ArtPoll memory use

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2022-09-22 20:34:46 +02:00
Blaz Kristan
222b92807e Percent FX use % as index in palette.
FX Checkmark bugfix.
2022-09-21 21:09:52 +02:00
Blaz Kristan
de90e5b753 Percent FX use % as index in palette.
FX Checkmark bugfix.
2022-09-21 21:09:01 +02:00
Blaž Kristan
ad4870a59b PIO environment for ESP32-S3 2022-09-21 08:47:52 +02:00
Blaz Kristan
9a6c387b8e Added Lolin S2 mini dev board environment. 2022-09-20 22:14:18 +02:00
Blaz Kristan
81b4a35076 Corrrect version info.
AC CSS
2022-09-20 22:06:37 +02:00
Blaz Kristan
411b3d0888 Merge branch 'dev' of https://github.com/blazoncek/WLED into merge-dev 2022-09-20 21:53:59 +02:00
Blaz Kristan
fc0dc4472b Merge branch 'esp32-s2' into dev 2022-09-20 21:52:40 +02:00
Blaz Kristan
7824f9ee63 Remove sync preset loading (ugly core check)
WS buffer check for ESP32-S2
Delay for Serial init on CDC USB
2022-09-20 21:17:44 +02:00
Frank
fb00bef05f AR - necessary constants for 166Khz sampling rate
16kHz might be a good compromise on small MCU's:
- GEQ will show frequencies up to ~6Khz
- FFT process may use up to 32millis (-> 100% CPU load). Try to stay below <60% so FreeRTOS can schedule all tasks properly.

- more CPU time is left for other WLED, so it maintains LED FPS and stays responsive on web UI.
2022-09-20 18:29:27 +02:00
Frank
d7bc6b1be7 AR: optimization for small MCUs, part2
Only run FFT when the result will be used.
Please note that this also means that `FFTTime` shown in Info is only meaningful when there is sound input and not silence.

--> To get exact FFT times, the optimization can be disabled by compiling with `-D SR_DEBUG`
2022-09-19 14:09:45 +02:00
Frank
79776ae8bc AR: optimization for smaller MCUs
- this reduces "lagging behind" of I2S sampling on smaller MCU's. The maximum time for FFT is now ~20 millis.
- small improvement for SR_DEBUG
2022-09-19 13:38:52 +02:00
Frank
90b3f009af AR: small improvement for ADC analog mics
ensure that ADC parameters are properly configured.
2022-09-19 13:30:13 +02:00
Frank
6f8deb83e3 some relaxations for S2 and C3
- AR: changed "error" into warning.
- reducing max_busses (for AR) not needed on S2
2022-09-17 22:00:33 +02:00
Frank
da02a68e60 allocatePin() debug message when Pin is not OK.
This debug message should help to understand GPIO config problems.
2022-09-17 20:42:34 +02:00
Frank
85fc8710dd mics that need MCLK should work 2022-09-17 20:39:23 +02:00
Frank
a01f3e4efd presets: disable "crude hack" on single core
This code in handlepresets() does not make much sense.
Especially it does not make any sense on single core MCU's.
2022-09-17 13:41:27 +02:00
Blaz Kristan
cce54f3bb7 Loading cfg.json without wsec.json
Bugfix for BudOnOff.
2022-09-16 23:19:53 +02:00
Blaz Kristan
92037a480d Bugfix for BusOnOff 2022-09-16 23:12:57 +02:00
Blaz Kristan
cf6005ce2f Fix for loading config without wsec.json 2022-09-16 22:00:26 +02:00
Frank
a766ddbebc make I2S microphones work with buggy IDF4.4.x
I2S microphones were not working any more in with the newest framework - only delivers silence.
Ther reason is stupid bug in espressif I2S "compatibility" driver: RIGHT and LEFT channel are swapped, so when only asking for LEFT, we get silence from RIGHT.

Workaround: simply change LEFT to RIGHT, until the problem is fixed in ESP-IDF --> Fix tested on "classic ESP32", but still need to check behavior on -S3.
Code compiles also on -S3, -S2, and -C3.

smaller changes:
- a few changes to use new APIs (MCLK, rouing and sample resolution)
- a few additional debug messages
- put correct value into _pinConfig.mck_io_num
2022-09-16 16:58:04 +02:00
Frank
01acb08c83 minor fix (typo) 2022-09-16 16:38:24 +02:00
Frank
023c259034 show version of arduino-esp32 in WLED_DEBUG 2022-09-16 16:37:07 +02:00
Blaz Kristan
dfe4d70198 Merge branch 'audioreactive-prototype' into esp32-s2 2022-09-16 15:38:44 +02:00
Blaz Kristan
4d939cb778 Merge branch '0_14' of https://github.com/aircoookie/WLED into dev 2022-09-16 15:34:17 +02:00
Blaž Kristan
660a809ec8 Missing isActive() 2022-09-16 14:07:44 +02:00
Blaž Kristan
26825ed60f Missing isActive() 2022-09-16 14:07:04 +02:00
Soren Singh Dary
8bd8975e0a
Fixed the dependency (#2782) 2022-09-14 23:29:35 +02:00
Blaz Kristan
799d4f9465 Playlist load bugfix.
serializeConfig() in loop() (prevent crash/hang in web server callback)
2022-09-14 22:28:06 +02:00
Blaz Kristan
47797bcf4a Playlist loading bugfix. 2022-09-14 20:13:03 +02:00
Soren Singh Dary
2847921e5a
Fixed a type in the file name (#2781) 2022-09-14 13:56:16 +02:00
Blaz Kristan
8402de601f More fixes for GPIOs.
UI fixes.
2022-09-13 21:41:51 +02:00
Blaz Kristan
4dec75c589 Remove constraints when saving interface pins. 2022-09-13 20:26:45 +02:00
Blaz Kristan
ac15b227da isPinOk() for S2 & C3 2022-09-13 19:50:13 +02:00
Blaz Kristan
a1dc7a52e9 Merge branch '0_14' of https://github.com/aircoookie/WLED into dev 2022-09-12 22:39:00 +02:00
Blaz Kristan
6ba3e25d33 Meteor palette bugfix.
Fire2012 cooling adjustment.
Akemi optimisation.
2022-09-12 22:33:30 +02:00
Blaz Kristan
51a2fa47c9 Meteor palette fix.
Akemi optimisation.
Fire2012 remove cooling adjustment.
2022-09-12 22:31:55 +02:00
Blaz Kristan
09bd6dba84 ESP32 GPIO 37 & 38 removed from reserved list. 2022-09-12 21:15:19 +02:00
Frank
925bc3b3dd AR: get rid of annoying "type conversion" warning 2022-09-11 14:32:00 +02:00
Frank
382bf1e94c reserved Pins for S3
- adding USB-OTG to reserved GPIO
- no read-only GPI
- if PSRAM found, add pins for "octal" PSRAM to unusable list (octal PSRAM seems to common on S3)
- ESP32: 37 and 38 are read-only
2022-09-11 13:17:08 +02:00
Frank
575a7531c5 another "TX"
changed in hardwareTX
2022-09-11 01:01:27 +02:00
Frank
dce0c0b47e npm run build
regenerate html files
2022-09-11 00:24:35 +02:00
Frank
dc8230bf2e arch = ESP.getChipModel()
rely on ESP.getChipModel() for new MCUs-
2022-09-11 00:19:32 +02:00
Frank
17428d58d9 extend input ranges to 48 pins
this only extends the range of possible inputs. Sanity check will be performed regardless of the max value.
2022-09-11 00:18:33 +02:00
Frank
6771bd84c6 introduce hardwareTX / hardwareRX
RX/TX is not defined on all boards.
Fall-back to previous behavior on "classic" ESP32 and 8266.
2022-09-11 00:16:48 +02:00
Frank
ac10b3a5c7 compilation support for audioreactive
putting all parts that will not compile between #ifdef .... #endif
Tested on S3, cannot say what will happen on other MCUs
2022-09-11 00:12:51 +02:00
Frank
56f2513aba Basic support for -S3
- bus_wrapper: currently no support for I2S methods
- pin_manager: different number of PWM channels, different isPinOk()
2022-09-11 00:09:59 +02:00
Blaz Kristan
9858a009da Max GPIO fos I2C/SPI pins. 2022-09-10 21:58:51 +02:00
Blaz Kristan
73b818cf78 Fix for S3 pins. 2022-09-10 20:19:13 +02:00
Blaz Kristan
4f8ffaee5b S2, S3 & C3 support for settings. 2022-09-10 19:27:00 +02:00
Blaz Kristan
2cd40c7552 ESP32-S2 support. 2022-09-09 23:21:47 +02:00
Blaz Kristan
c9fd69ceb7 Preset loading tuning.
Multi-relay toggle support.
Fire2012 tuning.
2D functions tuning.
Global SPI comments & tuning.
Bugfix in 4LD usermod.
2022-09-09 17:21:13 +02:00
Blaz Kristan
e4fbf70568 Preset loading tuning.
Multi-relay toggle support.
Fire2012 tuning.
2D functions tuning.
Global SPI comments & tuning.
Bugfix in 4LD usermod.
On & bri support fix.
2022-09-09 17:16:52 +02:00
Frank
cf93d6bb65 more precision for debug info (FFT timing)
keep more detailed timing info for FFT and I2S (WLED_DEBUG)
2022-09-08 22:45:32 +02:00
Frank
228890aa19 Merge remote-tracking branch 'origin/dev' into audioreactive-prototype 2022-09-08 20:47:49 +02:00
Frank
ad8512e246 Revert "Compiling AR usermod on ESP32-S3 (future support)"
This reverts commit 7894389f1d.
2022-09-08 20:41:33 +02:00
Blaz Kristan
4480abc646 Better palette blends. 2022-09-06 21:47:50 +02:00
Blaz Kristan
94243ac605 Better palette blending. 2022-09-06 21:44:11 +02:00
Blaz Kristan
e8942c2968 fix for repeating debug message 2022-09-06 15:52:09 +02:00
Blaz Kristan
8e03395b53 New segment bugfix. 2022-09-06 15:47:41 +02:00
Blaz Kristan
4f3de8646a Additional fix for transpose checkbox. 2022-09-06 15:44:41 +02:00
cschwinne
6802f5a802 Fix several small bugs
Fixed no new 2D segments creatable in UI
Fixed brightness not applied if `"on":true` present in the same JSON api call
Fixed CJK text upside down in namelabel (rotate to nicer direction only if no CJK characters)
Gamma correction color enabled by default
2022-09-06 03:06:00 +02:00
Blaz Kristan
3a1ddce13f Return of Supāku. 2022-09-05 19:56:55 +02:00
Blaž Kristan
6c18857109 Fix build. 2022-09-05 19:01:58 +02:00
Blaž Kristan
508b1e76c2 Merge conflict fix. 2022-09-05 18:36:10 +02:00
Blaž Kristan
51d3268eed Merge branch 'dev' of https://github.com/blazoncek/WLED into 0_14
- remove conditional audio compile
- Random Cycle bugfix
- AudioReactive updates
- global gamma flags
2022-09-05 15:13:15 +02:00
cschwinne
a0c90d4ba3 Disable unused characters in fonts
saves 5kB flash
Added 4x6 font
2022-09-05 03:18:59 +02:00
Blaz Kristan
2c27240da6 Remove DISABLE_AUDIO 2022-09-05 00:43:26 +02:00
Blaz Kristan
787f5f06df Global gamma.
Randomcycle palette bugfix.
2022-09-04 20:17:05 +02:00
Frank
7894389f1d Compiling AR usermod on ESP32-S3 (future support)
Encapsulated all parts with #ifdef that will not compile on newer ESP32 variants.
It's still a long way to go before we have a working version on -S3 and -C3, bus this should help to get us started.

From MoonModule/WLED repo.
2022-09-03 19:03:00 +02:00
Frank
da5f6315be fix for repeating debug message 2022-09-03 18:43:28 +02:00
Blaz Kristan
42d1ab8a87 Separator in Info dialog. 2022-09-03 00:01:11 +02:00
Blaz Kristan
cf51892782 Merge branch 'audioreactive-prototype' into dev 2022-09-02 23:36:44 +02:00
Blaž Kristan
cdd4319991
Merge pull request #40 from MoonModules/expand-1DEffects
Drip to virtualStrip
2022-09-02 23:32:45 +02:00
Blaz Kristan
3287eef0f1 Fixed cooling of ignition area. 2022-09-02 23:27:54 +02:00
Blaz Kristan
c4a261f2d2 Minor tweaks. 2022-09-02 21:21:53 +02:00
Ewowi
1867db3c4b VirtualStrip: use indexToVStrip 2022-09-02 20:52:20 +02:00
Ewowi
9e23d52193 Popcorn to virtualStrip 2022-09-02 18:30:23 +02:00
Ewowi
e29be737f7 Drip to virtualstrip correction 2022-09-02 18:14:28 +02:00
Ewowi
3ac4122ec8 fire_2012 to virtualStrip 2022-09-02 17:55:08 +02:00
Ewowi
d56a79e016 Drip to virtualStrip 2022-09-02 17:42:47 +02:00
Frank
77ace76e32 Bugfix: make UDP sound sync work in AP mode
- the connected() method only get called once a Wifi STA connection is established. UDP Sound Sync should also work when sender is in AP Mode.
- added a few comments that should help to understand the code structure.
2022-09-02 13:49:12 +02:00
cschwinne
3270605b4f DDP network bus RGBW support 2022-09-02 03:12:03 +02:00
Blaz Kristan
36e10539e0 Merge branch 'dev' into audioreactive-prototype 2022-09-01 22:20:39 +02:00
Frank
37ba649930 audioreactive effect improvements
- Info Page: add a small horizontal line below usermod specific part. Improves readability.
- updated 2D mapping mode of some  1D soundreactive effects
- alllow some effects to fade slowly, even slower that possible with SEGMENT.fade_out(). Looks nice.

not sure why - most effects only fade when using SEGMENT.fade_out(), while some need SEGMENT.fadeToBlackBy().
2022-09-01 14:56:01 +02:00
Blaz Kristan
586e72e797 Remove pxs/NONUNITY option
Constrains for bitfields.
Bugfixes.
2022-08-31 21:31:59 +02:00
Blaz Kristan
38bd0d6bbb Bugfixes 2022-08-31 21:21:53 +02:00
Blaž Kristan
da0da4c75e Remove NONUNITY
Expand soundSim
Tetrix optimisation
2022-08-31 14:24:02 +02:00
Blaž Kristan
bfe16bb254 Merge branch '0_14' of https://github.com/Aircoookie/WLED into dev 2022-08-31 08:02:11 +02:00
cschwinne
2ada88a266 Small improvements to fx data extraction functions
- Un-F() most segment JSON keys, decreases JSON doc usage by 47 B (increases static RAM usage by 32 B),
makes `extractModeDefaults` work without strstr_P
- Removed String from serializeModeData and serializeModeNames
- Set 0.14 version name "Hoshi"
2022-08-31 04:31:56 +02:00
cschwinne
5b51ce9840 extractModeDefaults(): C strings instead of String 2022-08-31 02:26:26 +02:00
Blaz Kristan
26793c8428 Merge branch 'dev' into audioreactive-prototype 2022-08-30 20:13:25 +02:00
Blaz Kristan
8719adef1e Tetrix vStrip 2D modification.
AA version of Bouncing balls
Better AA
2022-08-30 17:20:58 +02:00
Blaz Kristan
cd7bcb79e5 Tetrix vStrip 2D modification.
AA version of Bouncing balls
Better AA
2022-08-30 17:18:56 +02:00
Blaz Kristan
005419ab9a vStrip calculation
remove Segment copy constructor
2022-08-29 21:51:46 +02:00
Blaz Kristan
d28d2c57e4 Merge 'blazoncek/dev' into 0_14
1-click presets
Bugfix for 1D
virtual strips POC for 1D effects
global SPI MISO pin
2022-08-29 20:45:06 +02:00
Frank
64970772c7 optimization, and moving peak detection into own function
- save 1K of RAM by optimizing out
 fftBin[].
- moved several copies of the peak reset code into a single function
- moved peak detection out of getSample().
 - call peak detection function as last step of FFTcode. More optimal, and we can be sure that fresh FFT result are available.

Peak detection/reset are now called from both tasks, so I had to move some peak-related vars out of AudioReactive class and make them global (static).
2022-08-28 16:26:34 +02:00
Frank
6019b7bda4 GEQ: use full frequency range
also when user wants less than 16 bands.
Previously when users selected fewer bands (like 4 instead of 16), only the lowest freq channels were displayed.
2022-08-28 13:33:48 +02:00
Frank
5c792eb869 some cleanup and re-grouping of variables
- put variables with same context next to each other.
- removed a few vars that are not needed any more.
- replaced "16" by a more descriptive constant
2022-08-28 13:13:25 +02:00
Blaz Kristan
c6126db2a2 Bugfix for 1D setPixelColor
Float vStrips.
Fix misspelled MISOSPI.
2022-08-27 18:25:54 +02:00
Blaz Kristan
030833f942 Global MISO pin.
Virtual strip expansion for 2D.
2022-08-25 21:57:43 +02:00
Blaz Kristan
daf67d9cf7 Whitespace cleanup.
Revert legacy effects to 1D and use mapping instead.
2022-08-24 23:04:51 +02:00
Blaz Kristan
301ed25019 1-Click preset. 2022-08-23 20:57:11 +02:00
Blaz Kristan
a7dbfc4954 Fix for segment on/off transitions.
Fix for missing return.
Slightly smoother Chunchun, added Speed parameter for Hiphotic.
2022-08-23 16:00:50 +02:00
Blaz Kristan
af5e38e5ee Fix for segment on/off transitions.
Fix for missing return.
Slightly smoother Chunchun, added Speed parameter for Hiphotic.
2022-08-23 15:57:05 +02:00
cschwinne
102a28aef4 Release of WLED v0.13.3 2022-08-23 01:26:18 +02:00
Blaz Kristan
d3d8fdff13 Transpose fix. 2022-08-22 22:02:36 +02:00
Blaz Kristan
9cb6f95420 Missing map2D bugfix. 2022-08-22 20:38:23 +02:00
Blaz Kristan
89f334e67b Missing map2D bugfix. 2022-08-22 20:37:47 +02:00
Blaz Kristan
b8b3d17570 Merge remote-tracking branch 'upstream/0_14' into dev 2022-08-22 19:37:17 +02:00
Blaz Kristan
053083f600 Minor optimisation. 2022-08-22 17:06:28 +02:00
Blaz Kristan
cf46564c67 Merge branch 'dev' into audioreactive-prototype 2022-08-22 17:01:51 +02:00
Blaz Kristan
59b038b8c4 Index under- shooting.
Fix for arc 1D to 2D mapping.
UI segment 2D mapping fix.
Watchdog reposition & flicker reduction.
2022-08-22 16:48:19 +02:00
Blaz Kristan
fb6dfcd3fc Index under- shooting.
Fix for arc 1D to 2D mapping.
UI segment 2D mapping fix.
Watchdog reposition & flicker reduction.
2022-08-22 16:47:25 +02:00
Blaž Kristan
1711ac9a88 Fix in is2D()
Horizontal and vertical 1D segment
Index overshoot fix.
2022-08-22 14:35:34 +02:00
Blaž Kristan
e14c5bbd25 Fix in is2D()
Vertical & horizontal 1D segment (on 2D matrix)
Index overshooting fix.
2022-08-22 14:08:45 +02:00
Blaž Kristan
cf0f0d77be Merge branch 'audioreactive-prototype' of https://github.com/blazoncek/WLED into merge-audio 2022-08-22 10:34:10 +02:00
Frank
be7e7ac274 AR: documentation
- clarified a misleading comment in FFTCode
- added a few more comments to describe steps of the processing
- removed some commented-out code
2022-08-22 10:08:22 +02:00
cschwinne
844bef9fda Explicit JSON flag for loading FX defaults
Disable watchdog by default
2022-08-22 01:17:10 +02:00
Blaz Kristan
d56d41a8c2 Merge branch 'dev' into audioreactive-prototype 2022-08-21 20:50:40 +02:00
Blaz Kristan
b722c618bd Fixes in NodeStruct & bus manager. 2022-08-21 20:50:24 +02:00
Blaz Kristan
720fae8720 Code sanitation.
Default analog pin -1
2022-08-21 19:15:42 +02:00
Christian Schwinne
8744b40dc5
Update python dependencies (#2760) 2022-08-21 13:11:35 +02:00
Frank
d053bc562f code cleanup, few optimizations, and fixing more overflows
- code cleanup in audio_reactive.h
- fixing some more under/overflows in fx.cpp
2022-08-21 13:10:16 +02:00
cschwinne
cade1800f4 Update python dependencies 2022-08-21 12:50:52 +02:00
Blaz Kristan
450a0180f8 Merge branch 'dev' into audioreactive-prototype 2022-08-21 09:54:33 +02:00
Blaz Kristan
ea363a8764 Minor cleanup & fix for connected(). 2022-08-21 09:51:15 +02:00
Frank
bbc8049832 The Right Thing to Do (makes GEQ look awesome)
... found that stupid commit messages get more attention ;-)

- use 22050 Hz for sampling, as it is a standard frequency. I think this is the best choise.
- redesigned the GEQ channels (fftResult[]) for 22Khz, based on channels found on old HiFi equalizer equipment. 1Kzh is now at the center; Bass/Trebble channels are using 1/4 on left/right side respectively - similar to real equalizers. Looks nice :-)

- adjusted effects that use FFT_MajorPeak so that the maximum frequency is supported.
2022-08-20 22:14:54 +02:00
Blaz Kristan
66acd60406 PWM Fan usermod UI enhancement. 2022-08-19 21:38:48 +02:00
Blaz Kristan
6fd8a5a084 Replace setOption/getOption 2022-08-19 21:37:26 +02:00
Blaz Kristan
5927332a5f UI enhancement in PWM Fan usermod. 2022-08-19 21:25:44 +02:00
Blaz Kristan
44a4b11d36 Replace setOption/getOption 2022-08-19 21:14:49 +02:00
Frank
b8db47e528 AR: new freq scaling option "square root"
also looks nice. It's a compromise between log() and linear. OK enough tinkering for today :-)
2022-08-19 16:11:50 +02:00
Blaz Kristan
f7652bd2ef Fix audio sync check 2022-08-19 15:17:04 +02:00
Blaz Kristan
e9f6509cb0 Merge branch 'segment-api' into dev 2022-08-19 15:14:56 +02:00
Frank
3c57e2e2b9 AR: special gain for GEO, some bugfixes andparameter tinkering
- new feature: "Input Level" (info page) can be used as global "GEQ gain" - only when AGC is ON (was already possible when AGC=off)

- some parameter tweaking in FFT function
- hidden feature: FFT decay  is slower when setting a high "dynamics Limiter Fall time" (steps: <1000, <2000, <3000, >3000)

- FFT_MajorPeak default 1.0f (as log(0.0) is invalid)
- FX.cppp: ensure that fftResult[] is always used inside array bounds
2022-08-19 14:36:47 +02:00
Blaz Kristan
753ae51dd5 Stop & restart UDP on pause/update. 2022-08-18 20:42:58 +02:00
Christian Schwinne
638178556f
Merge pull request #2737 from blazoncek/segment-api
Full blazoncek fork merge, including 2D support
2022-08-18 20:13:43 +02:00
Christian Schwinne
b44ed70112
Merge branch 'main' into segment-api 2022-08-18 20:13:02 +02:00
Frank
3e494cc551 removed broken frequency squelch, added frequency scaling options
- removed broken FFTResult "squelch" feature. It was completely broken, and caused flashes in GEQ.
- added Frequency scaling options: linear and logarithmic
- fixed a few numerical accidents in FX.cpp (bouncing_balls,  ripplepeak, freqmap, gravfreq, waterfall)
2022-08-18 19:07:37 +02:00
Blaz Kristan
fa55896722 Const functions. 2022-08-17 20:45:30 +02:00
Blaz Kristan
67a51be9ee Merge branch 'audioreactive-prototype' into merge-audio 2022-08-17 20:14:11 +02:00
Blaz Kristan
2149bbb8ea Remove CS from global interface pins.
Fixes.
2022-08-17 19:44:32 +02:00
Frank
d92a93f1d5 AR: added dynamics limiter usermod cfg options
- On/Off controls the complete feature
- Rise Time and Fall Time are the minimum times (in milliseconds) for "volume" to go from 0% to 80% and back.
- when "On" we also use some filtering to smooth FFTResults[]. Rise and Fall Times do not affect Frequency reactive effects otherwise.
2022-08-17 13:40:54 +02:00
Frank
991fad02d7 fixed look of some 1D effects
- fade_out() appears to finally do something meaning. Old fade_out values were too high. Adjusted so effects in 1D look similar "classic" SR WLED
- frequency reactive effects: max FFT frequency of 5120 Hz is hard-coded in most effects. Updated ranges to 10240 Hz
2022-08-17 13:17:00 +02:00
Blaž Kristan
7497e43fb9 Merge branch 'master' into dev 2022-08-17 07:20:18 +02:00
Frank
1336de12a0 Info Page: added status info for audioreactive
- Current sound source - including "failed to initialize"
- Current AGC or Manual Gain
- Sound Sync Status
2022-08-17 00:15:06 +02:00
Blaz Kristan
0f78bd3785 PWM fan manual speed override. 2022-08-16 20:57:24 +02:00
Blaz Kristan
90b567c721 Merge branch 'lpd6803' into segment-api 2022-08-16 20:48:51 +02:00
Blaz Kristan
8176f1141e Merge branch 'Sousanator-master'
Added LPD6803 chip support.
2022-08-16 20:35:57 +02:00
Blaz Kristan
515827c745 Merge branch 'master' of https://github.com/Sousanator/WLED into Sousanator-master 2022-08-16 20:35:17 +02:00
Frank
1a2701561b AR: bugfix for audio sync receive, and a few robustness improvements
* Header checking for sound sync receiver: removed wrong "!"
* make sure all member vars have initial values
* some robustness improvements in case of receiving bad UDP data.
2022-08-16 12:02:22 +02:00
Blaž Kristan
c7d3ee0612 Fix "washed out" noise FX. 2022-08-16 10:08:19 +02:00
Blaž Kristan
4be3cb4b0d Merge branch 'TM1829' of https://github.com/h3ndrik/WLED into lpd6803 2022-08-16 08:42:47 +02:00
Blaž Kristan
db759bef46 Merge branch 'master' of https://github.com/Sousanator/WLED into lpd6803 2022-08-16 08:14:56 +02:00
Blaž Kristan
3d47a8e9c0 Merge branch 'master' into dev 2022-08-16 07:52:33 +02:00
Frank
91fe80334b Merge remote-tracking branch 'origin/segment-api' into audioreactive-prototype 2022-08-15 21:33:30 +02:00
Blaz Kristan
7125d19af1 Bugfix for saving usermod settings.
Modification of global interface pin allocation.
Code relocation in 4LD.
2022-08-15 20:23:47 +02:00
Frank
873e41dcfb AR: change smoothing of FFTResult
FFTResult smoothing changed; rising edges will be very quick, falling down is slower.
2022-08-15 14:28:51 +02:00
cschwinne
420f858d9b Release of WLED v0.13.2 2022-08-15 02:08:48 +02:00
Blaz Kristan
e6f74751d4 Missing presets bugfix. 2022-08-14 22:16:42 +02:00
Frank
5a4713950c improved ADCsample processing (from SR WLED)
improved ADCsample processing,  including replacement of "rogue" samples from other channels (this happens at least once in 5 seconds !!).

It compiles, don't ship it yet - needs more testing.
2022-08-14 16:17:34 +02:00
Frank
c6691564a5 removing dead code from getSamples() 2022-08-14 14:47:03 +02:00
Frank
8acb44b202 small improvement for limitSampleDynamics
support the case when only attackTime XOR decayTime is defined
2022-08-14 14:38:27 +02:00
Frank
72770e5809 Merge remote-tracking branch 'origin/segment-api' into audioreactive-prototype 2022-08-14 14:19:57 +02:00
Frank
968721a515 some audio processing improvements and bugfixes from SR WLED
- smoothing FFTResult (don't have a matrix to test)
- UDP sound sync improvements
- some bugfixes from SR WLED
- button.cpp: avoid starvation: strip.isUpdating() can be true for a long time.

work in progress - still needs testing!!
2022-08-14 13:58:07 +02:00
Blaz Kristan
1de009a80d I2C & SPI fixes. Global interface. 2022-08-14 13:05:59 +02:00
Blaz Kristan
74b6a78a9b Effect fixes. 2022-08-13 00:58:27 +02:00
Blaz Kristan
32fc6d4b7f Binary effect parameters. 2022-08-12 17:58:20 +02:00
Blaž Kristan
d05b49496c Merge branch 'segment-api' into audioreactive-prototype 2022-08-11 13:24:01 +02:00
Blaž Kristan
52e5f467b0 Added two more fonts to Scrolling text. 2022-08-11 11:46:30 +02:00
Blaž Kristan
4e0cf380be Fix for 0 duration/reset runtime. 2022-08-11 11:23:39 +02:00
Blaz Kristan
ebe9499e97 Deallocate interface pins. 2022-08-10 21:23:00 +02:00
Blaz Kristan
1cb3ab82c2 Reduction of flicering on web access (info) 2022-08-10 20:53:11 +02:00
Blaz Kristan
e0a954caa2 4LD refresh task.
Scrolling text improvement.
LED settings bugfix.
Audioreactive disabled by default.
2022-08-10 20:20:36 +02:00
Frank
ecce3243de save 1KB of RAM
save one KB (4*256 bytes) by not storing the "upper half" of FFT results. Only the lower half has interesting results.
2022-08-10 18:14:28 +02:00
Frank
5e6532959b AudioSource improvements (work in progress)
-new methods: getType(), isInitailized(), postProcessSample()
- allow users to compile for RIGHT audio channel (-D I2S_USE_RIGHT_CHANNEL)
- better handling in case audio input driver failed to initialize
- removed some unneeded code and unneeded parameters
2022-08-10 17:18:43 +02:00
Blaž Kristan
d8b7cfb36b Display task (background refresh) in 4LD 2022-08-10 14:00:04 +02:00
Blaž Kristan
b2837563c4 Merge branch 'segment-api' into global-interface 2022-08-10 09:32:43 +02:00
Blaz Kristan
957948f906 Code optimisations in effects.
Remove Wire initialisation from RTC.
Peek fix.
2022-08-09 21:14:37 +02:00
cschwinne
7befafe7b7 Enable numbers and symbols in text FX
Shorten `Reserved` to `RSVD`
2022-08-09 18:09:43 +02:00
cschwinne
436ce63e30 FX list duplicate cleanup
Minor optimizations
2022-08-09 15:20:00 +02:00
Blaz Kristan
0268beb9c2 Merge branch 'segment-api' into global-interface 2022-08-08 20:22:11 +02:00
Blaz Kristan
6a42e477aa Empty name Scrolling tex bugfix. 2022-08-08 19:56:09 +02:00
Blaz Kristan
22bc3dac2d Tetrix with fade-out. 2022-08-08 17:52:20 +02:00
Blaz Kristan
4db4329ce3 Proper fix for {"on":"t","bri":100} 2022-08-08 15:56:15 +02:00
Frank
924073424f AR FFT task optimization - wait so I2S can fill its buffers
It seems that waiting first (before reading I2S) is much better than waiting after FFT is completed.
2022-08-08 13:53:46 +02:00
Blaž Kristan
9e828eccf6 Fix for {on:"t",bri:100} 2022-08-08 13:36:13 +02:00
Frank
3a8c99d43c AR: removed two unneeded variables
some cleanup - no functional impact.
2022-08-08 10:51:46 +02:00
Blaž Kristan
acb17dc575 Fix addEffect() 2022-08-08 10:21:11 +02:00
Frank
58987989da experimetal: limit rate at which the FFT task runs
this should do the trick.
Needs some more testing.
2022-08-07 22:19:38 +02:00
Frank
86e8ee334f future support: reading a single sample on 8266
audioreactive will still not work on 8266. This is just experimental code that allows to read a single sample from ADC every 20 millis.
2022-08-07 22:04:26 +02:00
Blaz Kristan
998f2f9421 Global I2C & SPI pin allocation. 2022-08-07 16:43:29 +02:00
Frank
8694e7a6bf AR: loop hickup protection (from SR WLED)
same "hickup protection" as implemented in SR WLED.
2022-08-06 18:17:45 +02:00
Frank
b46a6ed094 AR: samples dynamics limiter (experimental)
to enable, compile with -D SOUND_DYNAMICS_LIMITER.
still missing UI integration, and more testing.
2022-08-06 17:53:35 +02:00
Frank
d0f53cb14a AR: removing some old debug code
Align with SR WLED code:
- removed old debug code that did not work any more
- removed experimental MAJORPEAK_SUPPRESS_NOISE code
2022-08-06 17:24:39 +02:00
Frank
96d497a5cd AR: optimize sound sync, and code improvements
UDP audio sync: introduced new header version, because the new struct (without myvals[]) is not compatible with the previous struct. Also optimized structure size.
UDP audio sync: sender decides is AGC or non-AGC samples are transmitted.
getsamples: move volumeSmth/volumeRaw code out of AGC core function.
2022-08-06 16:48:26 +02:00
Blaz Kristan
a8785570df Memory allocation fixes.
Whitespace.
Cleanup.
2022-08-06 12:39:12 +02:00
Ewowi
aa36e04250 Deoptimize lv2D a bit to keep resize working ;-) 2022-08-06 11:53:01 +02:00
Ewowi
821b7ed9af Optimize liveviewsws2D 2022-08-06 11:37:48 +02:00
Blaz Kristan
9270f80af2 Merge branch 'integration' into merge-audio 2022-08-05 23:03:38 +02:00
Blaz Kristan
eb8710df81 Merge branch 'audioreactive-prototype' into segment-api 2022-08-05 16:29:32 +02:00
Blaz Kristan
095099a085 Rename WLED_NO_AUDIO 2022-08-05 15:54:48 +02:00
cschwinne
ad424cac18 Preset and config backups include server description 2022-08-05 12:09:13 +02:00
Blaz Kristan
4e11806d00 Code optimisations. 2022-08-04 16:15:49 +02:00
Blaz Kristan
f45082b764 Crash fix for ESP8266 if mode contains ! 2022-08-03 22:27:45 +02:00
Blaz Kristan
cdca715afc Effect change at end of transition.
Compile bugfix.
2022-08-03 22:09:27 +02:00
Blaz Kristan
d0a08a55d1 Memory management! 2022-08-03 21:36:47 +02:00
Blaž Kristan
c5f3e76b21 Compile optimisations, code reduction.
2D peek resize.
2022-08-03 14:23:24 +02:00
Blaz Kristan
f58ff68f3c Center liveview2D, code size reduction. 2022-08-02 22:50:01 +02:00
ewowi
a098aa0a89 leds array from CRGB to uint32_t 2022-08-02 22:06:13 +02:00
ewowi
7b3fc206f7 Merge leftovers 2022-08-02 21:52:10 +02:00
Blaz Kristan
8f5d2a7f00 Merge branch 'mapping12soundsim' into segment-api 2022-08-02 21:47:24 +02:00
ewowi
44c585e8c8 Merge branch 'ledsArrayToSGPC' into integration 2022-08-02 21:12:59 +02:00
ewowi
640f45f57d Remove leds array from utility functions + small things
- Remove CRGB* leds from utility functions
- GameOfLife: fill_solid for prevLeds to for loop
- Remove if !fftResult
- Funky Plank: toggle src and dst
- Comment drawLine as not used
- Duplicate FadeToBlack, call one FadeToBlackOld
2022-08-02 19:44:27 +02:00
Blaz Kristan
0ba8bace0d 2D optimisations. 2022-08-02 18:27:32 +02:00
ewowi
4202fb8cdc Small things
- Remove leds[] in comments
- freqmatrix default mapping to circle
- t_bri compile error
2022-08-02 18:05:55 +02:00
ewowi
5f8b8835e1 Leds removal leftovers
- Remove leds from 1D SEGMENT.data effects
- Noisefire: re-establish own palette
- FreqMatrix to circle mapping
2022-08-02 12:58:35 +02:00
ewowi
78edcfe5cf Merge branch 'ledsArrayToSGPC' into integration 2022-08-02 12:21:46 +02:00
ewowi
2ca5e0c8b8 Remove leds from FX.cpp
- add addPixelColor overloads
- remove setPixels function
- sPC/gPC move leds check to beginning
- refactor wu_pixel work without leds
- remove leds out of effects and replace by sPC/gPC/aPC/nullptr
- workaround %=
- refactor game of life (but need to check patterns / history, see SR)
- refactor fill_circle to work without leds
2022-08-02 12:19:04 +02:00
Blaz Kristan
7ca1d99412 Multiple additions:
- transparent leds[] for getPixelColor()
- sample 2D Black Hole for trnasparent leds[]
- conditional audio compile (WLED_NO_AUDIO)

Bugfix:
- effect filtering
2022-08-01 22:01:24 +02:00
Blaz Kristan
118bcbd6a6 Effect filter patterns. 2022-08-01 17:32:40 +02:00
ewowi
987b442796 Merge branch 'ledsArrayToSGPC' into integrationMergeOnly 2022-08-01 16:25:51 +02:00
ewowi
8ea77ccd04 Merge branch 'segment-api' into integrationMergeOnly 2022-08-01 16:17:16 +02:00
ewowi
004c2920f5 All effects use strip.leds, refactor XY
- remove leds out of SEGMENT.data (remove if no other use of data)
- use strip.leds
- refactor XY to make segment relative to the whole matrix
- use RGBW32
- in case of 1D also use XY in leds[]: XY(i%width, i/width)]
- add ps_malloc
2022-08-01 16:11:59 +02:00
Blaz Kristan
f02616acd1 Some fixes. 2022-07-31 19:52:07 +02:00
ewowi
69f9a484ca strip.leds array fully fastLed and segment compatible
- leds array from uint32_t to CRGB for fastled compatibility
- reading and writing leds from strip to segment sPC/gPC so it has logical instead of physical indexes so it can be used in effects
- change mode_2DBlackHole as showcase how it can both work with leds or with sPC/gPC
2022-07-31 14:48:00 +02:00
Blaz Kristan
dde5367560 Default palette gamma fix.
Reverted to leds[] in SR effects.
Code optimisations.
2022-07-31 13:28:12 +02:00
ewowi
66da57f375 POC to use leds array in strip.set/getPixelColor 2022-07-31 12:38:10 +02:00
Blaz Kristan
d328db543e Bugfixes.
- gamma on *Color palettes
- gamma moved out of WS2812FX
- palette fade (JSON) fix
2022-07-30 23:58:29 +02:00
ewowi
c2c46f2843 Merge remote-tracking branch 'origin/segment-api' into LatestAndGreatest 2022-07-30 21:28:38 +02:00
Blaz Kristan
96da48ae82 1D mapping bugfix. 2022-07-30 15:03:06 +02:00
Blaz Kristan
eb9eda1f6d Transition struct (reduced RAM footprint). 2022-07-30 14:50:11 +02:00
Blaz Kristan
f16558c126 Optimisations. 2022-07-30 14:20:36 +02:00
Blaz Kristan
1abf0fc134 Deprecate EEPROM support (compile time option). 2022-07-30 11:04:04 +02:00
Blaz Kristan
b0ba1b2ecc Bugfix.
- defult transitions
- conditional 2D compile
2022-07-30 10:49:54 +02:00
ewowi
a70717f2f7 ssim2=ssim1 and ssim1=ssim0 (because off=0 is removed) 2022-07-29 23:30:23 +02:00
Blaz Kristan
5dec73f27c Merge branch 'mapping12soundsim' into live-merge 2022-07-29 22:59:00 +02:00
Blaz Kristan
92ac87fa3f Correction for conflict resolution. 2022-07-29 22:38:08 +02:00
Blaz Kristan
267239e3f2 Merge branch 'segment-api' into audioreactive-prototype 2022-07-29 22:29:15 +02:00
Blaz Kristan
52b863fe36 Memory allocation bugfix. 2022-07-29 20:24:29 +02:00
Blaz Kristan
79337a4568 Bugfix for palette transitions. 2022-07-29 16:26:15 +02:00
ewowi
84750e2605 Refactor um_data: remove fftBin 2022-07-29 15:50:09 +02:00
ewowi
dfa1a3ad90 Refactor um_data: remove inputLevel 2022-07-29 15:43:27 +02:00
ewowi
c1f9445e9d Refactor um_data variables for audio reactive
- change sample to sampleRaw
- add volumeSmth, volumeRaw, my_magnitude and calculate in agcAvg
- remove sampleAvg, soundAgc, sampleAgc, sampleRaw, rawSampleAgc, FFT_Magnitude, multAgc, sampleReal, sampleGain, (myVals), soundSquelch from um_data interface
- refactor all effects using above variables
2022-07-29 15:24:04 +02:00
Blaž Kristan
191db46c4f Code optimisation & cleanup.
Minor fixes.
2022-07-29 12:15:56 +02:00
ewowi
bc67bf6826 Replace myVals from audio_reactive.h to SEGMENT.data
(position in um_data reserved as free, could be cleaned up later)
2022-07-29 10:04:10 +02:00
Blaz Kristan
df534d30bf Custom palettes. 2022-07-28 23:19:58 +02:00
ewowi
ce99dbe40c liveview2D: only if isMatrix 2022-07-28 16:35:57 +02:00
ewowi
affcca8034 Improve liveview2D: add width and height > 256 leds 2022-07-28 16:13:31 +02:00
Blaz Kristan
a6f31a577a Merge branch 'segment-api' into audioreactive-prototype 2022-07-27 21:35:29 +02:00
Blaz Kristan
9b814f4ed8 Shadows and hides. 2022-07-27 21:12:27 +02:00
Blaz Kristan
3091440162 Reposition Scanner Dual FX. 2022-07-27 17:04:09 +02:00
Blaz Kristan
3b2573afed More filtering options.
Palette loading bugfix.
2022-07-27 17:00:55 +02:00
Blaz Kristan
1b64747c2b Quick effect filter. 2022-07-27 00:11:24 +02:00
ewowi
863212915c Revert "Merge branch 'segment-api' into origin/mapping12soundsim"
This reverts commit 8ef82ebdd7.
2022-07-26 11:23:51 +02:00
ewowi
8ef82ebdd7 Merge branch 'segment-api' into origin/mapping12soundsim 2022-07-26 11:08:26 +02:00
Blaz Kristan
78aad924c5 Bugfixes.
- moved simulateSound() to util
- effect fixes (name changes)
- mapping fixes
- default values fixes
- UI fixes
2022-07-25 21:31:50 +02:00
Blaž Kristan
24fda89665 Defaults cleanup. 2022-07-25 14:36:54 +02:00
Blaž Kristan
59cb9ba344 Revert 2D peek 2022-07-25 11:47:19 +02:00
ewowi
d511eb19ef Update with latest html_ui.h 2022-07-24 17:20:38 +02:00
ewowi
d3e9f51d6b Merge remote-tracking branch 'origin/segment-api' into segment-api 2022-07-24 17:13:13 +02:00
ewowi
e3499e5a70 Add 2D liveview (Peek 2D) - Beta version 2022-07-24 17:10:29 +02:00
Blaz Kristan
026425407e Adde more default options.
UI bugfix.
2022-07-24 16:21:29 +02:00
Blaz Kristan
18884111a6 Scrolling text center & letter M 2022-07-23 22:56:33 +02:00
Blaz Kristan
3e5b152718 Fix for palette defaults. 2022-07-23 22:38:35 +02:00
Blaz Kristan
8e9637f6d4 Default effect values. 2022-07-23 22:00:19 +02:00
Blaz Kristan
d11ad39048 Starburst fix. 2022-07-22 15:27:48 +02:00
Blaz Kristan
cb44d45eeb Merge branch 'dev' into segment-api 2022-07-22 14:41:39 +02:00
Blaz Kristan
c15ffca48c Merge branch 'master' into master-merge 2022-07-22 14:34:02 +02:00
Blaž Kristan
902c11d074
Merge pull request #2657 from poelzi/watchdog
Enable ESP watchdog by default
2022-07-22 09:26:46 +02:00
Blaž Kristan
35250677b9 Prevent I2S use for LEDs w/ Audioreactive on ESP32 2022-07-22 08:59:04 +02:00
Blaz Kristan
1f3a1a0a95 Stuck effect fix. 2022-07-21 20:18:48 +02:00
Blaž Kristan
38330b735c
Merge pull request #2723 from albarlow/BME280-Enhancements
BME280 Usermod Enhancements
2022-07-21 18:42:19 +02:00
Blaz Kristan
bda3c4ab7a Minor optimisations. 2022-07-21 18:38:07 +02:00
Blaz Kristan
d8d01ac353 Merge branch 'BME280-Enhancements' of https://github.com/albarlow/WLED into BME280-Enhancements 2022-07-21 18:37:17 +02:00
dependabot[bot]
51d935f419
Bump terser from 4.8.0 to 4.8.1 (#2726)
Bumps [terser](https://github.com/terser/terser) from 4.8.0 to 4.8.1.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-21 11:24:54 +02:00
albarlow
c96f83b076 Registered Usermod and Pins
Implemented PinManager and rerun setup of usermod after updating pins/

Registered in const.h and pin_manager.h   I tried to follow the existing formatting/numbering in these files.

Wrapped any strings I could in F()
2022-07-21 09:48:37 +01:00
Blaž Kristan
2fe4edb6df Segment clear bugfix.
getPixelColor fix.
2022-07-21 07:24:03 +02:00
albarlow
7308f5993c Added changelog 2022-07-20 22:53:45 +01:00
Blaz Kristan
1e4f8be74b Merge branch 'mapping12soundsim' into segment-api 2022-07-20 21:22:23 +02:00
albarlow
22ac12dc36 Remove compile-time variables and revamp readme.md 2022-07-20 13:06:27 +01:00
albarlow
866296fefd Update usermod bme280 rounding
Apply rounding per usermod settings
2022-07-19 22:15:26 +01:00
albarlow
9d574397bc usermod bme280
Added public variables to the BME280 usermod based on those in the Temperature usermod.  Only complication is that this usermod utilises different function calls depending on whether user defines celsius or not.  I have handled this for the temperature, but the Dew Point and Heat Index are relative to the temperature.

I've also addressed some areas where I'd previously assumed Celsius for reporting purposes as my test case is using Farenheit.
2022-07-19 21:47:56 +01:00
Blaz Kristan
b6e53b1a0c Minor bugfix and for loop optimization. 2022-07-19 22:14:46 +02:00
Blaz Kristan
a46894f395 Bugfixes. 2022-07-19 16:16:43 +02:00
albarlow
bee48dae7e Update readme 2022-07-19 14:52:39 +01:00
albarlow
e12f7b67e5 Usermod BME280 Enhancements
I added a Usermod interface for key settings.  I used a PinArray for the SDA/SCL pins, but you can't name these individually.

I have also made a display to show the temperature/humidity values in the web interface's Info screen.

I had to change the definition of those items in order to allow these new functions to work.  I have not noticed any negative side effects to this change.

At the moment, I've not figured out how to make Celsius/Farenheit toggleable due to the way the #define setup works.

Finally, I have added a routine to publish MQTT Discovery Topics for Home Assistant (toggleable in the Usermod screen).

I've been testing this on the only suitable device I have for a few months and haven't noticed any problems.
2022-07-19 14:52:10 +01:00
ewowi
c7ceeb1833 Tuning leftovers 2022-07-17 17:38:20 +02:00
ewowi
12f6ed621e Tuning of soundsim and mapping12 2022-07-17 17:17:51 +02:00
Blaz Kristan
d7daada42e Merge branch 'master' into dev 2022-07-17 16:18:44 +02:00
Blaz Kristan
6c6849d8d7 Vectors & dynamic loadJS.
- Segments
- Modes

NOTE: crashes ESP if effect is running while deleting segment.
2022-07-17 15:58:41 +02:00
ewowi
e82336f355 Small bugfixes 2022-07-14 17:22:37 +02:00
Blaž Kristan
1151b615a0 Fix for SEGLEN 2022-07-14 13:47:30 +02:00
Blaž Kristan
0cf891b9d9 Optimisations 2022-07-14 13:22:34 +02:00
ewowi
aeb8fd6fda make getPixelColor matrix (mapping) aware
And change some mapping defaults of effects useing getPixelColor
2022-07-13 15:40:40 +02:00
ewowi
615f807909 Regenerate html_ui.h 2022-07-13 12:45:23 +02:00
ewowi
985255afed Merge remote-tracking branch 'origin/segment-api' into mapping12soundsim 2022-07-13 12:44:43 +02:00
ewowi
9bec394d7f Add mapping12 and soundsim defaults to effects and apply in segment ui
index.js: rename setSliderAndColorControl to setEffectParameters, rename extras to effectPars, add segment variable update code
FX.cpp: add map12 and ssim defaults to data_FX_MODE variables (WIP)
FX_fcn.cpp: add return in setPixelColor for 2D
2022-07-13 12:41:33 +02:00
Blaz Kristan
8f72e0ab83 Reload presets on save. 2022-07-12 21:09:10 +02:00
ewowi
6799a3bd35 Merge remote-tracking branch 'origin/segment-api' into mapping12soundsim 2022-07-12 20:04:44 +02:00
Blaz Kristan
588c7a81fc Fix for transitions. 2022-07-12 18:10:07 +02:00
Frank
ce32ac19dd AR: better default values
gain =1 does not make much senses, at it means "0.0825"; 40 internally translates to "1". 60 seems to be a good start.
- Don't use ADC analog microphone as default, to avoid well-known conflicts with other stuff hooked up onto ADC1,
- re-enabled a forgotten delay (overlooked that in my last commit)
2022-07-11 14:30:03 +02:00
ewowi
16aa0e4dba Resolve compile fail 2022-07-11 11:39:56 +02:00
ewowi
81cb765b7a Finish merge by adding the mapping12 code to setPixelColor 2022-07-11 11:20:30 +02:00
ewowi
d5523615ef Merge branch 'refactor-ws2812fx' into mapping12soundsim 2022-07-11 11:05:49 +02:00
Frank
ff5d899a92 AR: gracefull suspend when under external control
- same fix as in SR-WLED upstream
- if strip.isupdating() is true for more than 12ms, run audio filter loop regardlessly. The userloop is very fast, so I'm expect no bad side-effects from this.
2022-07-10 22:47:42 +02:00
Blaz Kristan
d9f2c2b968 Segment API
- moved all drawing logic to segment
- moved transitions to segment
Conditional 2D compile.
Rearranged effect IDs.
Implemented dynamic effect arrays.
2022-07-10 22:23:25 +02:00
ewowi
2f6adbd07c Add Mapping 1D to 2D. Mapping12 and sound simulation effect independent
- add to segment: mapping 1D2D and Sound Simulation (WIP!)
- Add sound simulation WeWillRockYou
- All audio effects use segment soundSim
- Redefine SEGLEN: strip.getMappingLength (depending on mapping12)
- make setPixelColor aware of mapping12
2022-07-10 14:30:10 +02:00
Blaz Kristan
f0992d56c1 Added global I2C & SPI HW pin defines
Fixed default values fo custom sliders.
Fix for color selector.
Changed fading for 2D GEQ
Audioreactive fix send/receive option
2022-07-07 23:07:20 +02:00
Frank
67bcf42125
audioreactive: typo
oops.
2022-07-07 19:29:36 +02:00
Frank
935ddd12ec audioreactive: allow compiling with newer IDF versions
same as my last patch in original WLED-SR
2022-07-07 19:27:22 +02:00
ewowi
5a772f5410 add simulateSound to sound effects (wip) 2022-07-07 12:48:41 +02:00
Blaz Kristan
698a32f364 Cleanup effects. 2022-07-06 20:41:12 +02:00
Blaz Kristan
bdea2acf67 Correctly position #defines 2022-07-06 19:49:55 +02:00
Blaz Kristan
377a11b160 Fix for enable/disable FFT task. 2022-07-06 19:46:32 +02:00
Blaz Kristan
9519c8edbd Fix disbling AudioReactive usermod
Reduce IRAM pressure for ESP8266
2022-07-06 19:42:48 +02:00
Blaz Kristan
64fd207533 Refactoring WS2812FX class.
- effect functions no longer part of class
- methods to access private members
- separate Segment, Segment_runtime, ColorTransition from WS2812FX
2022-07-06 13:13:54 +02:00
Frank
96e04f1c54 AR: option to use new (template-based) ArduinoFFT
Additonal build_flags: -D UM_AUDIOREACTIVE_USE_NEW_FFT
Additional lib_deps: https://github.com/kosme/arduinoFFT#develop @ 1.9.2
2022-07-04 17:09:20 +02:00
Blaz Kristan
348c4b4431 Fix for 2D peek. 2022-07-04 14:13:17 +02:00
Frank
bfbff723ac AR: use more accurate timer for benchmarking
use  esp_timer_get_time() because it is more accurate. Actually I don't trust millis() so much ;-)
2022-07-04 13:58:25 +02:00
Frank
03dba4d7d0 restoring a few doubles
a few doubles are currently necessary, due to high speed of the control loops (see discord discussion).
2022-07-04 12:34:32 +02:00
Blaz Kristan
febd7cbca8 Enable Peek for 2D. 2022-07-04 11:12:55 +02:00
Blaz Kristan
e2b7b228c5 Compile fix.
Use virtualLength() in getPixelColor()
2022-07-04 10:30:49 +02:00
Blaz Kristan
8b58d96aea Float variables instead of double. 2022-07-03 23:00:32 +02:00
Blaz Kristan
0a2e01a616 Multiple changes:
- change arduinoFFT to float (custom)
- update audioreactive to use float
- update effects to use float
- info slider (usermod)
- hide Peek in 2D
- minor bugfixes
2022-07-03 22:55:37 +02:00
Blaz Kristan
a8908238d5 Prevent race condition when saving bus config.
(loop() is executed on different core than handleSet())
2022-07-02 14:28:09 +02:00
Blaz Kristan
569138ac80 Bugfix saving LED config (race condition) 2022-07-01 14:10:32 +02:00
Blaz Kristan
cf3faa1170 Merge branch 'audioreactive-prototype' into 2D-support 2022-06-29 16:30:50 +02:00
Blaz Kristan
ae50374d55 Prevent analog button from working.
If analog input selected.
2022-06-29 14:12:07 +02:00
Blaz Kristan
d2705f033d Enhance API
- addPixelColorXY()
- fadeToBlackBy()
2022-06-28 23:32:29 +02:00
Blaz Kristan
5d12e2291c Bugfix in getPixelColorXY() 2022-06-28 23:01:52 +02:00
Blaz Kristan
cd46d84dcb Shuffle tooltips. 2022-06-28 12:36:23 +02:00
Blaz Kristan
a3b0b8b3d0 Change on/off button for Sataicase usermod. 2022-06-28 12:33:00 +02:00
Blaz Kristan
4c60a70c6f Slider div change.
Effect data bugfix.
2022-06-27 22:46:36 +02:00
Blaz Kristan
a75b3a53aa Use getModeCount() instead of MODE_COUNT
Clear strip if spacing changes.
Rewrite 2DGEQ.
2022-06-26 23:01:22 +02:00
Blaz Kristan
94a79b57e9 Tooltips for effect sliders. 2022-06-26 22:47:16 +02:00
Blaz Kristan
dbe90eb3f5 Minor UI fixes. 2022-06-23 21:00:12 +02:00
Blaz Kristan
3891348c26 Multiple fixes.
- anti-aliasing fix
- minor UI CSS fix
- dynamic JS loading (2D & UM)
- 2D Lissajous fix
2022-06-23 17:42:02 +02:00
Blaz Kristan
84106d6282 Merge branch 'dev' into audioreactive-prototype 2022-06-22 18:04:40 +02:00
Blaz Kristan
37395931bf Merge branch 'master' into master-merge 2022-06-22 16:11:09 +02:00
Blaz Kristan
88e487be8e Fix for Colortwinkles. 2022-06-22 16:08:14 +02:00
Blaž Kristan
fd4c0e795a
Merge pull request #2693 from softhack007/analogread_smoothing_fix_2587
noise filter for potentiometer reading - fix for issue #2587
2022-06-22 13:20:16 +02:00
Frank
c79eb43347 disabled second check for strip.isUpdating()
commented out the second `strip.isUpdating()` check, because it should not be neccesary; Strip.service() is called after handleIO()/handleButton().
2022-06-22 12:36:47 +02:00
Blaž Kristan
860e74bffa Comment & float constant. 2022-06-22 09:58:21 +02:00
Blaz Kristan
4c759083be Multiple changes.
Added:
- introduced addEffect() and setupEffectData()
- conditional compile for audio effects
- introduced getModeData() and getModeDataSrc() instead of public var
- changed _modeData[] to private non-static

Fixes:
- DMTYPE use
- add reboot info to DMTYPE
- transpose & reverse with mirroring
2022-06-21 22:49:45 +02:00
Blaz Kristan
d3bb079be4 Muliple enhancements:
- Smarter on/off buttons in Info panel (usermods)
- On/Off bus in bus_manager
- 2D GEQ fix (2D CenterBars obsolete)
- hide unused palettes & modes
2022-06-20 22:17:01 +02:00
Frank
ed374684a6 Update button.cpp
overlooked one
2022-06-20 22:00:23 +02:00
Frank
169a46c38c button.cpp: marked literal constant as "float! 2022-06-20 21:56:16 +02:00
Frank
1dbea434a3 fix for issue #2587 2022-06-20 16:04:43 +02:00
Hendrik Langer
a5b4d7a244 add TM1829 support 2022-06-20 15:03:17 +02:00
Blaz Kristan
7ebb58b1fa Code shuffling (making bugs) 2022-06-19 19:15:34 +02:00
Blaz Kristan
ac5b3110f2 Code cleanup (reduced globals). 2022-06-18 12:57:54 +02:00
Blaz Kristan
48259b4ffe Reorganised exchange array.
Updated effects to reflect reorganisation.
Provide feedback to UI for maxVol and binNum.
2022-06-18 12:36:10 +02:00
Blaz Kristan
041426fecb Scrolling text selectable font. 2022-06-17 21:19:12 +02:00
Blaz Kristan
2caf7efdc6 Added date & time support for scrolling text. 2022-06-17 19:09:44 +02:00
Blaz Kristan
b00e038b33 Enhancement in effect functions.
- added color_add()
- fixed AA setPixelColor()
- added fadeToBlackBy() (FastLED)
- added hiding of * palettes if not all color selectors shown
2022-06-17 18:57:32 +02:00
Blaz Kristan
36503f0417 Fix CRLF 2022-06-17 16:24:25 +02:00
Blaz Kristan
0daddf9896 Some fixes.
Remove (*) palettes if not all 3 color selectors shown
Updated comments
2022-06-17 16:18:35 +02:00
Blaz Kristan
f3364e1327 Scrolling text #DATETIME bugfix.
Cosmetic changes.
2022-06-16 21:52:14 +02:00
Blaz Kristan
cf54115077 Sync bug fixes.
Analog input fix.
Code cleanup.
2022-06-16 19:20:04 +02:00
Blaz Kristan
12a94c50b8 Various fixes.
Added support for no audio to some effects.
2022-06-16 16:10:38 +02:00
dependabot[bot]
0dd12cf0a6
Bump bottle from 0.12.19 to 0.12.20 (#2683)
Bumps [bottle](https://github.com/bottlepy/bottle) from 0.12.19 to 0.12.20.
- [Release notes](https://github.com/bottlepy/bottle/releases)
- [Changelog](https://github.com/bottlepy/bottle/blob/master/docs/changelog.rst)
- [Commits](https://github.com/bottlepy/bottle/compare/0.12.19...0.12.20)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-16 10:31:14 +02:00
Blaž Kristan
f92c336ae4 Fix for fftCalc 2022-06-16 07:47:58 +02:00
Blaz Kristan
477c9ef577 Cosmetic fixes. 2022-06-15 22:17:34 +02:00
Blaz Kristan
e146a476bd Effect ID compatibility with WLED-SR
Updated some SR effects.
2022-06-15 17:21:32 +02:00
Blaz Kristan
45e74126da Non-2D audio effects. 2022-06-14 18:16:18 +02:00
Blaž Kristan
f32a39e79f Finalised used variables in effects 2022-06-14 14:48:13 +02:00
Blaž Kristan
489b144085 Overload temporary fix.
Non-audio SR effects.
2022-06-14 12:06:51 +02:00
Blaž Kristan
e7d311d23c I2S SD pin output type fix 2022-06-14 11:26:52 +02:00
Blaž Kristan
4cc2dea2fe color_add() that preserves color ratio
AA version of setPixelColor(float)
Fix in AA ratio calculation.
2022-06-14 09:11:56 +02:00
Blaz Kristan
1e2cae7087 W fix. 2022-06-13 22:13:04 +02:00
Blaz Kristan
2b259f3704 Usermod API enhancements
- data exchage getUMData()
- usermod configuration helper appendConfigData()
- notification on updates onUpdateBegin()
2022-06-13 22:11:55 +02:00
Blaz Kristan
0df5221784 Normalised/antialiased setPixelColorXY() 2022-06-13 21:55:51 +02:00
Blaz Kristan
4c78d35680 Fix CRLF. 2022-06-13 21:29:08 +02:00
Blaz Kristan
cdef8472e3 Gav... efects to test audio
Anti-aliased setPixelColor() with support for normalized x & y
2022-06-13 21:28:10 +02:00
Blaz Kristan
f9c933bf3b AudioSource classes cleanup 2022-06-13 17:34:49 +02:00
Blaz Kristan
cc995ecef8 2D Waverly audio reactive. 2022-06-12 22:17:17 +02:00
Blaz Kristan
922a3631ae Fixed order of loading. 2022-06-12 15:09:15 +02:00
Blaz Kristan
0903078618 Execute GetV() after cfg.json is loaded. 2022-06-12 14:02:49 +02:00
Blaz Kristan
8c759cb65a Usermod config info & data. 2022-06-11 18:55:23 +02:00
Blaz Kristan
bd45c67528 Virtual fixes.
Pins.
2022-06-11 12:35:29 +02:00
Blaz Kristan
562a206508 It compiles!
Cleaned (and possibly broken) AudioSource
Added:
- usermod notification about update
- strip.getMinShowDelay()
- pin manager updates
Changed:
- data exchange
2022-06-11 00:50:29 +02:00
Blaz Kristan
dd584e929f Added audioreactive to usermod_list
Formatting in usermod
2022-06-10 16:37:55 +02:00
Blaz Kristan
1828a2a81c Addec config save/load.
Changed double to float.
2022-06-09 18:55:35 +02:00
Blaž Kristan
a6746f77f0 Var fixes. 2022-06-09 14:44:48 +02:00
Blaz Kristan
184ff7a3b3 Audioreactive usermod. 2022-06-08 21:14:01 +02:00
Blaz Kristan
9db872db56 Fixes:
- mirroring
- FX memory allocations
- preset loading if WS request too big

Changes:
- remove "pt" in favor of "ps" in JSON
- fading in Ghost rider
2022-06-05 10:16:56 +02:00
Blaz Kristan
f1a1b89d13 Fixes.
- correct preset cycling
- updated rotary encoder preset selection
2022-06-03 22:22:18 +02:00
Blaz Kristan
14e0e96596 Send complet preset API from UI.
Cycling value correction (optimisation and preset hack removal).
2022-06-03 18:38:46 +02:00
Blaz Kristan
793c878c66 Added display information for hue/sat/preset/cct 2022-06-02 18:30:23 +02:00
Blaz Kristan
14887d5e88 Multiple fixes.
- non matrix bugs in legacy effects
- preset loading (cycling)
- segment length in UI
- possible WS heap corruption prevention
2022-06-01 22:11:25 +02:00
Blaz Kristan
366006273d Watchdog timer (@poelzi).
Transpose optimisations.
Rain effect updated.
2022-05-30 22:21:13 +02:00
Blaz Kristan
6a69a726f2 Build bump. 2022-05-29 18:34:59 +02:00
Blaz Kristan
e9cd4d95a7 Merge branch 'master' into master-merge 2022-05-29 18:22:33 +02:00
Blaz Kristan
d7e1dc1f95 Revert speed for Fire.
Segment brightnes +/- fix.
2022-05-29 18:20:30 +02:00
Blaž Kristan
19c8b4fe2d
Merge pull request #2665 from Stoom/segment_bri_fix
🐛 fix(json): allow for using `~-16` or `~16` when setting a segments brightness though the JSON api
2022-05-29 11:02:59 +02:00
Blaz Kristan
8b73a7375a Fix for transpose.
blur1d() using weighted box blur.
2022-05-28 19:23:16 +02:00
Blaž Kristan
974798f79c
Merge pull request #27 from srg74/patch-1 2022-05-28 07:43:21 +02:00
srg74
43c5de074f
Update usermod_temperature.h
Typo in line 149
2022-05-27 15:42:03 -04:00
Blaz Kristan
461cc1d5a8 Fix for stalled scrolling text.
Minor other fixes.
2022-05-27 15:29:34 +02:00
Blaz Kristan
3d6df07335 Bugfixes in 2D.
PIR stops countdown if preset changed.
2022-05-27 13:39:22 +02:00
Blaz Kristan
7689587879 New 2D Drift Rose effect.
Fix for segment name.
Updated blurRow & blurCol to work on non-leds[].
Updated several legacy effects to be 2D aware.
Code cleanup.
2022-05-26 21:36:48 +02:00
Blaz Kristan
e248b989e1 2D Scrolling text
Updated Glitter & Sparkle
2022-05-25 21:15:08 +02:00
Blaz Kristan
9920424a31 Polar Lights fix.
Cleanup.
2022-05-24 16:43:21 +02:00
Blaz Kristan
17be0a2c12 Enhance rotary encoder with custom sliders.
Soft watchdog timer (by poelzi)
2022-05-24 13:45:35 +02:00
Daniel Poelzleithner
26fa38d052 Watchdog: disable watchdog while OTA is running 2022-05-23 22:30:13 +00:00
Blaz Kristan
34a4382920 Effect fixes. 2022-05-23 21:04:16 +02:00
Blaz Kristan
e7c9b5a4f0 2D Fireworks (enhanced 1D version).
Transposed Fire 2012 on matrix.
2022-05-22 17:20:06 +02:00
Blaz Kristan
8c31904838 Updated rotary encoder ALT to support modes array. 2022-05-22 12:56:01 +02:00
Blaz Kristan
d522b608d3 Finally fix for Crazy Bees. 2022-05-22 12:32:38 +02:00
Blaz Kristan
3e7303c15c Possible fix for Crazy Bees.
Code cleanup.
2022-05-22 12:00:27 +02:00
Blaz Kristan
6e342983f9 It did not like PROGMEM. 2022-05-22 00:41:45 +02:00
Blaz Kristan
a6d7ed3824 Moved mode names (& slider data) to a static array
-- may break some things --
2022-05-21 18:37:09 +02:00
Blaz Kristan
e003ec39fb Transpose fix for XY()
Slight internal API change.
Renamed c1x,c2x,c3x to custom1, custom2, custom3 to be in line with SR.
2022-05-21 13:19:11 +02:00
Blaz Kristan
62abc63f7a Removed static vars to support segments. 2022-05-20 22:29:47 +02:00
Blaz Kristan
0955480f5b Build bump. 2022-05-20 19:51:46 +02:00
Blaz Kristan
bf76affd06 Fix for missing palettes. 2022-05-20 19:44:06 +02:00
Blaz Kristan
b4d6525899 Added new 2D effects:
- 2D Floating Blobs
- 2D Ghost Rider
Crash fix for 2D Game of Life.
Added support function fill_circle() & wu_pixel().
Removed obsolete debug strings.
2022-05-20 19:35:22 +02:00
Blaz Kristan
ba3555a66f 2D Game of Life update.
Added crc16().
Reduced errorToast popup time.
Fixed drawLine() incorrect uint16_t use and added leds[] support.
2022-05-20 14:48:40 +02:00
Blaž Kristan
d8be286831
Merge pull request #24 from lost-hope/2D-support 2022-05-20 07:15:45 +02:00
lost-hope
65f5bc531c Added line drawing function based on Bresenham 2022-05-19 22:49:04 +02:00
Blaz Kristan
3ba4702181 2D crazy bees. 2022-05-19 18:57:23 +02:00
Blaz Kristan
ad9c42e832 2D Spaceships. 2022-05-19 18:27:04 +02:00
Blaz Kristan
0368d3be59 Some fixes.
Tried removing leds[] for some effects.
2022-05-19 17:01:52 +02:00
Blaz Kristan
598549b5fb Additional 2D effects. 2022-05-19 11:29:04 +02:00
Blaz Kristan
49086a3ae0 2D heartbeat/ECG. 2022-05-18 21:47:48 +02:00
Blaz Kristan
4676a7aa62 Merge branch 'dev' into 2D-support 2022-05-18 19:50:19 +02:00
Blaz Kristan
7d25b234d5 Temperature usermod HA autodicovery. 2022-05-18 19:49:49 +02:00
Blaz Kristan
c6578870f0 PWM fan JSON API control. 2022-05-18 19:46:31 +02:00
Blaz Kristan
4e8030bd81 Bugfix.
- centered Settings buttons
- disallow preset ID >250
2022-05-18 14:38:22 +02:00
Blaz Kristan
094e130544 slight mod for 2Ddrift 2022-05-11 18:25:19 +02:00
Blaz Kristan
879fd5a13d Hide 2D modes in UI if not a matrix set up. 2022-05-11 12:29:46 +02:00
Blaz Kristan
c2bb49aca0 Messed up again. 2022-05-11 09:55:23 +02:00
Blaz Kristan
9ed14b6e8c Incorrect mode params fix.
Variable eye width in Halloween Eyes.
2022-05-11 09:53:40 +02:00
Blaz Kristan
4484721a9f 2D Haloween eyes
Misc fix.
2022-05-11 09:37:38 +02:00
Blaz Kristan
4963a5797b Corrected slider names & options for 2D effects. 2022-05-10 21:41:20 +02:00
Blaz Kristan
13f5798ed4 blur2D & other bugfixes 2022-05-10 10:37:27 +02:00
Jamie Stoom
db8e1dec3e 🐛 fix(json): allow for using ~-16 or ~16 when setting a segments brightness though the JSON api 2022-05-09 18:06:45 -07:00
Blaz Kristan
c9bdecdb69 API change.
New SR effects.
Bugfixes.
2022-05-10 00:35:26 +02:00
Blaz Kristan
adb7726974 Bugfixes.
- removed IS_ macors
- replaced .options with getOptions()
- Fire2012 matrix fix
2022-05-09 16:15:07 +02:00
Blaz Kristan
d6883d0c1c Added CRGB variant for setPixelColor() 2022-05-09 11:11:25 +02:00
Blaz Kristan
b2409ac708 Bugfix in vertical panel ledmap generation.
2D implementation of Fire 2012
2022-05-09 11:04:11 +02:00
Blaz Kristan
cf189663a7 Segment width & height fix.
Auto 2D segment.
2022-05-08 14:28:02 +02:00
Blaz Kristan
f0d36fd769 WLED 2D matrix support.
- Added 2 sample effects to UI.
- 2D segment details.
- 1D effect upscaling to 2D.
- 2D setPixelColorXY() and other utility functions
- Arbitrary panel position & oritentation.
- 2D settings with physical to logical mapping.
- Bump version.
2022-05-08 10:50:48 +02:00
Daniel Poelzleithner
213e3e998a Enable ESP watchdog by default
Use the ESP watchdog to detect hanging ESP and reset the firmware.
Can be disable by defining WLED_WATCHDOG_TIMOUT 0
Default timeout is 3 seconds on ESP32 and 8 seconds on ESP2688
2022-05-05 11:33:00 +00:00
Luke Plassman
bef9c68f81
Working DMX Libraries (#2652)
* added SparkFunDMX library dependencies

* changed variable names to avoid conflicts with SparkFunDMX library

* board version checks

* minor changes to DMX

* fix brightness when no shutter DMX channel is set

* fix compile issue on newer ESP32 variants
2022-05-05 02:28:09 +02:00
ChuckMash
099d2fd03d
WiZ Lights usermod - Adding more options and features (#2638)
* Update wizlights.h

adds new features and options for wizlights usermod

* Update wizlights.h

Change how IPs are numbered.
Non-programmers incorrectly start counting at 1

* Update wizlights.h

updated default cold white enhanced white setting to a lower value.

* Update wizlights.h

added logic for connection check before UDP sending.
Seems more important for ESP32

* Update readme.md
2022-05-03 12:18:21 +02:00
Blaz Kristan
9f71a6ab18 Arduino OTA lock fix. 2022-05-01 22:09:40 +02:00
Blaz Kristan
e088f7a552 PIN code field focus on load. 2022-05-01 10:27:26 +02:00
Blaz Kristan
2e6ce0481c Allow swapping of W channel for RGBW LEDs.
Backporting fix.
2022-04-30 12:45:38 +02:00
Blaz Kristan
23d39e5366 Compile time options for Multi Relay & PWM Fan 2022-04-29 09:56:48 +02:00
Blaz Kristan
279664a578 Added compile time PWM fan pins.
Updated readme
2022-04-29 09:52:45 +02:00
Blaz Kristan
2a3d128f3c Default pins for Multi-Relay.
Update page fix.
2022-04-28 22:31:09 +02:00
Blaz Kristan
9667365d9e Optional HSV sliders instead of color wheel.
PIN code optimizations & fixes.
2022-04-27 12:31:47 +02:00
Blaz Kristan
d4ef26e0f3 HSV sliders option instead of color picker. 2022-04-26 22:16:08 +02:00
Blaz Kristan
a053e81797 Minor fixes. 2022-04-24 19:47:55 +02:00
Blaz Kristan
1494bfe855 Fix for non-websockets build.
Cleanup.
2022-04-24 19:30:14 +02:00
Blaz Kristan
f1a4ba4e76 Restore preset upon playlist end option. 2022-04-20 18:05:59 +02:00
Blaz Kristan
385c526414 Added new holidays. 2022-04-19 17:16:07 +02:00
Blaz Kristan
5e95e02429 Missing segpwr configuration. 2022-04-18 22:59:32 +02:00
Blaz Kristan
3081802b1c Minor UI fix.
- keep .staytop/.staybot sticky
- .fnd inheritance
2022-04-17 12:01:44 +02:00
Blaz Kristan
1663601dcb UI fixes.
- correct load sequence
- incorrect power on repeated segments
- update button
- fix for find icon
- connection icon colors
2022-04-17 11:13:13 +02:00
Thomas
1a513c7bbf
wled.cpp: Wrap Serial calls in #ifdef WLED_ENABLE_ADALIGHT. (#2630)
handleImprovPacket() unconditionally gobbles serial data which a problem
if we want another feature to consume it. This patch uses the same guard
as the existing call in `handleSerial()`.

Co-authored-by: Thomas Fubar <FUB4R@users.noreply.github.com>
2022-04-17 00:08:27 +02:00
Blaz Kristan
92cbdde429 Cleanup. 2022-04-16 16:31:00 +02:00
Blaz Kristan
0f6b1e4ae1 Synchronus applyPreset() from HTTP JSON API call.
Bugfix for HTTP API preset.
WS multiple broadcast fix.
Turning segment on/off will not reset currentPreset/cause stateChanged.
2022-04-16 16:28:43 +02:00
Blaz Kristan
f915201a27 Cleanup. 2022-04-12 16:08:17 +02:00
ChuckMash
d1f76042e1
bugfix for outgoing serial TPM2 message length (#2628)
bugfix for outgoing serial TPM2 message length
2022-04-12 10:20:08 +02:00
Blaz Kristan
845aa733b7 Bugfixes.
- auto segments selected
- slider data aded to data-opt
2022-04-11 22:18:44 +02:00
Blaz Kristan
a0e318827d Hide custom sliders by default. 2022-04-11 15:14:47 +02:00
Blaz Kristan
39720a11dc Fix empty space at the bottom. 2022-04-10 20:58:41 +02:00
Blaz Kristan
da33bf3438 Revert namelabel. 2022-04-10 20:05:14 +02:00
Blaz Kristan
eda6f134a9 Moved effect sliders to bottom.
Implemented custom effect parameters.
2022-04-10 11:02:57 +02:00
Blaz Kristan
46e1c8ef73 Update WS on exit of live mode. 2022-04-08 20:11:34 +02:00
Blaz Kristan
f247139f1c Bugfixes.
- prevent changing main segment during live
- PIN code entry validation
- UI CSS fixes
2022-04-07 21:54:55 +02:00
Blaz Kristan
566985cf72 Add preset (name) UI bugfix.
Close modal button.
2022-04-06 05:45:39 +02:00
Blaz Kristan
70b4cdf520 Merge branch 'master' into merge-master 2022-04-04 21:16:18 +02:00
Blaz Kristan
081f211231 Merge branch 'master' into merge-master 2022-04-04 20:52:42 +02:00
Christian Bartsch
9cd8acab43
Usermod: Add support for Si7021 temperature and humidity sensors (#2617)
* added first version (work in progress)

* added some sensors to publish

* typo

* added dependency

* mqtt si7021_* names + don't  retain

* timer to 60 s

* some changes to HA auto discovery

* added config entries (no function yet)

* renaming

* made configs work

* added getId()

* refactoring + wrong mqtt topics fixed

* retain HA auto discovery

* do not spam serial console on each sensor update

* added readme

* add update interval info

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-04-03 22:30:37 +02:00
4lloyd
8b79a9708b
Next universe overflow and Art-Net DMX start address (#2607)
* Improve calculation LEDs in next universe

* Fix Art-Net DMX start address
2022-04-03 17:52:36 +02:00
Blaz Kristan
969acbd47f UI & CSS bugfix. 2022-04-02 19:18:54 +02:00
Blaz Kristan
31012671c5 UI sliding bugfix. 2022-04-02 07:42:04 +02:00
cschwinne
e362b3b6aa Fixed sunset time off by an hour on DST change day (fixes #2603) 2022-04-01 02:07:50 +02:00
Christian Schwinne
d2ced93e58
Merge pull request #2601 from Aircoookie/minseg-udp
UDP on main segment only.
2022-04-01 01:24:13 +02:00
cschwinne
958cd35e21 Live mainseg improvements
Make override work in mainseg mode
Move unfreeze on turn on from UI to JSON parser
Fix mainseg not unfreezing on timeout
2022-04-01 00:59:19 +02:00
Blaz Kristan
73e898773b Minor fixes.
- reversed condition for simplified UI
- removed duplicate code
2022-03-31 21:44:11 +02:00
Spectre
46eae410c3
add My9291 light bulb driver (#2599)
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-03-31 20:49:00 +02:00
Stefan Riese
73a9e1c316
V2 usermod for wordclock with 11x10 LEDs and 4 minute dots (#2608)
* - implement V2 Usermod to handle wordclocks with 11x10 pixels and 4 additional dots for the minutes

* - fix wording issue for "six"
-

* - add some more comments

* - fix issue with "zwölf"
2022-03-31 20:31:37 +02:00
cschwinne
03862d4b6c Add icon font 2022-03-28 23:23:38 +02:00
Blaz Kristan
557a2f08f7 Power off. 2022-03-28 23:08:29 +02:00
Blaz Kristan
ae90aa4ccc Power off. 2022-03-28 23:07:37 +02:00
Blaz Kristan
6eff2e6e74 Missing .h 2022-03-28 22:43:51 +02:00
Blaz Kristan
955bb51f11 Freeze/unfreeze for mainseg UDP. 2022-03-28 22:36:58 +02:00
Blaz Kristan
b583def913 Using freeze instead of power for segment.
Fix for missing udp.cpp
2022-03-28 20:44:49 +02:00
dependabot[bot]
dd85da053f
Bump minimist from 1.2.5 to 1.2.6 (#2602)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-28 09:44:17 +02:00
Blaz Kristan
ba6a01408d UI tweaks & optimizations. 2022-03-26 23:22:18 +01:00
Blaz Kristan
81d880fb4e Global Auto-calculate white override. 2022-03-26 23:20:14 +01:00
Blaz Kristan
bdbce67473 Movable segment power.
UI CSS fixes.
2022-03-25 20:30:29 +01:00
Blaz Kristan
6079effae3 UDP on main segment only. 2022-03-25 17:20:41 +01:00
Blaz Kristan
41aa1ee318 Use UDP live/realtime data on main segment only.
Includes Adalight revert, CSS optimizations and setPixelColor() refactoring.
2022-03-25 16:36:05 +01:00
Woody
8d2fe315db
Fix cross-origin error in File Mode (#2585)
* fixed cross-origin error

* removed unnecessary code

* try/catch for parent WS

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2022-03-24 12:17:10 +01:00
Eduardo Ibanez
22c3ac5be3
Add usermode to control Wiz lights (#2595)
* Add usermode to control Wiz lights (#1)

* Fix inclusion in usermods list

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2022-03-23 16:20:18 +01:00
cschwinne
a517f0df1d Add ESP32-ETHERNET-KIT-VE type 2022-03-20 22:12:18 +01:00
Blaz Kristan
c14f16bdf1 Merge branch 'master' into master-merge 2022-03-19 21:05:28 +01:00
cschwinne
9c9854b6bf Fixed sunrise/set calculation 2022-03-19 19:27:32 +01:00
cschwinne
d280e16723 Fixed /json/cfg unable to set busses (fixes #2589) 2022-03-19 14:21:14 +01:00
cschwinne
b93a9cb8bc FIxed liveview 2022-03-18 14:24:10 +01:00
cschwinne
8601052179 Fixed liveview buffer over-write (fixes #2586 )
(with odd LED counts > 256)
2022-03-18 14:08:37 +01:00
cschwinne
eaa20ff4bf Add handleOverlayDraw() to example v2 usermod 2022-03-16 19:32:11 +01:00
Blaž Kristan
e4c6e4bc48
Merge pull request #2584 from tonyn0/master
DDP in AP mode.
2022-03-16 17:31:09 +01:00
Blaž Kristan
c52597205e
Merge branch 'master' into master 2022-03-16 17:29:12 +01:00
Blaz Kristan
eee9de8271 Bumped build. 2022-03-16 17:14:37 +01:00
tonyn0
c73033c0b4 udp.cpp update
added ap check for ddp in L657
2022-03-16 11:00:29 -05:00
Blaž Kristan
aecfa3ff0f Merge branch 'master' into master-merge 2022-03-16 08:52:48 +01:00
Blaž Kristan
18f575bee4 Merge branch 'dev' into master-merge 2022-03-16 07:13:27 +01:00
cschwinne
522e752582 Add ability to skip up to 255 LEDs (#2342) 2022-03-16 01:45:07 +01:00
SpeakingOfBrad
854ed8cfa9
ABL milliamps no longer hardcoded to 850 at runtime (#2581) 2022-03-16 00:35:49 +01:00
SpeakingOfBrad
4642205768
Optionally set led strip color order at runtime. (#2582) 2022-03-16 00:17:49 +01:00
André Klitzing
40dbfbe092
Update IRremoteESP8266 to 2.8.2 (#2579)
This fixes some C3 issues
2022-03-16 00:16:49 +01:00
Blaz Kristan
7882519c0e Bugfix.
- expand preset
- button factory reset
- PIO library
2022-03-15 22:16:48 +01:00
Blaž Kristan
0234017ca1 Merge branch 'master' into master-merge 2022-03-15 09:55:23 +01:00
cschwinne
6c315e5a9c 0.13.1
Fix persistent preset bug
2022-03-15 03:45:20 +01:00
cschwinne
ef0f91d8d0 Release of WLED v0.13.0 2022-03-15 02:28:26 +01:00
cschwinne
9552784e72 Remove persistent argument from savePreset()
(fixes temp preset not applicable by APIs)
Default to 5Mhz hardware SPI driving (#2558)
2022-03-14 20:53:00 +01:00
Blaz Kristan
ac20d7f302 UI updates.
- optional show/hide segment power
- skinnable sliders
- changed some CSS to be more to @aircoookie's liking
2022-03-14 20:22:20 +01:00
SpeakingOfBrad
f068327307
Add option to set module name at runtime, and add extra examples in platformio_overrides.ini (#2578)
* Added option to set the name of the module at runtime.

* added example how to set number of LEDs at runtime

* Example to enable/set IR remote type at runtime

* Clarification on how to use platformio_overrides

* Example for setting abl milliamp limit at runtime

* Corrected example set LED count
2022-03-14 18:23:53 +01:00
cschwinne
1bc698ae78 Button 0 long press factory reset
JS simplification
2022-03-14 12:26:45 +01:00
Blaz Kristan
3f6691dcd5 Easter egg added. 2022-03-13 14:04:29 +01:00
Blaz Kristan
31981b9080 Fix compile for ST7789 display usermod. 2022-03-13 09:30:51 +01:00
Blaz Kristan
167d29c39f RGB selector bugfix. 2022-03-12 21:25:39 +01:00
Blaz Kristan
28b78c2b27 Select/unselect all segments chekmark.
CSS fixes.
2022-03-12 18:03:00 +01:00
Blaz Kristan
b3d691fff6 Select/deselect all segments.
CSS optimisations & fixes.
2022-03-11 23:38:50 +01:00
Blaž Kristan
8e5f2d91e8 Added hasRGB() and hasWhite() methods to Bus class 2022-03-11 12:20:48 +01:00
Blaž Kristan
cfa7f60e5f Merge branch 'master' into master-merge 2022-03-11 11:33:35 +01:00
Blaž Kristan
e0fcaa6103 Merge branch 'master' into master-merge 2022-03-11 11:28:02 +01:00
cschwinne
1b2134d7a8 Add old blinds usermod 2022-03-11 09:20:01 +01:00
cschwinne
f922268af7 Remove unneeded brightness set in live Serial 2022-03-11 08:41:01 +01:00
Blaz Kristan
841a9f8082 Searchable presets.
Inline sin_gap().
Prevent live timeout.
2022-03-10 22:36:09 +01:00
cschwinne
4865ddb377 Fix realtime mode disabled by brightness change
Fix realtime mode not working immediately at turn on
Fix individual segment control not working immediately at turn on
2022-03-10 20:40:48 +01:00
cschwinne
a556732e4f Add ability to set presets from DMX
(effect mode with single channel)
2022-03-10 12:13:12 +01:00
cschwinne
0ea31cb088 Fix indefinite realtime terminated by new packet (fixes #2356 )
Add custom Aircoookie fork of ESP32 core (reduces bin size by >100kB)
2022-03-10 11:20:39 +01:00
Blaz Kristan
06fe7323eb Fix for palettes. 2022-03-09 19:03:39 +01:00
Blaz Kristan
d8d9259c36 Comment fix. 2022-03-09 18:21:52 +01:00
Blaz Kristan
261260b232 Fix for non-W segment. 2022-03-09 15:31:31 +01:00
Blaž Kristan
5b88894638 Reintroduction of per bus auto white calculation.
JS/CSS UI optimizations.
2022-03-09 13:39:51 +01:00
Blaz Kristan
ddadaa828a Merge branch 'master' into master-merge 2022-03-08 22:46:50 +01:00
Blaz Kristan
a3cd10d83b Reverse proxy WSS support. 2022-03-08 16:16:07 +01:00
cschwinne
b626c7620e Disabled auto white mode in segments with no RGB bus 2022-03-08 02:16:33 +01:00
cschwinne
5d90d8930e Fix non-0 terminated hostname str 2022-03-07 20:37:48 +01:00
PLCHome
b01309c3bf
Mixed content exception in web browser in websocket communication on peek behind an https backproxy. (#2571)
"ws://" must be the change to the "wss://" for encryption
2022-03-07 18:26:53 +01:00
Blaž Kristan
2d1511b5dd Fix incorrect isRgbw use 2022-03-07 09:50:33 +01:00
Blaž Kristan
e561304645 Merge branch 'master' into master-merge 2022-03-07 09:44:35 +01:00
cschwinne
961d5591bd Fixed Popcorn mode not lighting first LED on pop 2022-03-07 00:53:20 +01:00
cschwinne
eca3f12fed Fixed analog overlay not settable 2022-03-07 00:11:43 +01:00
cschwinne
a2c8796e04 Replaced native Cronixie support with usermod 2022-03-06 23:47:36 +01:00
cschwinne
ad301fd087 Elekstube usermod enhancements
Coloring of grayscale images
Dimming control from configurable segment
2022-03-06 22:24:24 +01:00
cschwinne
02b08939cd No color order select on PWM busses (fixes #2569) 2022-03-06 11:48:17 +01:00
cschwinne
9b0d583f1b EleksTube usermod 1, 4, 8 BPP BMP support 2022-03-05 21:48:11 +01:00
RedNax67
4a0a07f158
Added digit dimming and support for .clk format (see https://github.c… (#2555)
* Added digit dimming and support for .clk format (see https://github.com/aly-fly/EleksTubeHAX)

* Small fixes and improvements, dimming optional

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2022-03-05 03:10:32 +01:00
Christian Schwinne
9c864c9759
UI: show color controls based on segment light capabilities (#2567)
* Dynamic hiding of unused color controls in UI

(e.g. a PWM white bus with no auto white mode will not display the color wheel or palette list)

* Store segment capabilities

Don't use palettes if no RGB supported
Make it safe to update busses using `/json/cfg`
2022-03-05 01:05:26 +01:00
Blaz Kristan
f1dd1bd6bd Relative value wrapping and operator fix.
Slot selector changes.
2022-03-04 21:49:07 +01:00
cschwinne
85b1c309d1 Relative value wrapping and operator fix (fixes #2566 ) 2022-03-04 14:42:35 +01:00
cschwinne
6fe43b7b5c Separate color memory from slot selectors
Slot selector dynamic text color black/white
Selected slot selector JS simplification
2022-03-03 20:54:54 +01:00
Blaz Kristan
62fc986d96 Segment corner fix. 2022-03-03 20:19:26 +01:00
Blaz Kristan
03710f1fd2 Prevent brute force PIN guessing. 2022-03-03 18:49:32 +01:00
Blaz Kristan
2283c7a926 Fix for dark buttons in info. 2022-03-03 11:24:21 +01:00
Blaz Kristan
fb19ca8bf4 Regression fix. 2022-03-03 11:14:28 +01:00
Blaz Kristan
4ebfc1516c Merge branch 'settings-pin' into dev 2022-03-03 11:06:11 +01:00
Blaz Kristan
cc713e6c89 Merge branch 'sensor-info' into dev 2022-03-03 11:04:42 +01:00
Blaz Kristan
1be65adf02 Fix:
- disbled timed preset expanding
- incorrect calendar icon on Mac/Firefox
2022-03-03 10:59:29 +01:00
Blaz Kristan
25427ee60d Fix:
- disbled timed preset expanding
- incorrect calendar icon on Mac/Firefox
2022-03-03 10:57:07 +01:00
Blaz Kristan
c8eefbaa2e CSS/JS fixes. 2022-03-03 01:02:23 +01:00
Blaz Kristan
b339f426f2 Added:
- generic settings.js handler
- update info
- numeric (not really) hidden PIN
2022-03-02 15:41:31 +01:00
Blaz Kristan
9fd26fa574 Settings PIN protection. 2022-03-01 23:37:28 +01:00
cschwinne
be90bf0188 Minor CSS simplifications 2022-03-01 18:22:54 +01:00
cschwinne
adcdaba199 Indentation: Consistent use of Tab
Added style guide
Updated changelog
2022-03-01 12:14:41 +01:00
cschwinne
17907589cc Indentation: Consistent use of Tab for CSS 2022-03-01 11:20:10 +01:00
cschwinne
f333df181f Small CSS alignment adjustments
mainseg is not highlighted by default, but can be enabled by CSS only
Simplify some CSS (new segment box, segment brightness slider)
Started labeling CSS classes
2022-03-01 11:13:56 +01:00
Blaz Kristan
61a01cb163 JS/CSS optimisations 2022-02-28 23:32:24 +01:00
Blaz Kristan
4ce557a829 Multiple fixes:
- ability so select mainseg (UI)
- changed preset sort (UI)
- IR40 white +/- fix
- IR repeatable actions fix
- minor UI CSS change
- removed unnecessary color functions
2022-02-27 22:19:05 +01:00
Blaz Kristan
4d10c9de95 Removed unnecessary set call.
Fixed incorrect colorUpdated call.
Fixed white +/- in IR40 remote.
2022-02-27 16:18:37 +01:00
Blaz Kristan
5b84acebbc Minor JS optimisation. 2022-02-27 11:31:30 +01:00
Christian Schwinne
fc845dc936
Add locate button for easy lat/lon auto-fill (#2559) 2022-02-26 01:37:30 +01:00
Blaž Kristan
7beae93441
IR rewrite. (#2561)
* IR rewrite.
- added CCT (WW/CW) support
- support for applying change to main segment or all selected segments

* Remove extra setValuesFromFirstSelectedSeg()

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2022-02-26 01:37:09 +01:00
Blaž Kristan
c8f1297adb Fixed main/first selected segments in IR.
Code optimization.
2022-02-25 10:24:00 +01:00
Blaz Kristan
053a1d34e5 Fix for main segment. 2022-02-24 20:49:53 +01:00
Blaz Kristan
110a75ba0b Merge branch 'merge-master' of github.com:blazoncek/WLED into merge-master 2022-02-24 16:57:36 +01:00
Blaz Kristan
826a31e57d UI fixes and optimizations. 2022-02-24 16:52:16 +01:00
Blaž Kristan
23d7c3d0fe Merge branch 'master' into merge-master 2022-02-24 13:43:12 +01:00
cschwinne
4d4a20e05e 0.13.0-b7
Mitigate Pixel 6 UI issue
2022-02-24 01:16:24 +01:00
cschwinne
c03d4f115f Fixed presets not triggering interface update 2022-02-23 19:42:34 +01:00
cschwinne
ed90b638a9 Main seg replaced by first selected in internal interfaces
Version bump to 0.13.0-b7
Various small improvements
2022-02-23 19:20:07 +01:00
Blaz Kristan
c5252e06a7 Main segment UI identification. 2022-02-22 22:10:26 +01:00
Blaž Kristan
8af445e72b Merge branch 'master' into merge-master 2022-02-22 10:42:00 +01:00
cschwinne
94a0199955 Readme cleanup 2022-02-21 22:26:35 +01:00
cschwinne
44739c5198 Merge effectChanged and colorChanged to stateChanged 2022-02-21 22:12:13 +01:00
cschwinne
5f871bc01f HTTP API: Set segments directly in set.cpp 2022-02-21 20:48:11 +01:00
Blaz Kristan
b382dd6fc0 Incorrect variables fix. 2022-02-21 19:55:30 +01:00
Blaz Kristan
2e84f82ed6 Fix for incorrect application of color in set.cpp 2022-02-21 19:44:12 +01:00
cschwinne
1f5971f15a Another HTTP API segment improvement 2022-02-21 18:31:19 +01:00
cschwinne
694466a196 Apply segment by Enter key on input field 2022-02-21 17:58:18 +01:00
cschwinne
03311d3776 Do not set main seg before apply
Setting mainseg before applyValuesToSelectedSegs() causes the updated value to not be set to other selected segments
2022-02-21 16:57:18 +01:00
cschwinne
ae0eba866a Improve Stream and fix HTTP segment application 2022-02-21 16:19:11 +01:00
Blaz Kristan
05f92b74e7 Bump to 0.13-bl7. 2022-02-20 22:36:37 +01:00
Blaz Kristan
41b6f3ffa7 Merge branch 'master' into merge-master 2022-02-20 22:24:11 +01:00
Blaz Kristan
c895b76864 unneeded WS request 2022-02-20 09:41:56 +01:00
cschwinne
906737bedb Changelog update 2022-02-20 02:15:34 +01:00
Christian Schwinne
7138e891be
Add per-segment light capability info (#2552)
* Add per-segment light capability info

* Fix duplication

* Change to more lightweight seglc array

* Added segment capabilities.

* Differs and capabilities refactoring

* Add back selection differs option

Co-authored-by: Blaz Kristan <blaz@kristan-sp.si>
2022-02-20 00:20:22 +01:00
Christian Schwinne
53abe36b83
Merge pull request #2547 from Aircoookie/sync-segbounds2
Sync segment bounds
2022-02-19 23:00:31 +01:00
cschwinne
efbb7a034c Slight websocket reconnection tweaks 2022-02-19 22:47:17 +01:00
Blaz Kristan
d7dac57a07 Save a bit of RAM and flash. 2022-02-19 20:34:37 +01:00
Blaz Kristan
05bc81bf4e Add default preset name if none specified. 2022-02-19 11:42:59 +01:00
Blaz Kristan
59ce88f044 Add default preset name if no name specified 2022-02-19 11:37:48 +01:00
Blaz Kristan
f8bc0bd2b5 Removed unnecessary if. 2022-02-18 19:23:55 +01:00
Blaz Kristan
7ebb184c8a Clear JSON buffer. 2022-02-18 19:21:22 +01:00
Blaz Kristan
bd44205b4e Allow saving preset from IR 2022-02-18 18:52:44 +01:00
Blaz Kristan
cf94cb1092 Allow saving preset from IR
Removed double clolorUpdated() call
2022-02-18 18:35:51 +01:00
Blaz Kristan
02d92e32c7 Parsing IR JSON cmd fix. 2022-02-18 17:01:34 +01:00
Blaz Kristan
68087cdea5 Parsing JSON cmd fix for IR
Latest NeoPixelBus lib.
2022-02-18 16:58:57 +01:00
Blaž Kristan
7f92607b85 Added WS reconnect on error toast. 2022-02-17 12:51:37 +01:00
Blaž Kristan
3be4b69b44 WS reconnect logic & WS memory leak protection 2022-02-17 12:45:50 +01:00
Tom D'Roza
bb9afcb304
Added: CSS hover effect on buttons within modal dialogs, e.g. Info, Nodes (#2545)
* Added: CSS hover effect on buttons within modal dialogs, e.g. Info,
Nodes

* Update index.css

Co-authored-by: Tom D'Roza <Tom.D'Roza>
Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
2022-02-17 00:38:47 +01:00
cschwinne
e9a05890a5 Return to core 2.7.4 for higher stability 2022-02-17 00:17:00 +01:00
cschwinne
613809c2af Do not turn rpt segments off 2022-02-16 23:54:14 +01:00
cschwinne
7b969bb8c2 Various state changed logic simplifications
Changed main segment, must be selected
2022-02-16 21:12:33 +01:00
cschwinne
7aef551292 Segment bounds sync option 2022-02-16 14:55:35 +01:00
cschwinne
447b811fa0 Remove build flag leading to wdt reset on some boards 2022-02-14 18:49:13 +01:00
Blaz Kristan
5151aa677f Added ID for segment options syncing. 2022-02-14 16:16:38 +01:00
Blaz Kristan
a5ff34d423 Platformio.ini fix for ESP01 and newer libraries. 2022-02-14 16:15:49 +01:00
dependabot[bot]
435040814d
Bump ajv from 6.12.2 to 6.12.6 (#2543)
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.2 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.12.2...v6.12.6)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 15:35:13 +01:00
Blaž Kristan
9987416a4a Allow float array values in usermod config. 2022-02-14 12:19:33 +01:00
Blaž Kristan
31e33e0a8b Fix for creating segments if config set to length. 2022-02-14 08:15:35 +01:00
Blaz Kristan
03cfae45f8 Allow float in usermod array elements. 2022-02-12 23:14:00 +01:00
Blaz Kristan
4f83325e3c Fix for expanding saved preset. 2022-02-12 11:32:49 +01:00
Blaz Kristan
cd1765a0f3 Added permanent ledmap 0. 2022-02-11 14:43:15 +01:00
Blaz Kristan
5c744ad9aa Ledamp dropdown. 2022-02-10 23:14:48 +01:00
cschwinne
b211d8b085 Fix SSDR usermod if SN_Photoresistor mod is not included 2022-02-10 19:48:13 +01:00
Blaz Kristan
f8eece362f Compile fix.
Adjusted function names.
2022-02-10 16:09:16 +01:00
Blaz Kristan
d4ea30e081 Merge branch 'master' into merge-master 2022-02-10 14:16:55 +01:00
Blaž Kristan
83416ee2e0
Merge pull request #2530 from Proto-molecule/patch-api
bugs, json remote repeat, cmd &R=
2022-02-10 14:06:34 +01:00
Blaz Kristan
fa981a389f Add transitions to other segments. 2022-02-10 13:59:59 +01:00
Blaz Kristan
25915b5521 Missing main seg. 2022-02-10 13:59:31 +01:00
Blaz Kristan
ed0dcb5c3d Use transitions on other segments. 2022-02-10 13:56:07 +01:00
Blaz Kristan
55817f31f9 Merge branch 'master' into patch-api 2022-02-10 13:48:48 +01:00
Blaz Kristan
a5b19bbc83 Multiple changes:
- added segment capabilities utility
- removed colorFromUinXX functions
- rewritten IR color handling (changeColor())
2022-02-10 13:24:51 +01:00
Blaz Kristan
f6b44e03ac Removed unused code in rotary encoder. 2022-02-10 13:09:22 +01:00
Blaž Kristan
6d2ef4e0bf
Merge pull request #2539 from dylan09/multirelay-discovery
Fixed buffer overflow in HA autodiscovery. #2538
2022-02-10 00:33:16 +01:00
ulrich
4d714cf9a4 Fixed buffer overflow in HA autodiscovery. #2538 2022-02-09 23:08:42 +01:00
cschwinne
930ded6767 Fix touch pin 2022-02-09 19:59:17 +01:00
Blaz Kristan
4cdb18907f Fix for Four Line Display usermod. 2022-02-09 19:27:52 +01:00
Blaz Kristan
93bccb96b6 Minor fixes
- prevent setValuesFromMainSegment affecting segments
- add ability to define default IR remote at compile time
2022-02-09 17:16:22 +01:00
Henry Gabryjelski
38bc618ee5
Float and better 3rd party library compatibility (#2534)
* define as float (not double)

* Avoid #define of 1 or 2 char symbols

Having this file define 'A' and 'C' pollutes
the global namespace, and causes conflicts
with other libraries that also pollute the
global namespace with short #defines.
It's easier to fix this header.

* unused variable warning
2022-02-09 09:46:54 +01:00
Christian Schwinne
00b0193a43
Fix re-init segment data leak (fixes #2535 ) (#2536) 2022-02-09 08:43:35 +01:00
Blaz Kristan
e2db37d28a Merge branch 'master' into master-merge 2022-02-08 19:35:12 +01:00
bole5
f9bce54104
Change Default Relay Pin to -1 (#2531) 2022-02-08 00:15:24 +01:00
bole5
7ee14724fc
Improve Pin Manager Debugging (#2532) 2022-02-08 00:03:20 +01:00
Blaz Kristan
5988c2ac78 repeat actions cleanup & fix 2022-02-07 11:24:57 +01:00
Blaz Kristan
4eb0dbb5a4 repeat actions cleanup & fix 2022-02-07 11:13:12 +01:00
Proto-molecule
8c5b3fe23e bugs, json remote repeat, cmd &R= 2022-02-06 19:00:03 -08:00
Blaz Kristan
e35ad7551b Apply IR to main or selected segments.
Refactored IR code.
2022-02-07 00:40:45 +01:00
Blaz Kristan
6c943a7158 IR button & W color fix. 2022-02-06 13:15:35 +01:00
Blaz Kristan
2da14e5b2a Merge branch 'master' into merge-master 2022-02-04 16:29:39 +01:00
cschwinne
97f8eea302 Refactored isRgbw to hasWhiteChannel() 2022-02-04 13:28:00 +01:00
cschwinne
04d5932252 Un-F()-ed some strings
(that were either occuring at least 4 times, or were F()-ed in some places and not in others)
2022-02-04 10:10:37 +01:00
Blaž Kristan
84e38f765d Fix for incorrect buffer size when LED count = 256 2022-02-04 07:59:17 +01:00
cschwinne
b33c5798ee Changelog update 2022-02-03 23:37:30 +01:00
Blaz Kristan
81012e60ff Fix for overallocated LiveView buffer. 2022-02-03 20:24:52 +01:00
Blaz Kristan
6180c2f948 Fix for overallocated LiveView buffer. 2022-02-03 20:21:09 +01:00
Blaz Kristan
52f0ae9350 Merge branch 'master' into master-merge
Few UI fixes.
2022-02-03 17:40:44 +01:00
Blaz Kristan
fa0936da3c Fix for ESP8266 bootloop.
Reordered preset sorting.
2022-02-02 22:00:31 +01:00
Blaz Kristan
8a30c6347e Remove error Toast after 10s. 2022-02-02 21:03:26 +01:00
Blaz Kristan
09bcf34050 Non-effect preset should not unload playlist. 2022-02-02 20:53:16 +01:00
Christian Schwinne
795c515999
Merge pull request #2517 from ChuckMash/serial+
Extend Serial functions. Baudrate changeable during runtime and fast LED data retrieval
2022-02-01 20:07:30 +01:00
cschwinne
00dbdc2267 Baud rate setting 2022-02-01 20:02:46 +01:00
cschwinne
32286888e5 PinManager, cleanup and tmp2 out 2022-02-01 18:21:30 +01:00
Christian Schwinne
565d8d8f04
Binary Websockets for Peek (#2516)
* Binary Websockets for Peek

* No IRAM_ATTR here

* Use builtin LittleFS for all ESP32 builds

* Attempt LittleFS compilation fix

* Use tasmota zip for all ESP32 builds

* Revert to Arduino Core 1 for the time being
2022-02-01 12:02:04 +01:00
Blaž Kristan
0a5a0bef48
Enhanced usermods. (#2522) 2022-02-01 09:33:57 +01:00
Blaz Kristan
6e0e5c102e Added extractModeName() utility function. 2022-01-31 20:43:35 +01:00
Blaz Kristan
d31271fee3 Minor fixes:
- optimized setPixelSegment()
- moved extractModeName() to util.cpp
- optimized extractModeName()
- removed SR extensions from /json/effects endpoint (compatibility estabished)
2022-01-31 20:35:11 +01:00
Blaz Kristan
be8a9ae73b setPixelSegment() optimization 2022-01-31 17:56:21 +01:00
Sousanator
afaa001738
Merge branch 'master' into master 2022-01-30 10:51:51 -05:00
ChuckMash
22fbb0e35b
Update wled_serial.cpp
Adds serial functionality

Can now change baud rate during runtime to be faster
Retrieve LED strip data as JSON blob
Retrieve LED strip data as BYTES (fast!)
2022-01-28 23:35:40 -08:00
Blaz Kristan
026a53f3ff Bugfix for expanding timed presets.
Removed AsyncWebServer callbacks (string replace).
2022-01-28 16:31:28 +01:00
Blaž Kristan
e17203ca1b Fix for expand timed presets. 2022-01-28 13:51:52 +01:00
Blaz Kristan
599c7919ce Merge branch 'master' into dev 2022-01-27 21:15:35 +01:00
Blaz Kristan
778b601cd5 Playlist bugfix. 2022-01-27 21:01:03 +01:00
Blaz Kristan
3170fa2208 Playlist bugfix. 2022-01-27 21:00:43 +01:00
Blaz Kristan
07216db864 Merge branch 'master' of https://github.com/aircoookie/WLED 2022-01-27 19:26:56 +01:00
Blaz Kristan
fec870f264 Fix for default action not triggering colorUpdated 2022-01-27 19:26:53 +01:00
Blaz Kristan
4518f089cc Missing settings page. 2022-01-27 16:37:49 +01:00
cschwinne
2c5eba335f Added white channel to Peek (closes #1716) 2022-01-26 13:26:57 +01:00
Mike Ryan
fb19f1ecbc
Allow overriding of color order by LED pixel range. (#2463)
* Overridable color order

- Use `ColorOrderMap` to hold optional color order overrides for ranges
  of LEDs.
- Serialization of config to/from filesystem is complete.
- Back-end configuration is complete.
- TODO: front-end changes to the LED settings page.

* Add Color order override settings

- Adds color order override section to settings page.

* PR Feedback

- Limit max number of color order overrides to 5 on ESP8266
- Only append color overrides if they were provided in the POST of LED
  settings.
2022-01-26 00:42:04 +01:00
Blaz Kristan
91dd03ba67 Merge fix.
Increased JSON buffer for ESP32
2022-01-25 21:24:17 +01:00
Blaz Kristan
86092541ed Merge branch 'master' into dev 2022-01-25 17:53:22 +01:00
Blaž Kristan
e879fe5843
Remove obsolete usermods. (#2510) 2022-01-25 16:42:35 +01:00
Blaž Kristan
0ca7699fe5
Merge pull request #2427 from Aircoookie/sync-seg
Sync segment options.
2022-01-25 12:54:24 +01:00
Blaž Kristan
7f6adfa331 Converted indentation tabs to spaces. 2022-01-25 12:47:14 +01:00
cschwinne
5f0b102671 Send segment ID, start, stop, and cct 2022-01-24 18:31:05 +01:00
Blaz Kristan
70a59daa6f Fix for incorrect repeatable segment. 2022-01-24 17:18:57 +01:00
cschwinne
d28eb6ae21 Repeat other seg than 0 bugfix 2022-01-24 16:44:47 +01:00
Blaž Kristan
34865f797f Factory reset on very long press. 2022-01-24 14:20:21 +01:00
André Klitzing
eca980dfca
Add initial support for ESP32-C3 (#2454)
* WIP Add support for ESP32-C3

* Add esp32c3 to default_envs

* Use new platform from tasmota

* Switch back to 2.8.1 as it seems by fixed
2022-01-24 11:34:02 +01:00
Jason2866
742c792ec7
Use latest Arduino ESP32 (#2502)
build with IDF44-rc1 and Arduino from 21.01.2022. Toolchains updated to 8.4.0 2021r2-patch2
The platform can be used for ESP32, ESP32-S2 and ESP32-C3
2022-01-24 11:28:49 +01:00
Blaž Kristan
24a5f7a38e Fix for colorUpdated() on button 1 press. 2022-01-24 07:41:35 +01:00
Blaz Kristan
554949102b Build bump. 2022-01-23 11:45:18 +01:00
Blaz Kristan
0f3b95802d UI tweaks. 2022-01-23 11:43:39 +01:00
Blaz Kristan
868910fddf Merge branch '4ld-font' into color-order-mapping 2022-01-23 11:14:19 +01:00
Blaz Kristan
436542eff8 Slidercontrol fix. 2022-01-23 11:13:50 +01:00
Blaz Kristan
f4c05c67a2 Minor tweak. 2022-01-22 23:35:00 +01:00
Blaz Kristan
6f7f67df5a Merge branch '4ld-font' into color-order-mapping 2022-01-22 23:20:47 +01:00
Blaz Kristan
50b6163e73 Merge branch 'color-order-mapping' of https://github.com/justfalter/WLED into color-order-mapping 2022-01-22 23:19:59 +01:00
Blaž Kristan
9b062f33c5
Merge pull request #2450 from frankalicious/patch-1
fix name of image for ST7789 usermod
2022-01-22 23:07:15 +01:00
Blaž Kristan
ea15c2245e
Merge pull request #2497 from herm/usermod_multirelay
Add Home Assisant MQTT autodiscovery for usermod multi_relay.
2022-01-22 22:57:24 +01:00
Blaz Kristan
beb539abaf Resizing window fix. 2022-01-22 21:45:47 +01:00
Blaz Kristan
6dd1d45a02 Added config option for HA autodiscovery. 2022-01-22 20:59:51 +01:00
Blaz Kristan
26ae6d3691 Added config option for HA autodiscovery. 2022-01-22 20:49:43 +01:00
Blaz Kristan
90ea01aa46 Possible fix for UI not loading on returning from Settings. 2022-01-22 13:54:17 +01:00
Blaz Kristan
6c52105ac7 Restore original behavior for button 0. 2022-01-21 21:24:49 +01:00
cschwinne
f97bc9dba8 Fix DMX menu settings item 2022-01-21 20:35:30 +01:00
Blaz Kristan
3332375d7c A few fixes.
Added HA autodiscovery to Multi relay usermod.
2022-01-21 17:30:52 +01:00
Blaz Kristan
fe6b1c13c4 Periodic broadcasts. 2022-01-21 16:08:02 +01:00
Blaz Kristan
5608425a12 Added comments.
Fix for incorrect boot state.
2022-01-21 15:55:25 +01:00
cschwinne
f784b01d20 Update year 2022-01-21 01:48:50 +01:00
Hermann Kraus
2648eba5bf
Deprecate usermod mqtt_switch. (#2499) 2022-01-20 23:31:28 +01:00
Blaz Kristan
255347ab77 Minor clenup. 2022-01-20 17:38:18 +01:00
Hermann Kraus
52c36ef6a4 Add Home Assisant MQTT autodiscovery for usermod multi_relay. 2022-01-20 00:30:17 +01:00
Blaz Kristan
ed2e083d13 Added button 0 doubleclick for net info. 2022-01-19 22:15:08 +01:00
Blaz Kristan
80f7c5ed9d Added CCT to rotary encoder. 2022-01-19 20:39:00 +01:00
Blaz Kristan
8d33cbeaca Fix for effect not being applied using rotary encoder. 2022-01-19 16:53:21 +01:00
Blaz Kristan
b0b8bc7385 Dynamic vcomh fix.
New parameter autosave.
2022-01-18 20:29:41 +01:00
Blaž Kristan
edbc8b28d5
Merge pull request #18 from Proto-molecule/blaz-4ld
add VCOMH fix
2022-01-18 10:45:45 +01:00
Proto-molecule
da9bab16e1 add VCOMH fix 2022-01-17 23:26:36 -08:00
Blaz Kristan
75098d8b3e Optimizations 2022-01-17 20:29:14 +01:00
Blaz Kristan
65bb7fd533 Delay for ESP8266 to keep up. 2022-01-16 22:08:57 +01:00
Blaz Kristan
0259e78b2f Minor changes 2022-01-16 22:07:08 +01:00
Blaz Kristan
99b8888a1b Merge branch 'full-seg-sync' into 4ld-font 2022-01-16 15:23:32 +01:00
Proto-molecule
689f4ef606 add glyphs for 32x128 2022-01-15 19:01:09 -08:00
Blaz Kristan
b0c40e1e37 Color change tracking. Minor fixes. 2022-01-15 21:15:37 +01:00
Blaz Kristan
e54819e7e5 Merge branch 'master' into sync-seg 2022-01-15 14:08:08 +01:00
Blaz Kristan
7eb029dcb6 Complete segment syncing.
Reduced complexity of colorUpdated regarding effect/color change.
Minor optimizations.
2022-01-15 14:04:16 +01:00
Blaz Kristan
3da70c3e8b Full segment syncing.
- removed setEffectConfig()
- rate limit handleNightlight()
- fixes in colorUpdated()
- segment color fix in UDP routine
2022-01-15 00:06:06 +01:00
André Klitzing
f8c80283e4
Use arduino-esp32 2.0.2 for ESP32-S2 (#2452)
* Use arduino-esp32 2.0.2 for ESP32-S2

LittleFS is merged into it.

* Fix filesystem error for ESP32-S2

Use platform of tasmota until upstream released it and
use board_build.flash_mode = qio

* Fix empty disk usage

* Add esp32s2_saola to default_envs

* Remove lorol LITTLEFS for esp32dev, too

* Revert "Remove lorol LITTLEFS for esp32dev, too"

This reverts commit 3586d5eef7.
2022-01-14 17:19:33 +01:00
Blaz Kristan
72a6681ac1 Merge branch 'full-seg-sync' of github.com:blazoncek/WLED into full-seg-sync 2022-01-14 15:01:34 +01:00
Blaž Kristan
1ab555b590 Cleaning colorUpdated() & UDP segment syncing.
Added selected segments only save.
2022-01-14 14:27:11 +01:00
Blaz Kristan
4602ec7688 Merge branch 'dev' into full-seg-sync 2022-01-13 20:07:08 +01:00
Mike Ryan
5c39d8d12e PR Feedback
- Limit max number of color order overrides to 5 on ESP8266
- Only append color overrides if they were provided in the POST of LED
  settings.
2022-01-13 09:06:01 -06:00
Blaz Kristan
97284fcf87 Prevent continuous polling on error. 2022-01-13 15:27:15 +01:00
Blaz Kristan
c8b1654e0a Some fixes and new slider values. 2022-01-12 21:48:34 +01:00
Blaz Kristan
0400d0e0f0 Additional sliders. 2022-01-12 21:35:10 +01:00
Blaz Kristan
4040f6bec6 Merge branch 'dev' into full-seg-sync 2022-01-12 16:31:44 +01:00
Blaz Kristan
a4a3aa045b A few more slider values added. 2022-01-12 15:45:32 +01:00
Blaz Kristan
a5a18903c7 Merge branch 'dev' into full-seg-sync 2022-01-12 15:15:34 +01:00
Blaz Kristan
6990986d9f Bootloop fix for ALT 4LD. 2022-01-11 21:58:05 +01:00
Blaz Kristan
06ded0098c Aurora speed change.
Fix for Palette title.
2022-01-10 19:00:44 +01:00
Blaz Kristan
f1fbea30f1 Some slider values & defaults. 2022-01-10 18:42:09 +01:00
Blaž Kristan
04f5bdb843 Fix for NTP sync on millis() rollover.
AP mode delay on boot (#2242).
2022-01-10 13:53:11 +01:00
Blaž Kristan
d29283ff21 WIP: segment size in UDP 2022-01-10 09:03:36 +01:00
Blaz Kristan
35779dad8b Merge branch 'dev' into sensor-info 2022-01-09 22:00:09 +01:00
Blaz Kristan
ee0d6420a0 Re-read temperature on error. 2022-01-09 21:43:49 +01:00
Blaz Kristan
f66d847032 Fix for missing character in slider name. 2022-01-09 21:03:57 +01:00
Blaz Kristan
aba4dc7c50 Bugfix for analog button read limitation. 2022-01-09 15:13:58 +01:00
Blaz Kristan
99d0c5e2c6 Fix for bugfix. :)
Reduced millis() calls.
2022-01-09 15:13:33 +01:00
Blaz Kristan
fa55b94528 Bugfix for analog button read limitation. 2022-01-09 15:01:16 +01:00
cschwinne
7fb46cf982 WIP: Segment loop size byte 2022-01-09 14:16:07 +01:00
Blaz Kristan
523752b263 Merge branch 'dev' into full-seg-sync 2022-01-09 00:03:41 +01:00
Blaz Kristan
7df4b8e8cc Sync bugfix (preset, playlist)
PIR sensor bugfix.
2022-01-08 23:53:55 +01:00
Blaz Kristan
7a4ed5a337 UI bugfix. 2022-01-08 12:45:32 +01:00
Blaz Kristan
ec37085e39 Bugfix for nodes button. 2022-01-08 00:04:56 +01:00
Blaz Kristan
61e1e2729d Fix uspIn and mode 2022-01-08 00:04:02 +01:00
Blaz Kristan
ae8281f835 error in udpIn 2022-01-07 21:16:14 +01:00
Blaž Kristan
2efa68dd60 Merge branch 'master' into dev 2022-01-07 19:25:01 +01:00
Blaž Kristan
d2c92781c8 Full segment UDP syncing. 2022-01-07 19:18:16 +01:00
Blaž Kristan
fa35293618 Full segment syncing. 2022-01-07 19:12:06 +01:00
Blaž Kristan
20ccca0aec Swapped grouping and spacing in UDP packet. 2022-01-07 17:53:07 +01:00
Blaž Kristan
10e216da6b Fix for missing middle segment. 2022-01-07 17:48:46 +01:00
Blaž Kristan
6491353a57 Missing rptSeg() 2022-01-07 17:31:28 +01:00
Blaz Kristan
1906523489 Akemi & WLED logo for 4 Line Display usermod.
Commented out unused fonts.
2022-01-07 10:10:34 +01:00
Blaž Kristan
24beaa0d18
Merge pull request #16 from Proto-molecule/patch-1
add logos and Akemi icon to all font libraries
2022-01-07 08:44:36 +01:00
Blaz Kristan
e1deb48121 Optimizing simple UI
- no longer hiding brightness
- cleaner look
2022-01-06 22:21:38 +01:00
Benji
b3891bacaa
add logos and Akemi icon to all font libraries 2022-01-05 23:29:46 -08:00
Blaz Kristan
7939904ee3 4Line & 8Line optimizations and fixes. 2022-01-05 20:58:34 +01:00
Blaz Kristan
7dcd69a2df Fix boot logo.
Comment out unused fonts.
2022-01-05 17:20:50 +01:00
IgorMarkovic
9f44f989e5
Fix staircase mode segment 1 animation (#2469) 2022-01-05 16:09:25 +01:00
Blaž Kristan
002b2d0134 Boot logo. 2022-01-05 10:40:26 +01:00
Blaž Kristan
8b10ec93c2
Merge pull request #15 from Proto-molecule/patch-4
Update usermod_v2_four_line_display_ALT.h
2022-01-05 09:54:36 +01:00
Blaž Kristan
cf9ecd1564
Merge pull request #14 from Proto-molecule/patch-2
Create 4LD_wled_fonts.c
2022-01-05 09:48:16 +01:00
Benji
f31147248b
Update usermod_v2_four_line_display_ALT.h
added draft for logo
2022-01-05 00:08:51 -08:00
Benji
2f9c540660
Update 4LD_wled_fonts.c 2022-01-05 00:06:19 -08:00
Benji
09489feff9
Update 4LD_wled_fonts.c 2022-01-04 23:21:38 -08:00
Benji
0d17a69ee4
Update usermod_v2_four_line_display_ALT.h 2022-01-04 23:09:48 -08:00
Benji
c5755a4ec4
Create 4LD_wled_fonts.c 2022-01-04 23:05:45 -08:00
Blaz Kristan
20bc3719a4 Rotary encoder enhancements:
- Added double press action.
- Rewritten button handling.
2022-01-04 22:25:57 +01:00
Blaz Kristan
7dc41ab205 Merge branch 'dev' into test-4ld 2022-01-04 20:06:00 +01:00
Blaz Kristan
acc21e3b43 Minor simple UI fix and cleanup. 2022-01-04 19:33:27 +01:00
Blaz Kristan
41a6726beb Polish simpified UI 2022-01-04 17:58:36 +01:00
Blaž Kristan
2f8ba75970 Custom font 2022-01-04 12:10:11 +01:00
Proto-molecule
eb08129226
Update usermod_v2_four_line_display_ALT.h
Add icon fonts
2022-01-03 22:07:40 -08:00
Blaz Kristan
816823b115 Simple UI update. 2022-01-03 22:37:21 +01:00
Blaz Kristan
b6059939b4 Bugfix for applying WIN API in JSON request.
Added preset cycling in rotary encoder.
Removed custom font from 4LD in favor of built-in.
2022-01-03 22:23:03 +01:00
Mike Ryan
b8e23b2d7e Add Color order override settings
- Adds color order override section to settings page.
2022-01-02 18:51:00 -06:00
Mike Ryan
a06846fa74 Overridable color order
- Use `ColorOrderMap` to hold optional color order overrides for ranges
  of LEDs.
- Serialization of config to/from filesystem is complete.
- Back-end configuration is complete.
- TODO: front-end changes to the LED settings page.
2022-01-02 18:24:12 -06:00
cschwinne
33f72e40da Replace icon unavailable on some mobile browsers 2022-01-02 18:06:42 +01:00
Blaz Kristan
e8b2d80037 Minor code optimizations. 2022-01-02 14:27:24 +01:00
Blaz Kristan
853463b7cd Bugfixes. 2022-01-02 14:26:09 +01:00
Blaž Kristan
518e1a6405
Merge pull request #12 from Proto-molecule/patch-1
Patch 1
2022-01-02 11:37:30 +01:00
Blaž Kristan
afd376ddbc
Merge branch 'display-enh' into patch-1 2022-01-02 11:34:45 +01:00
Blaz Kristan
1ce325ee8a Modifications to 4LD 2022-01-02 11:28:44 +01:00
Blaz Kristan
1e947a34a8 Merge branch 'master' into dev 2022-01-01 16:36:06 +01:00
Blaz Kristan
fe1e5aeebf Merge branch 'dev' into sensor-info
Conflicts:
	usermods/Temperature/usermod_temperature.h
2022-01-01 12:57:36 +01:00
Blaz Kristan
8386b9a0b4 Removed dynamic JSON buffer entirely.
Temporary presets in RAM (ESP32)
Async loading of presets (stability).
Other minor fixes.
Bumped version to 0.13.1-bl6
2022-01-01 12:52:50 +01:00
Blaz Kristan
40323e3afe UM optimizations. 2021-12-31 18:25:27 +01:00
Blaž Kristan
18868a5bd6
Date controlled timed presets. (#2447)
* Date controlled timed presets.

* C/P fix for sunset.

* Fixed % escape character

* Date range support

* Date logic fix

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2021-12-31 14:09:48 +01:00
Christian Schwinne
754682577c
Configurable framerate (#2444)
Updated arduino core versions
Better performance on esp32 core 3.x due to IRAM_ATTR
Fixed analog busses init to full white/on
2021-12-30 01:48:27 +01:00
Blaz Kristan
603dee7661 Apply FX defaults fix.
ALT 4LD optimizations.
2021-12-29 19:12:30 +01:00
Blaz Kristan
2a27cc46e2 Added forcing NTP update on Time&macro save. 2021-12-29 17:03:03 +01:00
Blaz Kristan
a9a06a1e4e Fix for NTP sync on millis() rollover. 2021-12-29 15:09:33 +01:00
Blaz Kristan
5f73725b8f Yet naother fix. 2021-12-28 22:14:47 +01:00
Blaz Kristan
324983024a Temporary fix for incorrect temperature reading. 2021-12-28 21:53:29 +01:00
Blaz Kristan
7cb63b1da0 Fix for default values loaded even with preset. 2021-12-28 21:38:28 +01:00
Blaz Kristan
31603380c1 Bugfix autosegments & solid pattern 2021-12-28 18:53:30 +01:00
Blaz Kristan
5a3d3b0324 Default values for effects.
Moved mode names to FX_fcn.cpp
2021-12-28 18:09:52 +01:00
Blaž Kristan
78006855ee Fix for 8266 default core. 2021-12-28 07:30:05 +01:00
Sousanator
71520f6709
Update const.h
Added option for LDP6803
2021-12-27 18:06:58 -05:00
Sousanator
3f5a09229d
Update settings_leds.htm
Added option for LPD6803
2021-12-27 18:04:14 -05:00
Sousanator
5609771993
Update html_settings.h 2021-12-27 18:01:42 -05:00
Sousanator
79b01cdc3c
Update bus_wrapper.h
Added support for LPD6803
2021-12-27 17:54:37 -05:00
Blaz Kristan
73f99b5e22 Bugfix for restoring previous LED state. 2021-12-27 16:13:59 +01:00
Blaz Kristan
7d6f8eb495 WS notifications on PIR state change. 2021-12-27 15:40:29 +01:00
Blaz Kristan
eac5340b03 Merge branch 'configurable-fps' of https://github.com/aircoookie/WLED into dev 2021-12-26 11:59:22 +01:00
frankalicious
aef0243b73
fix name of image for ST7789 usermod 2021-12-26 11:06:20 +01:00
akshay rajput
736053e24e
Patch to remove preceding zero of hour digit for 7segment usermod (#2445)
* Update usermod_seven_segment_reloaded.h

* Update usermod_seven_segment_reloaded.h
2021-12-26 02:29:56 +01:00
Blaz Kristan
36b196dd93 Date controlled timed presets. 2021-12-25 18:46:43 +01:00
cschwinne
549dcd32ca Configurable framerate
Updated arduino core versions
Better performance on esp32 core 3.x due to IRAM_ATTR
Fixed analog busses init to full white/on
2021-12-25 01:30:27 +01:00
Blaz Kristan
a59f56d852 LAT/LON helper for Samsung devices. 2021-12-23 20:37:22 +01:00
Blaz Kristan
2c14181051 LAT/LON helper for Samsung devices. 2021-12-23 20:32:45 +01:00
Blaz Kristan
c2b9e06a4a Color slot selection glitch fix. 2021-12-22 23:04:58 +01:00
Blaz Kristan
964978d45b Optimizations. 2021-12-22 18:37:14 +01:00
Proto-molecule
599490bb6e
bugs
line 436: perhaps this needs to be 256?
2021-12-22 01:18:29 -08:00
Proto-molecule
a841e1fb2e
bugs
Line 526: "now - lastRedraw" equates to a negative number and forces the screen into sleep mode
Line 646, 660: if the array size isn't at least the length of the longest name of an effect or palette, then it will not fully print. "Fireworks Starburst" is the longest one at 19 characters. this it kinda a bandaid fix because a longer name may come in the future.
2021-12-22 00:43:14 -08:00
Blaz Kristan
296fe4b62e Unload playlist on timed presets. 2021-12-21 22:46:06 +01:00
Blaz Kristan
cb4c736fab Bugfix galore. 2021-12-21 20:43:49 +01:00
Blaz Kristan
118f02fd11 Unload playlist on timed presets. 2021-12-21 18:47:21 +01:00
Blaz Kristan
990d0f6e3e Fix for skipping reset of segments when changing spacing. 2021-12-21 18:26:51 +01:00
Blaz Kristan
84624666ce Incorrect delete fix. 2021-12-21 18:16:25 +01:00
Blaž Kristan
42474e551f Added check for newest parameter and bus frequency 2021-12-21 12:38:19 +01:00
Blaž Kristan
061e055d1b Optimizations in ALT rotary encoder & display usermods. 2021-12-21 11:20:11 +01:00
Blaz Kristan
12f2caa8d6 Alt Rotary Encoder & Alt 4LD enhancements. 2021-12-20 20:44:06 +01:00
Blaz Kristan
8bd716c056 Prevent undefind FX behaviour on millis() rollover 2021-12-20 16:43:47 +01:00
Blaž Kristan
b890b5f0dc millis() rollover fix for effects 2021-12-20 11:29:03 +01:00
Andy Hofmann
cd95abb2a1
Usermod quinled-an-penta: Updated IOs for v1r1 release (#2429)
* UM QuinLED-An-Penta: First version

* UM QuinLED-An-Penta: Made OLED seconds a setting; small improvements

* UM QuinLED-An-Penta: Fixed unique ID

* Merge branch 'master' of https://github.com/Aircoookie/WLED

* UM QuinLED-An-Penta: Fixed config loading

* UM QuinLED-An-Penta: Replaced ledcRead() with calculating the percentage

* UM QuinLED-An-Penta: Fixed temp sensor readings

* UM QuinLED-An-Penta: Removing OLED bus clk setting

* UM QuinLED-An-Penta: ETH support, lots of OLED improvements

* UM quinled-an-penta: v1r1 adjustments
2021-12-20 01:41:37 +01:00
Blaz Kristan
c3df9e6270 Increased time before reading temperature.
4LD modifications.
2021-12-19 21:14:54 +01:00
Blaz Kristan
6463fbee32 Fix for usermod sornt& rotary encoder. 2021-12-19 16:50:55 +01:00
Blaz Kristan
e43cdc6674 Slight optimization in Temperature usermod. 2021-12-19 12:05:28 +01:00
Blaz Kristan
59216a9ae1 UI refinements.
Disconnect all WS clients on low mem.
2021-12-18 17:13:15 +01:00
Blaz Kristan
47a620bd36 Merge branch 'dev' into sync-seg 2021-12-18 10:26:20 +01:00
Blaz Kristan
37dbf4d8ec Prevent memory exceptions using WS. 2021-12-18 10:25:58 +01:00
Blaz Kristan
1270f2d577 Sync segment options.
Freeze effect.
Repeat last segment until end.
2021-12-17 20:33:48 +01:00
Blaz Kristan
80a067806d Spacing & grouping notification. 2021-12-17 17:36:12 +01:00
Blaz Kristan
f20065f546 Notification & UI fix 2021-12-17 17:29:39 +01:00
Blaž Kristan
43d50e270a Syncing segment options. 2021-12-17 11:22:20 +01:00
Blaž Kristan
c27117e99e
Merge pull request #2415 from Aircoookie/i2c-sharing
Pin manager support for sharing multipin buses.
2021-12-16 19:57:08 +01:00
Blaž Kristan
9c84f13425 Add debug output in case of CRC error reading temp 2021-12-16 10:47:56 +01:00
Blaz Kristan
b2cf7a16f2 Added different reading for DS18S20 sensor 2021-12-15 19:34:06 +01:00
Blaž Kristan
28556790d6 Removed loadInfo() in animated staircase. 2021-12-14 10:35:50 +01:00
Blaž Kristan
41c9bb63a0 Pin manager support for sharing multipin buses. 2021-12-14 09:38:38 +01:00
Blaž Kristan
c2b2fafc9c Bugfix in 4LD. 2021-12-14 06:32:08 +01:00
Blaz Kristan
5b88ba6d1d fix when hiding color slots 2021-12-13 17:57:18 +01:00
Blaz Kristan
d036021a78 Build bump. 2021-12-12 10:03:11 +01:00
Roman Reitschmied
7d5e2466f0
add ability get LDR value from other usermods (#2408) 2021-12-12 00:31:54 +01:00
Roman Reitschmied
d3f35955d6
New flexible usermod for seven segment displays (#2409)
* add first version

* added max/min brightness to autoldr functionality

* added more information to the readme
2021-12-12 00:31:21 +01:00
cschwinne
fb338c0728 Button preset call mode
(stops main segment values from being applied to all presets)
2021-12-11 23:44:21 +01:00
Blaz Kristan
5462d1e9f8 Bugfix
- incorrect bus length
- invalid relay state
- preset JSON corruption on network call
- iro & rangetouch serving
2021-12-11 23:17:47 +01:00
cschwinne
2ce8f1ee5d Skip first and apply preset fixes 2021-12-11 19:30:11 +01:00
Blaz Kristan
3f0258e215 Playlist corrupting JSON buffer bugfix. 2021-12-10 20:45:37 +01:00
Christian Schwinne
e72a8d999f
Merge pull request #2393 from guardmedia/blends-effect
Improved speed and reduced memory usage for Blends effect
2021-12-10 18:42:46 +01:00
Blaž Kristan
fed16fd14e Fix for disconnects on ESP8266 with static JSON buffer 2021-12-10 17:30:57 +01:00
Blaž Kristan
5dbc45ecb9 Fix for incorrectly placed release JSON buffer. 2021-12-10 17:06:04 +01:00
Blaž Kristan
2f411dfc9c Added compile time default for 4LD usermod. 2021-12-10 16:59:56 +01:00
Blaž Kristan
d6cff870e5 Incorrect JSON buffer release fix. 2021-12-10 13:29:42 +01:00
Blaž Kristan
e1cd45c57e Bugfix for heap low disconnect. 2021-12-10 12:51:44 +01:00
Blaz Kristan
7572b6f66b Remove volatile. 2021-12-09 15:08:19 +01:00
Blaž Kristan
e489b08bc1 Possible double JSON use bugfix. 2021-12-09 13:01:22 +01:00
Blaz Kristan
094bdb29b6 Fix for >10 buttons. 2021-12-08 22:41:16 +01:00
Blaz Kristan
712e05479b Cleanup.
Bugfixes.
Changed links to point to kno.wled.ge
2021-12-08 22:05:51 +01:00
Blaž Kristan
7c6c9eed36 Prevent autozoom on input fields. 2021-12-08 14:38:21 +01:00
Blaž Kristan
63eee28a82 Slow down loading rangetouch.js 2021-12-08 10:09:45 +01:00
Blaž Kristan
0777eaad10 Minor styling changes. 2021-12-08 10:00:31 +01:00
cschwinne
9e6866c160 0.13.0-b6 2021-12-08 01:22:48 +01:00
Blaz Kristan
974dd8ce57 Recusive palette update fix. 2021-12-07 19:17:26 +01:00
Blaz Kristan
957d08f4c6 Merge branch 'dev' into gzip
Minor fixes.
Enhanced SR UI handling for palettes.
2021-12-07 18:53:38 +01:00
Blaz Kristan
156b499f93 Merge branch 'master' of https://github.com/aircoookie/WLED into dev 2021-12-07 17:18:38 +01:00
Blaz Kristan
f31100326b Fixes. 2021-12-07 16:31:45 +01:00
Blaž Kristan
9b7b1d6a61 Minor cleaning. 2021-12-07 13:49:36 +01:00
cschwinne
7101ad81c4 No auto white for RGB DDP bus 2021-12-07 13:37:28 +01:00
cschwinne
8643263227 Add two new Fairy FX modes 2021-12-07 11:03:41 +01:00
Blaž Kristan
409c1b7584 Added comments. 2021-12-07 08:26:01 +01:00
Tyler Walters
eab132ed32 Improved speed and reduced memory usage for Blends effect
color_blend() function only generates 256 colors from the palette before repeating. Improved the function to use either 256 max or the segment length if shorter.
2021-12-06 22:17:35 -05:00
Blaz Kristan
f45b5da71a GZIPped UI & settings pages.
settings.js for pasting data into HTML.
Reduced simple & classic flash footprint.
Split iro.js and rangetouch.js into separate requests (instead of embedding)
2021-12-06 20:53:09 +01:00
Blaz Kristan
f57b606f72 Added info.sensor properties for motion and temperature
(HA integration)
2021-12-06 20:13:18 +01:00
Christian Schwinne
66bad2b6f8
Single json buffer (#2336)
* Single/static JSON buffer for all requests.

* Missing json.cpp changes.

* Async fix.

* Added conditional compile (WLED_USE_DYNAMIC_JSON).

* Advanced locking with time-out.

* Missing releaseJSONBufferLock() on error response.

* Fix for config saving.

* Fixes and optimisations.
Dadded debugging information.

* Fix for ledmaps.

* No unsolicited serial sending if GPIO1 allocated

* Stray semicolons

* Fix JSON ledmap

Co-authored-by: Blaz Kristan <blaz@kristan-sp.si>
2021-12-04 01:05:01 +01:00
Blaz Kristan
44f9bc5f0e Revert hiding UI elements. 2021-12-03 21:17:59 +01:00
Blaz Kristan
5c7e3c6bab Bugfixes. 2021-12-03 21:09:53 +01:00
cschwinne
46ec504743 Various fixes
Fixed ESP32 crash on Colortwinkles brightness change
Fixed setting picker to black resetting hue and saturation
Fixed auto white mode not saved to config
2021-12-03 20:36:37 +01:00
Blaž Kristan
737151ba09 UI optimization. 2021-12-03 14:26:26 +01:00
Blaz Kristan
2eef39d64a UI fix. 2021-12-02 22:57:32 +01:00
Blaž Kristan
821f76bcd6 Additional merge conflict. 2021-12-02 13:24:14 +01:00
Blaž Kristan
37ec058572 Merge conflict resolvement. 2021-12-02 13:09:53 +01:00
cschwinne
cadda12371 Fixed spacing LEDs not blanked if offset is changed 2021-12-02 00:52:36 +01:00
cschwinne
a643b56555 Fixed no color updated on full JSON state request 2021-12-01 23:03:30 +01:00
Blaž Kristan
aa34df7a4c Merge branch 'master' of https://github.com/Aircoookie/WLED into new-CCT 2021-12-01 14:51:45 +01:00
cschwinne
f7404085de Unload playlist on PL= 2021-12-01 00:20:33 +01:00
cschwinne
33036e7599 Fix sliders on page load if black is set 2021-12-01 00:16:43 +01:00
Christian Schwinne
f6e5b67f0d
Merge pull request #2285 from Aircoookie/CCT-support
CCT (color white balance support)
2021-11-30 23:41:13 +01:00
Jeff Cooper
9547ac353d
Save and load the e131 Proxy Universe setting in the DMX menu (#2365) 2021-11-30 23:10:23 +01:00
cschwinne
48339b19d4 Status LED support in Bus manager 2021-11-30 22:52:17 +01:00
Blaz Kristan
0f8d464706 Use sacrificial pixel as a STATUSLED 2021-11-30 16:28:26 +01:00
Blaz Kristan
d6be7b4cae cdata.js and simple UI optimization. 2021-11-30 16:27:55 +01:00
Blaž Kristan
70aa01b261 Bugfix to allow more than 10 buttons. 2021-11-28 11:24:58 +01:00
cschwinne
11c7ffad4e Alexa and UDP sync CCT support 2021-11-28 04:01:58 +01:00
cschwinne
1973424e05 Remove JSON ledmap
(to be implemented in #2336 )
2021-11-28 01:27:51 +01:00
Christian Schwinne
16d97d3c63
Merge branch 'master' into CCT-support 2021-11-28 01:21:57 +01:00
cschwinne
3e6728fedb Only do auto white calc for busses with white channel
Revert auto white to global setting
Rounded /settings buttons by blazoncek
Removed obsolete script from /settings
2021-11-28 01:21:17 +01:00
cschwinne
3e9aea072d CCT blending setting 2021-11-27 16:49:42 +01:00
Blaz Kristan
fcfb73c755 Merge branch 'master' into dev 2021-11-27 15:05:32 +01:00
Blaz Kristan
12ce3282ff Dynamic position of repeat button. 2021-11-27 14:31:23 +01:00
Blaz Kristan
9f3e66fff0 Cleaning up indentations (sorry but my OCD is strong). 2021-11-27 11:50:18 +01:00
cschwinne
624993fc89 CCT transitions 2021-11-27 01:33:48 +01:00
cschwinne
ba8a00764a cctFromRgb option 2021-11-26 20:18:38 +01:00
Blaž Kristan
49f79a331c Allow different 1st segment. 2021-11-26 09:39:49 +01:00
cschwinne
3dec4a6651 UI slider and CCT adjustments 2021-11-26 02:06:05 +01:00
Blaz Kristan
ac0a853030 Optimised autosegments. 2021-11-25 22:17:40 +01:00
Blaz Kristan
e8ae4e76a3 CRLF fix. 2021-11-25 22:05:16 +01:00
Blaz Kristan
c73b098f30 Autocreate identical segments. 2021-11-25 22:04:05 +01:00
Blaz Kristan
4292e26135 More lehible links.
Fixed AP xreation on boot with wifi enabled.
2021-11-25 06:41:37 +01:00
cschwinne
02fb2550d0 Shorter link color 2021-11-24 12:38:54 +01:00
cschwinne
37bd525638 Improve link contrast 2021-11-24 11:04:50 +01:00
cschwinne
ea0f37f5b9 CCT bus manager logic simplification
CCT from RGB if none set (-1)
2021-11-24 11:02:25 +01:00
Blaz Kristan
d09d7521d6 Collapsing expanded dialogs in UI. 2021-11-23 20:21:22 +01:00
Blaz Kristan
20d03cb817 Incrementing & random effect, palette via JSON API
Moved utility functions to util.cpp
2021-11-23 20:20:19 +01:00
Blaz Kristan
97b3c3db7b Incrementing & random effects, palettes via JSON. 2021-11-23 20:05:51 +01:00
cschwinne
b97b6dc144 Remove F macro for "ps" 2021-11-23 13:17:33 +01:00
Blaz Kristan
b07bbab069 Merge branch 'master' into dev
Retained GPIO16 as default on ESP32.
2021-11-22 22:50:26 +01:00
cschwinne
c8d5218c65 Updated outdated wiki links in readme 2021-11-22 22:23:51 +01:00
cschwinne
80a657965e Fixed preset cycle not working from preset called by UI 2021-11-22 21:41:04 +01:00
cschwinne
b3324d22f5 allowCCT performance improvement 2021-11-21 23:46:44 +01:00
Blaz Kristan
295663f6a6 Removed loadInfo().
Fixed UI when no WS available.
2021-11-21 14:14:39 +01:00
Blaz Kristan
47caa2c3a0 Missing releaseJSONBufferLock() in IR code 2021-11-21 09:33:54 +01:00
Blaz Kristan
4ddc422cfa More bugfixes. 2021-11-20 19:31:28 +01:00
Blaz Kristan
856c8aa611 Bugfix for effect names. 2021-11-20 18:28:59 +01:00
Blaz Kristan
6f600f74af A few additional descriptions. 2021-11-20 14:35:44 +01:00
Blaz Kristan
be8db602b8 New endpoint for UI slider control (WLED-SR ext.)
Minor UX optimizations.
2021-11-20 12:26:04 +01:00
Blaz Kristan
7871e868a9 Stupid bugfix. 2021-11-19 22:16:08 +01:00
Blaz Kristan
44467971f2 Minor fix. 2021-11-19 22:01:37 +01:00
Blaz Kristan
108fc4a0d8 Pin manager enhancements (sharing I2C pins).
Effect helpers in UI.
2021-11-19 21:49:23 +01:00
cschwinne
31b7cdff9b Change effect names to be more consistent 2021-11-19 12:34:14 +01:00
Christian Schwinne
0465298507
Merge branch 'master' into CCT-support 2021-11-18 16:50:24 +01:00
Blaz Kristan
65ac8d4b2b Merge branch 'master' into dev 2021-11-17 21:42:27 +01:00
Blaz Kristan
dd59e3a831 Rounded buttons. 2021-11-17 17:28:52 +01:00
Blaz Kristan
1e98d56bb6 Removed conditional compile. 2021-11-17 16:34:08 +01:00
cschwinne
d31e4c7815 Added getPinOwner
Only disable builtin LED if bus to avoid breaking other things on the pin
2021-11-17 11:13:07 +01:00
cschwinne
4af1f62aab Revert testing PIO changes 2021-11-17 01:19:04 +01:00
cschwinne
bc403440ba 0.13.0-b5 2021-11-17 01:18:19 +01:00
Christian Schwinne
38d8dfe5ab
Improv support (#2334)
* Working Improv device identification

* Improv functional

* Cast fix

* Minor fix for two back-to-back Improv packets

* Improv checksum update and logic simplification

* Improved improv failed connection behavior
2021-11-16 23:20:26 +01:00
Blaž Kristan
bee93f4743 Merge branch 'dev' of https://github.com/blazoncek/WLED into dev 2021-11-16 08:25:21 +01:00
Blaž Kristan
9888510158 Updated readme.md for usermods. 2021-11-16 08:25:01 +01:00
Blaz Kristan
5fd4ed91d8 Fix for unselected effect on UI load. 2021-11-15 18:40:17 +01:00
Blaž Kristan
2a949cd8f1 added notification option for PIR usermod. 2021-11-15 14:49:41 +01:00
Blaz Kristan
312cbc86e9 Bugfix.
Debugging info added.
2021-11-14 16:56:34 +01:00
Blaz Kristan
85ded6e500 Advanced locking with time-out.
Bugfixes.
2021-11-12 23:33:10 +01:00
Blaz Kristan
ce5a81d83c Minor UI fix. 2021-11-11 22:48:50 +01:00
Blaz Kristan
eb92c0bbf5 Fix for ACCURATE auto-white mode. 2021-11-11 17:34:38 +01:00
Blaž Kristan
5453ae81a6 Fix for white calculation in ACCURATE mode. 2021-11-11 07:20:17 +01:00
Blaz Kristan
ff84f2b2f7 Merge branch 'master' into dev 2021-11-10 16:50:39 +01:00
Jeff Cooper
6df64d0d31
Fix a bug which prevents DMX channel mappings from loading correctly. (#1525) (#2328) 2021-11-10 00:29:04 +01:00
Blaz Kristan
e9ac20a149 Merge branch 'master' into dev 2021-11-09 21:27:58 +01:00
cschwinne
83753a5f81 Fixed no gamma correction for JSON individual LED control 2021-11-09 17:50:29 +01:00
Blaz Kristan
7a228cac43 Bugfix for network 'pin' conflict. 2021-11-09 17:49:05 +01:00
Blaz Kristan
3161f5fa47 Fix for network 'pin' conflicts. 2021-11-09 17:46:05 +01:00
Blaž Kristan
442741d246 Merge branch 'master' into dev 2021-11-09 14:07:46 +01:00
Christian Schwinne
5784092c1b
Fix settings JS buffer too small (#2323) 2021-11-09 09:56:02 +01:00
Blaž Kristan
d6ad089c60
Merge pull request #2324 from yoeywire/DMXdefine
Corrected WLED_USE_DMX to WLED_ENABLE_DMX
2021-11-09 07:57:41 +01:00
Blaz Kristan
89ff8b3fcb Merge branch 'single-doc' into dev 2021-11-08 21:51:26 +01:00
Blaz Kristan
5773f141b8 Minor changes.
Added compile-time WS2801 bus speed option WLED_WS2801_SPEED_KHZ.
2021-11-08 21:51:15 +01:00
yoeywire
446b4b084c Changed WLED_USE_DMX to WLED_ENABLE_DMX 2021-11-08 17:05:47 +01:00
Blaz Kristan
f8da8f6929 Added conditional compile for dynamic JSON buffer.
- WLED_USE_DYNAMIC_JSON
Minor fixes.
2021-11-07 11:58:16 +01:00
Blaz Kristan
f7de055f67 Minor tweaks. 2021-11-06 10:35:00 +01:00
Blaz Kristan
07d09aea85 Make WS onLoad(). 2021-11-05 23:25:11 +01:00
Blaz Kristan
f63ceed1ae LoadInfo WS. 2021-11-05 23:01:23 +01:00
Blaz Kristan
b93d72296c Async response bugfix. 2021-11-05 23:00:38 +01:00
Blaz Kristan
d590e01a58 Merge branch 'master' into CCT-support 2021-11-05 21:27:52 +01:00
Blaz Kristan
1bc15a8507 Increased JSON buffer on 8266.
Minor tweaks.
2021-11-04 21:19:16 +01:00
Shaun Eccles-Smith
adeb9bccb1
Use New Issue Forms for Bug Reports (#2312)
* Convert to Github Issue Forms

* Remove pre-filled title

* Change bug report from textarea to input
2021-11-04 12:23:53 +01:00
Blaž Kristan
5cf26af9f0 Merge branch 'dev' into single-doc 2021-11-04 10:05:02 +01:00
Blaž Kristan
04c9646e05 Merge branch 'master' into dev 2021-11-04 10:04:21 +01:00
Blaz Kristan
67bf1a93e4 Removed dynamic dependency. 2021-11-03 22:47:34 +01:00
Blaz Kristan
c263f11170 Merge branch 'dev' into single-doc 2021-11-03 19:57:52 +01:00
Blaz Kristan
bb4c646714 Bugfix.
Added Enabled option to 4LD usermod.
2021-11-03 18:01:13 +01:00
cschwinne
b44ffffed8 Fixed DDP override 2021-11-03 16:14:01 +01:00
Blaž Kristan
bd521f858e Single JSON buffer. 2021-11-03 14:52:22 +01:00
Blaž Kristan
f66fcfbe6d Minor change in handling mode names. 2021-11-03 12:08:29 +01:00
Christian Schwinne
2bdaf53ecf
Merge pull request #2311 from underritoSR/master
Add MX-CST/CDT Time Zone
2021-11-03 09:14:22 +01:00
Rod Minor
46e7db6d94 Add MX-CST/CDT Time Zone
Add the Mexico City CST/CDT timezone.
The start and finish date for DLS differs with the US-CST/CDT rules.
2021-11-02 21:26:11 -06:00
Blaž Kristan
10fc9fe268 Updated usermods for WLED-SR FX mode names. 2021-11-02 13:12:14 +01:00
Blaz Kristan
73c75635b1 Update simple page.
Code simplification.
2021-10-31 22:23:26 +01:00
Blaz Kristan
cc7d745ce6 Adopted WLED-SR slider, color & palette control.
Added "freeze" toggle to a stopwatch icon.
2021-10-31 15:52:41 +01:00
Christian Schwinne
7e1920dc4b
Remove ledCount (#2300)
Bus initialization on reading from eeprom
2021-10-31 11:57:41 +01:00
Blaž Kristan
a93f05c047
Multirelay button support. (#2284)
* Multirelay button support.
Added button hook for usermods.

* Added MultiRelay relay states to JSON state object

* Move button timings to constants

No delay waiting for double press on button 0 if no macro set

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2021-10-31 11:57:03 +01:00
Christian Schwinne
00238247cd
JSON in/decrementing (#2258)
* Initial JSON in/decrementing

* Segment brightness in/decrement

* Update json-increment (#2290)

* Add Basic Overlay support to Usermods.

* Add seven segment overlay usermod

* Add seven_seg debug build

* Add scrolling message to seven seg um

* Fixed red color on IP address

* bh1750

* Add msg scroll. Add MQTT and Config support

* Add readme

* Restore platformio.inii

* Edit comments

* Add strip off refresh option in LED settings. (#2259)

* Add strip off refresh option in LED settings.
New strip initialization logic.
Minor code clen-up.

* Dev code removal.

* Missing ethernet include

* Renamed mainseg to selseg

* Fix for preset cycling bounds.

* "Preset 0" bugfix.

* Auto segments only if segments were not modified

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>

* Exclude virtual busses from current calculation (#2262)

* Refactor string usage

* 0.13.0-b4

* Fix MQTT Null publish

* Additional Flash string concat

* Add AKST/AKDT

* UM RGB-Rotary-Encoder: Properly used PinOwner

* Cycling bugfix.

Co-authored-by: Gregory Schmidt <gregory.b.schmidt@hotmail.com>
Co-authored-by: Blaž Kristan <blaz@kristan-sp.si>
Co-authored-by: Caleb Mah <calebmah@gmail.com>
Co-authored-by: ezcGman <ich@andy-hofmann.com>

* Working JSON preset cycle

* Fix some Codacy style issues

Co-authored-by: Gregory Schmidt <gregory.b.schmidt@hotmail.com>
Co-authored-by: Blaž Kristan <blaz@kristan-sp.si>
Co-authored-by: Caleb Mah <calebmah@gmail.com>
Co-authored-by: ezcGman <ich@andy-hofmann.com>
2021-10-30 14:42:17 +02:00
Andy Hofmann
b33e28835d
New Usermod: QuinLED-An-Penta (#2296)
* UM QuinLED-An-Penta: First version

* UM QuinLED-An-Penta: Made OLED seconds a setting; small improvements

* UM QuinLED-An-Penta: Fixed unique ID

* Merge branch 'master' of https://github.com/Aircoookie/WLED

* UM QuinLED-An-Penta: Fixed config loading

* UM QuinLED-An-Penta: Replaced ledcRead() with calculating the percentage

* UM QuinLED-An-Penta: Fixed temp sensor readings

* UM QuinLED-An-Penta: Removing OLED bus clk setting

* UM QuinLED-An-Penta: ETH support, lots of OLED improvements
2021-10-30 11:38:09 +02:00
Blaz Kristan
044d830b64 Removing palettes on Solid effect.
Bubbling bugfix for effect selection.
Re-introduced 'tt'.
2021-10-29 23:55:42 +02:00
Blaz Kristan
38c84bb1f6 Minor tweak. 2021-10-29 22:30:20 +02:00
Blaz Kristan
b50e066dee Reintroduction of STATUSLED 2021-10-27 17:49:35 +02:00
Blaž Kristan
f55f803531
Updated aut-white calculation. 2021-10-27 14:02:48 +02:00
Blaž Kristan
757e8eb57c Bugfix in auto-white calculation. 2021-10-27 08:17:51 +02:00
Blaz Kristan
a696afaeb8 Color mangling macros.
Removed legacy Auto White caclulation.
2021-10-26 20:35:45 +02:00
Blaz Kristan
8ca298b299 Removed legacy auto-white calculation.
Introduced color mangling macros.
Minor optimizations/fixes.
2021-10-26 19:17:42 +02:00
Blaz Kristan
cde497c94e Fixing conflict merge errors. 2021-10-26 06:29:49 +02:00
Blaz Kristan
090e29effd Moved auto white calculation to bus manager.
Other minor fixes.
2021-10-25 20:15:42 +02:00
Blaž Kristan
94cf6424f5 Added MultiRelay relay states to JSON state object 2021-10-25 14:09:51 +02:00
Blaz Kristan
b8013a57e2 Moved auto white calcualtion into bus manager. 2021-10-24 21:07:05 +02:00
Blaz Kristan
1b23210902 Bus manager changes for easier CCT & auto white.
Attempted per-strip auto white calculation (odd bug encountered).
2021-10-23 15:41:35 +02:00
Blaz Kristan
0acca2e313 Cycling bugfix. 2021-10-22 23:24:41 +02:00
Blaz Kristan
4bb30deca6 Gap bugfix. 2021-10-22 21:36:54 +02:00
Blaz Kristan
31bf615fe8 Playlist bugfix. 2021-10-22 21:31:03 +02:00
Blaz Kristan
0d77027f60 Bugfix for white value. 2021-10-22 07:21:47 +02:00
Blaz Kristan
bbf46358fa Fix for simple page. 2021-10-21 22:59:47 +02:00
Blaz Kristan
1cf793233f Removed experimental v2 segment API.
Bugfix for white value.
2021-10-21 21:33:26 +02:00
Blaz Kristan
39b7b3ad53 CCT (color white balance support) 2021-10-20 20:29:13 +02:00
Blaz Kristan
7acc537c7a Added JSON info to doc and multiple relay control. 2021-10-20 18:12:24 +02:00
Blaz Kristan
97c1a2245b Too much yield()ing hutrs. 2021-10-18 20:00:11 +02:00
Blaz Kristan
8e9269fdf9 Button support for multi-relay usermod. 2021-10-18 17:37:51 +02:00
Blaz Kristan
d9b2037b50 Multi relay fixes. 2021-10-17 20:56:24 +02:00
Blaz Kristan
95827c3ada White slider bugfix.
Increased multi-relay update frequency.
2021-10-17 19:18:56 +02:00
Blaz Kristan
4e2bbc04fa Button handling hook for usermods. 2021-10-17 17:14:55 +02:00
Blaz Kristan
61eff6e7e8 Update build. 2021-10-17 16:26:43 +02:00
Blaz Kristan
1d4d5f0c93 Minor fixes & optimizations. 2021-10-17 14:38:19 +02:00
Blaž Kristan
00f1b483eb
Merge pull request #2279 from ezcGman/um-rgb-rotary-encoder
UM RGB Rotary Encoder: Now properly using the PinOwner class and unique ID
2021-10-17 14:16:18 +02:00
Blaz Kristan
939de6b177 Merge branch 'master' into dev 2021-10-17 10:09:22 +02:00
ezcGman
c3d48acb4c UM RGB-Rotary-Encoder: Properly used PinOwner 2021-10-17 01:24:23 +02:00
Blaz Kristan
ad4bc206ab Configuration templates. 2021-10-16 21:44:53 +02:00
Blaz Kristan
8cfa5ba39e Fix simple CSS.
Add WELD community link.
2021-10-16 15:45:04 +02:00
Blaz Kristan
c2e6d1c6bf Squashed commit of the white-balance branch.
Updated simple UI.
Minor change in ST7789 display.
2021-10-16 15:13:30 +02:00
Blaž Kristan
392bda7d8c
Merge pull request #2261 from AK5nowman/overlayum
Basic Usermod Overlay support & Seven Segment UM
2021-10-13 06:14:32 +02:00
Blaž Kristan
5a658b7080 Merge branch 'dev' of https://github.com/blazoncek/WLED into dev 2021-10-12 17:41:42 +02:00
Blaz Kristan
a6adb314ec Clean up settings CSS. 2021-10-11 17:55:26 +02:00
Blaž Kristan
5714578783 Refactoring & code clean-up.
- utility functions
- network functions
- math functions
2021-10-11 14:13:34 +02:00
Blaž Kristan
539125ff47 Merge branch 'master' into dev 2021-10-11 10:56:25 +02:00
Blaž Kristan
10cfcdab8c
Merge pull request #2264 from AK5nowman/Alaskatime
Add AKST/AKDT Time Zone
2021-10-11 07:37:52 +02:00
Gregory Schmidt
3f71d3b250 Add AKST/AKDT 2021-10-10 19:09:48 -08:00
Gregory Schmidt
1b50fbab22 Additional Flash string concat 2021-10-10 17:24:36 -08:00
Gregory Schmidt
303fc65a6a Merge branch 'master' of https://github.com/Aircoookie/WLED into overlayum 2021-10-10 17:06:12 -08:00
Gregory Schmidt
445b6ee13f Fix MQTT Null publish 2021-10-10 17:05:55 -08:00
cschwinne
8afaac1e30 0.13.0-b4 2021-10-11 02:42:58 +02:00
Gregory Schmidt
0327f9428e Merge branch 'master' of https://github.com/Aircoookie/WLED into overlayum 2021-10-10 16:27:47 -08:00
Gregory Schmidt
a5de66bbd5 Merge branch 'overlayum' of https://github.com/AK5nowman/WLED into overlayum 2021-10-10 16:26:42 -08:00
Gregory Schmidt
d47157eec3 Refactor string usage 2021-10-10 16:26:14 -08:00
Christian Schwinne
f4b47ed399
Exclude virtual busses from current calculation (#2262) 2021-10-11 02:19:53 +02:00
Blaž Kristan
8b2145bd88
Add strip off refresh option in LED settings. (#2259)
* Add strip off refresh option in LED settings.
New strip initialization logic.
Minor code clen-up.

* Dev code removal.

* Missing ethernet include

* Renamed mainseg to selseg

* Fix for preset cycling bounds.

* "Preset 0" bugfix.

* Auto segments only if segments were not modified

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2021-10-11 02:19:33 +02:00
Christian Schwinne
de454e8b78
Edit comments 2021-10-11 01:29:13 +02:00
Gregory Schmidt
6cd770b4c7 Restore platformio.inii 2021-10-09 11:29:41 -08:00
Gregory Schmidt
355525c248 Add readme 2021-10-09 11:14:52 -08:00
Blaz Kristan
53237c297f "Preset 0" bugfix. 2021-10-09 10:42:49 +02:00
Gregory Schmidt
47d4e7381f Merge 'master' of Aircoookie/WLED into overlayum 2021-10-08 00:00:09 -08:00
Gregory Schmidt
5dac6690d7 Add msg scroll. Add MQTT and Config support 2021-10-07 23:56:57 -08:00
Blaž Kristan
2d8885cb0c Bus manager cleanup & fixes. 2021-10-08 08:30:06 +02:00
Christian Schwinne
b89f7180db
Merge pull request #2257 from calebmah/bh1750-usermod
Add BH1750 usermod
2021-10-07 23:52:48 +02:00
Blaz Kristan
4fdf85bbdb Add off override. 2021-10-07 22:57:07 +02:00
Caleb Mah
2ebb837a15 bh1750 2021-10-08 02:11:39 +08:00
Blaz Kristan
728d57d955 Skipped 'npm run build' fix. 2021-10-07 16:03:55 +02:00
Blaz Kristan
e53a2e7b43 Conflict merge (warning) fix. 2021-10-07 15:43:36 +02:00
Blaz Kristan
e682fd07cb Reverted currentPlaylist. 2021-10-07 15:41:30 +02:00
Blaž Kristan
849aa64678 Fixed red color on IP address 2021-10-07 14:11:47 +02:00
Blaž Kristan
bddd22cfab Merge branch 'master' into dev 2021-10-07 13:47:36 +02:00
Blaz Kristan
19310470b6 Nonsense fix. 2021-10-06 19:52:21 +02:00
Blaz Kristan
02fcccc8c7 Allow playlist as end preset in playlist.
Playlist chaining.
2021-10-06 19:12:30 +02:00
Blaz Kristan
9f230ae339 RAM optimizations:
- changed int16_t to byte for currentPreset and currentPlaylist
- removed presetCycXxxxx variables
2021-10-06 18:43:12 +02:00
Blaz Kristan
7b21c1bcbe Added option to preserve old state in PIR usermod 2021-10-04 20:24:33 +02:00
Blaz Kristan
9c295d1884 Implemented temporary presets. 2021-10-04 20:22:04 +02:00
Blaž Kristan
aef53a8753 Network bus changes:
- moved brightness scaling to broadcast fn
- removed double buffer
- fixed getPixelColor()
2021-10-04 13:44:44 +02:00
Blaž Kristan
5149078f6a
Merge pull request #9 from pbolduc/cleanup-add-remove-classes
use classList add/remove instead of edit className with string functions
2021-10-04 11:55:22 +02:00
Blaž Kristan
4d95248f16 PWM fan startup speed bugfix. 2021-10-04 11:49:47 +02:00
Blaž Kristan
368f52ade6 Added configurable PWM fan parameters:
- min PWM value (%)
- IRQs per rotation
2021-10-04 11:32:56 +02:00
Phil Bolduc
8cc2ba4770 use classList add/remove instead of edit className with string functions 2021-10-03 15:41:50 -07:00
Blaz Kristan
f40398bf42 Removed double function definition in index.js. 2021-10-03 20:05:32 +02:00
Blaz Kristan
783a21d88d Fix for incorrect RPM reported. 2021-10-03 14:00:29 +02:00
Blaz Kristan
62e7c861bd Added readme for PWM fan usermod. 2021-10-03 10:27:01 +02:00
Blaz Kristan
9d5b6eac55 PWM fan usermod. 2021-10-02 22:45:42 +02:00
Blaz Kristan
72c5de6eae Minor optimization in Temperature UM. 2021-10-02 22:32:33 +02:00
Blaz Kristan
1d833419aa Merge branch 'master' into dev 2021-10-02 15:41:13 +02:00
Gregory Schmidt
d00b4335b5 Add scrolling message to seven seg um 2021-10-01 21:34:20 -08:00
Blaz Kristan
e17e2a636b Added permanent DDP UDP listener. 2021-10-01 21:56:54 +02:00
Gregory Schmidt
3ac772badc Add seven_seg debug build 2021-09-29 20:59:02 -08:00
Gregory Schmidt
22fc58d93b Add seven segment overlay usermod 2021-09-29 20:01:26 -08:00
Gregory Schmidt
ccd3152b24 Add Basic Overlay support to Usermods. 2021-09-29 19:23:32 -08:00
Blaz Kristan
45e0cbdb25 Brightness change also needs colorUpdated() 2021-09-29 17:43:54 +02:00
Blaz Kristan
dc9d48850f Added PIR sensor night time presets.
Added PIR sensor Disable/Enable button.
UI refinements.
Added colorUpdated() on HTTP API in IR JSON.
2021-09-28 23:27:40 +02:00
Blaz Kristan
9092549f07 Fix for mamory requirement calculation.
- network bus using double buffer
2021-09-27 17:14:31 +02:00
Blaz Kristan
a94b5ba0c0 Merge branch 'master' into dev 2021-09-27 16:31:28 +02:00
Blaz Kristan
5d1efd84a4 Permanent double buffer. 2021-09-27 16:29:38 +02:00
Blaz Kristan
8af953e20d Fix getPixelColor. 2021-09-26 20:01:04 +02:00
Blaz Kristan
66132a912a Brightnes bugfix in BusNetwork class. 2021-09-26 19:51:40 +02:00
Blaz Kristan
b852cbdc80 Novosibirsk time-zone. 2021-09-26 17:12:13 +02:00
Blaz Kristan
350caee808 Revert platform update.
Minor code optimisation.
2021-09-26 12:13:18 +02:00
Blaž Kristan
7d05236514 Add "on":true to playlist JSON. 2021-09-24 12:15:03 +02:00
Blaž Kristan
465b43be6a
Added paypal.me 2021-09-24 06:56:54 +02:00
Blaz Kristan
006edacd55 Virtual WLED spanning multiple instances.
- added BusNetwork class to BusManager
- added DDP realtime data broadcast
Added SW= option to HTTP API.
Fixed z-index on nodes list.
2021-09-23 21:44:24 +02:00
Blaz Kristan
a9666a9f6e Merge branch 'virtual-bus' into dev 2021-09-23 21:16:59 +02:00
Blaz Kristan
7de492caa7 Compiling for ESP8266. 2021-09-23 21:13:44 +02:00
Blaz Kristan
93ee4716cc Wled math bugfix. 2021-09-23 20:45:53 +02:00
Blaz Kristan
8a60d4cf2f Upgrade platforms.
Wled math fix.
2021-09-23 20:33:44 +02:00
Blaž Kristan
6489444158 Additional fix. 2021-09-23 06:55:08 +02:00
Blaž Kristan
59a66a3ea5 Buffer filling bugfix. 2021-09-23 06:52:48 +02:00
Blaz Kristan
e17550e23e Debug cleanup. Minor tweks. 2021-09-22 21:52:06 +02:00
Blaz Kristan
0f8d6daf99 Bus creation bugfix. Removed debug code. 2021-09-22 19:13:52 +02:00
Blaž Kristan
08925a72c6 Renamed BusVirtual to BusNetwork
- added options for E1.31 and ArtNet
- added check for initialised network
2021-09-22 13:20:36 +02:00
Blaž Kristan
1101299168 Fixing conflict merge. 2021-09-22 07:09:01 +02:00
Blaž Kristan
22be8e2e9d Merge branch 'dev' into virtual-bus 2021-09-22 07:06:18 +02:00
Blaž Kristan
6db2240f8a Merge branch 'master' into dev
(mostly ignored index.js)
2021-09-22 06:58:49 +02:00
Blaz Kristan
54eac18eea Bugfixes for saving and loading IP address.
Debug info for UDP.
2021-09-21 22:18:55 +02:00
Blaž Kristan
284e748449 Merge remote-tracking branch 'pbolduc/feature/upd-ddp-send' into virtual-bus 2021-09-21 07:29:26 +02:00
Blaž Kristan
3111718eb1 Fix for pin conflicts on save. 2021-09-21 06:25:36 +02:00
Phil Bolduc
fd8d17c5e5 Removed local buffer as WiFiUDP loops over input array anyways 2021-09-20 20:47:48 -07:00
Phil Bolduc
109bb62209 fix corrupt heap when writing upd 2021-09-20 19:01:54 -07:00
Phil Bolduc
cc661b26fa fix spelling error, be smarter how we write data to udp 2021-09-20 16:57:54 -07:00
Phil Bolduc
ea69957ed1 Fix spelling error 2021-09-20 15:53:20 -07:00
Phil Bolduc
700f641e29 Change signature of realtimeBoroadcast to match blazoncek 2021-09-20 15:51:12 -07:00
Phil Bolduc
83f4eeb3b5 Add support for RGB and RGBW, fix bug where not enough data written 2021-09-20 15:21:19 -07:00
Phil Bolduc
d1f4cdebf3 Move new ddp/udp functions into udp.cpp 2021-09-20 15:04:16 -07:00
Blaz Kristan
d95ba43fd1 Virtual bus implementation.
Base for virtual WLED set-up (multiple instances acting as one).
UDP broadcast not yet implemented.
2021-09-20 22:24:58 +02:00
Phil Bolduc
7dc07f6d21 Change parameter order for better stack alignment 2021-09-19 15:30:17 -07:00
Phil Bolduc
6472d35d91 optimze copyRgbwToRgb, do not copy too much data into buffer 2021-09-19 15:20:06 -07:00
Phil Bolduc
95c87919a8 return ok status code and free buffer 2021-09-19 12:11:57 -07:00
Phil Bolduc
077b4d5c89 Add initial DDP UDP output 2021-09-19 12:08:05 -07:00
Blaz Kristan
a2105de402 Nesting bug fix. 2021-09-19 14:56:14 +02:00
Blaz Kristan
d049e0a149 Fix for missing inverse for analog bus.
Fix for usermod pin settings not being accounted for.
2021-09-19 14:28:27 +02:00
Blaz Kristan
7463be862f Merge branch 'master' into dev 2021-09-18 22:43:26 +02:00
Blaz Kristan
bc6652f443 Segment names fixes.
Minor UI changes:
 - new font
 - removed transition
2021-09-18 13:15:19 +02:00
Blaz Kristan
56167f84ad Added I2C clock frequency parameter for 4LD. 2021-09-15 23:51:49 +02:00
Blaz Kristan
db4ecce20b Reduced values of parameters for 8266:
- max segments to 16
- effect buffer to 3.5k
- max number of LEDs to 1200
2021-09-12 13:31:47 +02:00
Blaz Kristan
95518f1948 Fix for incorrect memory de-allocation. 2021-09-12 12:33:23 +02:00
Blaz Kristan
d4beb2f79b Merge branch 'master' into dev
Excluded modifications to ir.cpp
Changed default segment creation logic.
2021-09-12 01:00:54 +02:00
Blaz Kristan
9be995bb08 4LD & AutoSave usermod fixes.
Debugging usermod time.
2021-09-11 23:32:36 +02:00
Blaz Kristan
c1d47290b1 police_base optimisations. 2021-09-08 23:26:41 +02:00
Blaz Kristan
4d6116ed40 Minor usermod optimisations. 2021-09-08 23:25:05 +02:00
Blaž Kristan
18ba394901 Changed behaviour of effects.
- Police (col1 for bg)
- Two areas (changable width, col1 for bg)
- Two dots (changable width)
2021-09-08 07:54:40 +02:00
Blaz Kristan
3a83753611 Rewritten police_base effect.
Optimisation in 4LD.
2021-09-07 22:59:31 +02:00
Blaž Kristan
c436b586d2 Merge branch 'master' into dev 2021-09-06 13:36:26 +02:00
Blaz Kristan
f84e2c2ac7 Debug conditional compile in pin manager. 2021-09-04 16:45:08 +02:00
Blaz Kristan
4e8c94fd2d Fix for unknown IR codes in IR JSON.
Fix for T=2 not updating lights in IR JSON.
Correct handling of missing ir.json file.
2021-09-03 22:00:47 +02:00
Blaž Kristan
8f3fd37d47 Updated fallback random FX limit. 2021-09-03 10:10:47 +02:00
Blaž Kristan
7960e9b309 Bugfix for missing IR.json error code. 2021-09-03 08:25:18 +02:00
Blaz Kristan
4875544888 Enhanced ST7789 display usermod. 2021-08-28 21:59:52 +02:00
Blaz Kristan
849bdc52f6 Ethernet modifications.
Added fixed Ethernet pins to cfg.json and settings page
2021-08-27 19:48:55 +02:00
Blaž Kristan
63bb05b2d4 Fix compile for ethernet. 2021-08-26 09:32:06 +02:00
Blaž Kristan
916ad0a58e Merge branch 'master' into dev 2021-08-26 09:09:41 +02:00
Shaheen Gandhi
15055fa509 Add network debug printer 2021-08-25 17:59:48 -07:00
Blaz Kristan
8ee704e123 Added toast confirmation for clearing LS. 2021-08-25 22:37:16 +02:00
Blaz Kristan
0d552cd880 Button rewrite.
Buttons >0 behave differently than 0.
2021-08-25 21:24:56 +02:00
Blaž Kristan
60ce5c67de Merge branch 'sync-groups' into dev 2021-08-25 06:26:50 +02:00
cschwinne
421f932053 Send sync group options as bytes, parse in JS 2021-08-25 00:36:31 +02:00
cschwinne
542d6361f2 Make packets with version < 9 group 1 2021-08-24 23:59:09 +02:00
Blaz Kristan
81bafa00ac Minor tweaks. 2021-08-24 23:33:41 +02:00
Blaz Kristan
84d0c17c4b Compile warnings eliminated.
Minor typo.
DEBUG_PRINTF fix for 8266
2021-08-24 21:35:47 +02:00
Blaz Kristan
be7e2bed6f Bugfix for edge case of FX=~ within playlist. 2021-08-23 21:51:36 +02:00
Blaž Kristan
a7bfd0af41 Changed sync default to group 1 only. 2021-08-23 07:37:34 +02:00
Blaz Kristan
55ef547a85 Memory allocation fixes for effects. 2021-08-22 22:16:25 +02:00
Blaz Kristan
19129c8786 Simple page CSS & JS update.
Added simple UI as a separate page (/simple.htm).
2021-08-21 18:12:38 +02:00
Blaz Kristan
b5737ce9c1 Shortened string. 2021-08-21 12:30:40 +02:00
Blaz Kristan
f921d9a1f8 Added UDP sync groups. 2021-08-21 12:28:22 +02:00
Blaz Kristan
9609b48f2f Added UDP sync groups. 2021-08-21 12:22:26 +02:00
Blaz Kristan
5926d396f9 Merge branch 'master' of https://github.com/aircoookie/WLED into dev 2021-08-20 23:32:28 +02:00
Blaz Kristan
7cf16766c4 Clear local storage button.
Removed skin.css from settings pages.
2021-08-20 19:38:24 +02:00
Blaz Kristan
0e200e0c34 Center text on display. 2021-08-20 19:37:05 +02:00
Blaž Kristan
771a544d0f Removed reference to tdd. 2021-08-20 09:54:54 +02:00
Blaz Kristan
fba707f6a8 Merge branch 'spi-display' into dev 2021-08-19 21:57:18 +02:00
Blaz Kristan
4e28e2cb59 Merge branch 'master' into dev 2021-08-19 21:57:04 +02:00
Blaz Kristan
5c3c8b7b8a SPI display option for 4 Line Display usermod. 2021-08-19 16:13:30 +02:00
Blaž Kristan
6a52a1dc63 Add option to load custom CSS and custom holidays.json 2021-08-18 13:41:54 +02:00
Blaz Kristan
445825df44 Merge branch 'dev' of github.com:blazoncek/WLED into dev 2021-08-17 16:28:16 +02:00
Blaz Kristan
b93c47fa60 Option to disable Loxone. 2021-08-17 16:28:12 +02:00
Blaž Kristan
90b831600f Removed developmnet/debugging code. 2021-08-17 09:06:37 +02:00
Blaz Kristan
b3dd368920 JS optimisation.
Namelabel clarity.
2021-08-16 18:24:06 +02:00
Blaz Kristan
c8db90b644 Bugfix pin check. 2021-08-16 16:20:46 +02:00
Blaz Kristan
7ed65529df Minor button CSS optimisations. 2021-08-15 22:05:36 +02:00
Blaz Kristan
a8b59f5f59 Replaced fixed color values in CSS & JS w/ --c-?. 2021-08-13 11:43:17 +02:00
Blaz Kristan
eb966ec041 Typo fix. 2021-08-13 10:55:32 +02:00
Blaz Kristan
588789cb77 Random color background.
Few tweaks.
2021-08-12 15:47:22 +02:00
Blaz Kristan
3640f977c8 Simple CSS bugfix. 2021-08-12 12:12:45 +02:00
Blaz Kristan
28f12a4874 More CSS & JS optimisations. 2021-08-12 11:14:53 +02:00
Blaz Kristan
93378406c3 Additional CSS optimisations. 2021-08-11 21:28:31 +02:00
Blaz Kristan
602d04af82 Invaliating browser cache after UI selection change 2021-08-10 21:52:07 +02:00
Blaz Kristan
dcfbf2b154 Simplified UI and general UI polishing (CSS, HTML & JS).
Boot transition fix.
Local storage invalidation when uploading presets.json.
2021-08-10 17:11:17 +02:00
Blaz Kristan
5c6d755750 Added title to node button. 2021-08-01 12:19:44 +02:00
Blaz Kristan
3c545d488d Remove local storage for presets on presets.json restore. 2021-07-30 17:45:47 +02:00
Blaz Kristan
bd0f84605f UI JS optimisations/code reduction. 2021-07-29 22:55:20 +02:00
Blaz Kristan
6e9a69be5c Fix for missing off-only MQTT messages.
Automatic WS reconnect.
2021-07-28 22:45:11 +02:00
Blaz Kristan
392df6ba72 Added missing ir.json error type.
Hopefully fix for WS virtual disconnects.
WS debugging info.
2021-07-25 22:44:26 +02:00
Blaz Kristan
c66cffd6a6 Playlist implicitly turns WLED on. 2021-07-23 23:40:38 +02:00
Blaz Kristan
b3b3e3ea20 God damn CRLF conversion. (I want to keep it clean) 2021-07-23 21:48:38 +02:00
Blaz Kristan
067a88b3e7 UI maintaining playlist preset selected. 2021-07-23 18:39:00 +02:00
Blaz Kristan
251d5f4135 Added PIR option to trigger only if WLED is off. 2021-07-23 18:37:34 +02:00
Blaz Kristan
44e574f440 Added WS send debug logging. 2021-07-22 19:08:25 +02:00
Blaz Kristan
9e583f9ff0 Minor UI optimisations. 2021-07-22 15:34:43 +02:00
Blaž Kristan
611816c8e3 Rotary encoder runtime configuration. 2021-07-20 08:14:47 +02:00
Blaz Kristan
0511a62ca1 Optimised requestJson()
CSS fix.
2021-07-19 19:00:21 +02:00
Blaz Kristan
31e34d6f19 Rotary encoder compile fix. 2021-07-18 20:50:43 +02:00
Blaz Kristan
5360fe49d4 Minor holiday background image loading tweak. 2021-07-15 20:08:00 +02:00
Blaz Kristan
bf94febb11 Added configuration backup/restore.
Fixed save dialog compile error.
2021-07-15 18:38:42 +02:00
Blaž Kristan
dbd3bd50df Attempt at forcing Save dialog on preset backup.
Random BG image replaced by holiday BG.
2021-07-15 09:24:10 +02:00
Blaz Kristan
c1a1fb8d87 Backup/restore presets & holiday array upload.
Reduced number of segments on 8266.
2021-07-14 23:10:19 +02:00
Blaz Kristan
b10568e917 Merge branch 'dev' of github.com:blazoncek/WLED into dev 2021-07-14 16:20:16 +02:00
Blaž Kristan
0e1ad39ede Merge branch 'master' into dev 2021-07-14 13:43:42 +02:00
Blaz Kristan
c8ce06d110 Minor UI fix. 2021-07-11 00:26:21 +02:00
Blaz Kristan
b0cfcb1999 Merge branch 'master' into dev 2021-07-10 17:01:20 +02:00
Blaž Kristan
944b857825 Merge branch 'master' into dev 2021-07-08 13:39:22 +02:00
Blaz Kristan
34c8f33c3c Bugfix WS saving preset. 2021-07-07 16:55:22 +02:00
Blaž Kristan
07d74ee692 Default button pin allocation on 1st boot. 2021-07-07 10:18:00 +02:00
Blaž Kristan
d28158bc74 ESP32 S2 fix for RMT channels.
Ethernet pins stored in cfg.json for usermod checks.
2021-07-07 08:12:03 +02:00
Blaz Kristan
8c9fb956ff Bugfix for #2066 2021-07-06 22:08:04 +02:00
Blaz Kristan
db632ae847 Merge branch 'master' into dev 2021-07-06 16:38:13 +02:00
Blaz Kristan
3bef4284e3 Fix for ESP8266 compile. 2021-07-04 22:46:17 +02:00
Blaz Kristan
5229b2959e Fix to use upstream NeoPixelBus on ESP32. 2021-07-04 16:25:33 +02:00
Blaz Kristan
8769234e28 Merge branch 'master' into dev 2021-07-04 15:29:46 +02:00
Blaz Kristan
bbdd1915eb Fix for odd Dallas sensor "not found" behaviour.
Minor flash use reduction.
2021-07-04 14:23:53 +02:00
Blaz Kristan
de8a244500 Minor UI tweaks.
Added WS reconnects.
2021-07-04 12:09:19 +02:00
Blaz Kristan
3066a142b8 Merge branch 'master' into dev
Minor tweaks.
2021-07-03 21:27:06 +02:00
Blaz Kristan
ccf047b1ab Playlist editor UI changes & fixes. 2021-07-02 17:22:47 +02:00
Blaz Kristan
ce725252cc Minor fixes. 2021-07-01 16:40:55 +02:00
Blaž Kristan
73f07b2939 Update html_settings.h 2021-07-01 13:42:22 +02:00
Blaž Kristan
b58efa3df0 Merge branch 'master' into dev 2021-07-01 13:41:23 +02:00
Blaž Kristan
9f885407f5 Merge branch 'master' into dev 2021-07-01 13:24:48 +02:00
Blaz Kristan
ef59fd4b6f Better number handling in Usermod settings.
Added loading /holiday.json for backround image in UI.
Minor style changes.
2021-06-29 18:18:28 +02:00
Blaz Kristan
36e7c2467e Merge branch 'master' into dev 2021-06-27 12:36:04 +02:00
Blaz Kristan
f7ce83ea34 V2 of usermod configuration settings
- added parsing of POST fields to use proper type
- updated readFromConfig() to reflect parsing
- added a possibility to use nested object in UM settings
- internal changes and fixes
2021-06-27 12:15:35 +02:00
Blaz Kristan
81182bb125 Added parsing usermod settings parameters.
Added nested object handling in usermod settings parameters.
2021-06-25 23:20:01 +02:00
Blaz Kristan
2424df0d18 Merge branch 'master' into dev 2021-06-25 15:52:59 +02:00
Blaz Kristan
e9d07eadaa Additional traces of v2 API removed in WS.
JS cleanup.
2021-06-20 21:56:25 +02:00
Blaz Kristan
6f0e944c7e 4 Line Display new type fix. 2021-06-20 16:10:27 +02:00
Blaz Kristan
cd8d2c141e Merge branch 'master' into dev
Added pin reservation for Ethernet.
Added SSD1305 I2C display type.
2021-06-20 15:13:38 +02:00
Blaz Kristan
14ac66ff4e Minor optimisations.
Removed all traces of v2 JSON API.
2021-06-19 23:16:40 +02:00
Blaz Kristan
75bf758042 Incerased max segments.
Removed v2 JSON API.
Replaced col[] array handling.
Settings UI optimisations.
Increased DEBUG output period to 60s.
2021-06-19 18:06:30 +02:00
Blaz Kristan
3acc521741 Bugfix for ESP8266 saving segments. 2021-06-18 12:16:04 +02:00
Blaz Kristan
b7fb9e182b WLED_USE_PSRAM fix 2021-06-16 12:19:16 +02:00
Blaz Kristan
8574bf9d98 Fix for short IP in 4LD. 2021-06-16 09:25:10 +02:00
Blaz Kristan
1a80439825 Merge branch 'master' into dev 2021-06-15 23:36:12 +02:00
Blaz Kristan
28bc07da2f Optimised 4 Line Display.
Added option to display Ethernet IP.
2021-06-15 16:57:02 +02:00
Blaz Kristan
8517cc8211 Alternating IP address and device name on 4 Line Display. 2021-06-13 18:05:30 +02:00
Blaz Kristan
8aa8ae239a PlatformIO.ini Wemos Shield all features.
Removed custom Touchpin build.
2021-06-11 17:09:39 +02:00
Blaz Kristan
024ec86dc5 Unloading playlist on effect change. 2021-06-07 23:45:11 +02:00
Blaz Kristan
f632ef0de8 Default dur from presetCycleTime. 2021-06-07 21:07:15 +02:00
Blaz Kristan
c58ad64a28 Bugfix.
- unloading playlist on playlist apply
- optimisations in handlePlaylist()
2021-06-07 20:44:20 +02:00
Blaž Kristan
cbf3ae4db4 Bugfix.
- unshuffled endless playlist fix.
2021-06-07 14:13:21 +02:00
Blaz Kristan
9ac7acf8b3 Added skinning capability. 2021-06-06 20:36:19 +02:00
Blaz Kristan
9dadb6da4c Added UI feedback for file upload. 2021-06-04 23:08:30 +02:00
Blaz Kristan
b6bbbeb9d3 Merge branch 'dev' of github.com:blazoncek/WLED into dev 2021-06-04 18:25:36 +02:00
Blaz Kristan
517e9f92ba Added uploading IR.json from settings page. 2021-06-04 18:25:33 +02:00
Blaž Kristan
7ec09c80a5 Changed boot preset apply logic. 2021-06-04 06:54:27 +02:00
Blaž Kristan
b0bfe341df Fixed typo. 2021-06-03 13:58:17 +02:00
Blaz Kristan
70cf6546ca Switch rewrite. 2021-06-03 05:50:55 +02:00
Blaz Kristan
0cdab52418 Added.
- PIS sensor switch option for button
Bugfix.
- proper switch high/low handling
2021-06-02 17:13:09 +02:00
Blaž Kristan
777a95d23c Bugfix.
- parentheses fix
2021-06-02 08:46:29 +02:00
Blaž Kristan
06caace827 Bugfix.
- incorrect use of PSTR() on 8266
2021-06-02 08:24:49 +02:00
Blaž Kristan
0a0a766c0d Bugfix.
- pushbutton inverted not saving
- mqtt on/off message
2021-06-02 06:21:43 +02:00
Blaž Kristan
2f9eacdf66 Added MQTT message on button press. 2021-06-01 11:03:18 +02:00
Blaz Kristan
79ac85e048 Small UI improvements.
Added hue selection for analog.
2021-05-30 12:11:34 +02:00
Blaz Kristan
23c5ddce83 Added inverted analog button. 2021-05-28 18:21:16 +02:00
Blaž Kristan
3bb9d220bb Bugfix:
- rewrite error-prone use of shifting
- allow -1 for analog pin on ESP8266
2021-05-28 14:22:54 +02:00
Blaz Kristan
62cb8358cc Added.
- analog for speed, intensity & palette
- legend in settings page
Fixed UI & UX.
- change of effect stops playlist
- new preset UI glitch
2021-05-27 17:57:04 +02:00
Blaz Kristan
ada5fd53e7 Removed obsolete usermods. 2021-05-26 22:01:12 +02:00
Blaz Kristan
2f30451067 Bugfix.
- temperature default values
- IR warnings
2021-05-26 21:33:40 +02:00
Blaz Kristan
6b5c2be701 Bugfix.
- preventing strip blinking due to usermod running
- temeperature reading with 0.5°C precision
2021-05-26 16:11:48 +02:00
Blaz Kristan
1ba70706c2 Bugfixes.
- multi-relay brightness check
- temperature no reading delay
- analog button fix & noise reduction
- IR removed custom
2021-05-25 23:00:21 +02:00
Blaz Kristan
6760744249 Minor tweak. 2021-05-23 21:31:47 +02:00
Blaz Kristan
11c7d586d9 Bugfix.
- atan_t(x) for x>1
- incorrect switch type and missing analog
2021-05-23 18:22:26 +02:00
Blaz Kristan
39cd83b171 Temporary fix for inappropriate atan_t(). 2021-05-23 15:51:53 +02:00
Blaz Kristan
2fdbc88d8c Bugfixes.
- PWM bus not loading on boot
- analog 0 not turning Off
- conditional compile for Blynk
- segment name
2021-05-23 01:11:35 +02:00
Blaz Kristan
cc0f1be5d2 Bugfix saving PWM & button pins. 2021-05-22 00:13:49 +02:00
Blaž Kristan
1952505e52 Squashed commit of the following:
commit 7893cb9ebc66faa39d430148e6dd66894cd2fc90
Merge: c4086b9 4e139d7
Author: Blaž Kristan <blaz@kristan-sp.si>
Date:   Fri May 21 12:57:43 2021 +0200

    Merge branch 'master' of https://github.com/scottrbailey/WLED into scottrbailey-master

commit 4e139d7c0a
Author: Artacus <40248830+scottrbailey@users.noreply.github.com>
Date:   Tue May 18 12:57:20 2021 -0700

    Update ir.cpp

    Handle both 24-key and 24-key old in decodeIR switch statement

commit 9a405d374b
Author: Artacus <40248830+scottrbailey@users.noreply.github.com>
Date:   Tue May 18 11:05:42 2021 -0700

    Update readme.md

commit 94af6d0561
Merge: 1ed687a bfb27c4
Author: Artacus <40248830+scottrbailey@users.noreply.github.com>
Date:   Sun May 16 22:00:15 2021 -0700

    Merge branch 'Aircoookie:master' into master

commit 1ed687a51a
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Sun May 2 21:27:33 2021 -0700

    remove colorUpdated notifier that was pasted in accidentally

commit 845dcabe0c
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Sat May 1 12:53:34 2021 -0700

    Handle setting palette when effect is still on default solid and will not display it

commit 90e8ae1457
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Sat May 1 02:07:47 2021 -0700

    refactor decodeIRJson to change how ir.json is loaded add support for calling several c functions

commit e4f9fa3117
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Thu Apr 29 23:33:01 2021 -0700

    comment out printing API commands in IR handling

commit 26247b247e
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Thu Apr 29 23:31:30 2021 -0700

    removed code that forced IR codes in a certain range to be decoded by decodeIR24. Generate default ir.json files for currently supported remotes.

commit 5acecda6a0
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Thu Apr 29 11:25:24 2021 -0700

    handle JSON API commands also

commit 754e3e092a
Author: Scott Bailey <scottrbailey@gmail.com>
Date:   Wed Apr 28 22:53:27 2021 -0700

    add decodeIRJson and JSON remote option
2021-05-21 13:07:55 +02:00
Blaž Kristan
c4086b9127 Corrected 10bit ADC read for 8266 2021-05-21 12:40:38 +02:00
Blaž Kristan
0ada09891c Added analog button/potentiometer support (partial) 2021-05-21 12:08:47 +02:00
Blaž Kristan
651b4d2461 Fixed XML API <wv> containing -1 on Manual only RGBW mode (see #888, #1783) 2021-05-21 10:04:22 +02:00
Blaž Kristan
01b2468fea Changed getI() parameter name to reflect actual meaning. 2021-05-21 08:11:04 +02:00
Blaz Kristan
28e714db1e Multi button implementation.
Inverted button support.
Added configurable touch button and touch threshold.
2021-05-20 15:49:26 +02:00
Blaž Kristan
a0fd02e0c0 Inverted button support.
Config save/load fix.
2021-05-20 06:45:02 +02:00
Blaz Kristan
c925b3d218 Setting touch threshold string fix. 2021-05-19 22:32:50 +02:00
Blaz Kristan
5da4386f31 Shortened string. 2021-05-19 20:26:14 +02:00
Blaz Kristan
4104dec87f Addet touch button and touch threshold.
Fixed some errors.
2021-05-19 20:23:35 +02:00
Blaz Kristan
d40a555531 Button 0 not saving macros fix. 2021-05-19 18:52:20 +02:00
Blaz Kristan
95df91a03b Multi button implementation. 2021-05-19 18:39:16 +02:00
Blaž Kristan
3a8caa15b9 Reverted retained MQTT messages. 2021-05-19 08:22:41 +02:00
Blaz Kristan
a5a25f02e3 Merge JSON IR code into master changes. 2021-05-18 22:04:51 +02:00
Blaz Kristan
bfd7be543a Merge branch 'master' of https://github.com/aircoookie/WLED into dev
Conflicts:
	tools/cdata.js
	usermods/PIR_sensor_switch/readme.md
	usermods/Temperature/readme.md
	wled00/FX.h
	wled00/FX_fcn.cpp
	wled00/bus_manager.h
	wled00/bus_wrapper.h
	wled00/cfg.cpp
	wled00/const.h
	wled00/data/settings.htm
	wled00/data/settings_leds.htm
	wled00/data/settings_um.htm
	wled00/html_settings.h
	wled00/json.cpp
	wled00/mqtt.cpp
	wled00/set.cpp
	wled00/wled.cpp
	wled00/wled.h
	wled00/wled_eeprom.cpp
	wled00/wled_server.cpp
	wled00/xml.cpp
2021-05-18 15:45:34 +02:00
Blaž Kristan
778e790e82 Added attributtion for JSON IR codes. 2021-05-18 10:27:34 +02:00
Blaž Kristan
17eeb22971 JSON IR remote 2021-05-18 09:48:58 +02:00
Blaz Kristan
991fe31569 Reverted status MQTT message. 2021-05-17 16:12:34 +02:00
Blaz Kristan
4a5a9b73b1 UI fixes & small changes. 2021-05-16 19:06:00 +02:00
Blaz Kristan
7652336c84 Added information regarding state of PIR sensor. 2021-05-16 17:25:32 +02:00
Blaz Kristan
94113827a7 Exposing segment power and intensity button/slider 2021-05-16 17:19:35 +02:00
Blaz Kristan
cc10ee0134 Added on/off MQTT command for anbling/disabling usermod. 2021-05-16 10:34:39 +02:00
Blaz Kristan
5ad0fdf39c Added on/off button for Staircas usermod on Info page. 2021-05-15 22:36:40 +02:00
Blaz Kristan
7201a8d634 Updated Animated Staircase readme.md 2021-05-15 13:51:24 +02:00
Blaz Kristan
3fde7365f9 Enhanced Animated Staircase usermod. 2021-05-15 13:37:27 +02:00
Blaz Kristan
f6a5bc9b40 Removed "retain" from MQTT messages. 2021-05-14 20:57:56 +02:00
Blaz Kristan
9a5917a331 Added PSRAM support for effect data. 2021-05-13 17:35:20 +02:00
Blaz Kristan
94c0324e8a Fix for display overflow. 2021-05-13 17:11:54 +02:00
Blaz Kristan
d3b5594092 Added reserverd pins for UI. 2021-05-13 16:46:29 +02:00
Blaz Kristan
742d580eae Removed Usermod child/parent relationship. 2021-05-13 16:19:53 +02:00
Blaz Kristan
d4a3cadd09 Removed unnecessary ISR from PIR sensor switch UM. 2021-05-13 16:18:22 +02:00
Blaz Kristan
ec0feb68f4 Added (partial) PSRAM support for WROVER chips.
Minor fixes.
2021-05-13 16:05:52 +02:00
Blaz Kristan
38c032b79e Readme API additions. 2021-05-11 21:43:38 +02:00
Blaz Kristan
2b7f2d4744 MQTT null termination fix.
Nigtttime detection for PIR fix.
2021-05-11 16:20:43 +02:00
Blaž Kristan
05b86a71fd Sunrise/sunset debugging for PIR sensor. 2021-05-11 09:36:30 +02:00
Blaz Kristan
e0c0f29fc6 Added nigttime only and MQTT only options to PIR sensor switch usermod.
Clarified empty UM settings a bit.
2021-05-10 22:41:27 +02:00
Blaz Kristan
3e3dc3a6ab PIR usermod fixes. 2021-05-08 17:02:37 +02:00
Blaz Kristan
8a6945ff3b Added PIR sensor switch on/off presets.
Added empty config info.
Minor fixes.
2021-05-08 12:11:12 +02:00
Blaz Kristan
e6111c0d48 Moved WROVER partition table. 2021-05-07 12:57:58 +02:00
Blaz Kristan
b2f5bee20d Conditional compile for disabled features. 2021-05-07 11:51:48 +02:00
Blaz Kristan
04c4451f7d Usermods MQTT processing.
Multi-relay usermod with MQTT/HTML control.
Minor bugfixes.
2021-05-06 22:58:03 +02:00
Blaz Kristan
ccab1844ce Parameterised max. usermods 2021-05-04 22:48:18 +02:00
Blaz Kristan
5a6be54970 Max 6 usermods on ESP32, fixed ESP32S2 number of busses. 2021-05-04 22:35:36 +02:00
Blaz Kristan
ce6b5105c6 Fix for MQTT topic for temperature F. 2021-05-03 22:50:55 +02:00
Blaz Kristan
de7da8b26e Removed PIR instance methods, added AutoSave enable/disable. 2021-05-03 21:22:03 +02:00
Blaz Kristan
24932d6ba3 Updated readme, removed obsolete usermods. 2021-05-03 13:32:11 +02:00
Blaz Kristan
d5fd5954d1 Added SW I2C support for ESP8266. 2021-05-03 13:11:42 +02:00
Blaz Kristan
977075763d Removed console logging. 2021-05-01 22:12:40 +02:00
Blaz Kristan
757172934e MultiRelay usermod.
beta 2
2021-05-01 19:38:13 +02:00
Blaz Kristan
1a520f8782 Minor usermod optimisations. 2021-04-29 22:39:08 +02:00
Blaz Kristan
b56c1b956c Display seconds only if not AM/PM. 2021-04-29 17:52:47 +02:00
Blaz Kristan
1a279d14c4 Dallas sensor detection.
Minor clenaup & fixes.
2021-04-29 17:44:31 +02:00
Blaz Kristan
0d8e763a5f Code clean-up. 2021-04-28 17:40:10 +02:00
Blaz Kristan
bf6d3649a4 "Out of memory" fix when no presets are created. 2021-04-27 17:01:15 +02:00
Blaz Kristan
65fd705d9a ESP32-S2 NPB methods filtered.
Default IR pin removed (set to -1).
Minor fixes.
2021-04-26 20:11:36 +02:00
Blaz Kristan
311e54451b Minor bug fixes. 2021-04-25 21:15:57 +02:00
Blaz Kristan
cb6607a169 Added new partition scheme for ESP32 WROVER (code size >1.3M)
Updated bus_wrapper for ESP32-S2 (use   #define ARDUINO_ARCH_ESP32S2)
Removed DallasTemperature.h from Temperature usermod.
2021-04-24 22:24:14 +02:00
Blaz Kristan
8caa4e9cb6 Fix for blinking colon. 2021-04-24 00:00:20 +02:00
Blaz Kristan
d6338d7b11 Changed codename to Ryujin.
Added blinking colon on display usermod.
2021-04-23 17:21:45 +02:00
Blaž Kristan
f96a5ec774 Changed version to 0.12.2-bl1
Optimised strings in Animated Staircase usermod.
Minor typos.
2021-04-23 14:32:18 +02:00
Blaz Kristan
1be8e7e216 Added 128x64 SSD1306 display. 2021-04-23 00:08:53 +02:00
Blaz Kristan
cf9cf9d7bb Merge branch 'master' into dev
Conflicts:
	package.json
	wled00/html_other.h
	wled00/html_settings.h
	wled00/wled.h
2021-04-22 22:48:08 +02:00
Blaz Kristan
6ba1795ded Flash optimizations & class texts. 2021-04-22 22:34:43 +02:00
Blaz Kristan
8608c45309 Merge branch 'master' into dev
Conflicts:
	CHANGELOG.md
	wled00/FX.cpp
	wled00/FX_fcn.cpp
	wled00/ntp.cpp
	wled00/wled.h
	wled00/wled_math.h
2021-04-21 21:16:08 +02:00
Blaz Kristan
90516217e0 Minor changes in PIR usermod. 2021-04-21 20:57:58 +02:00
Blaz Kristan
04aa22b510 Removed debug output in Animated Staircase.
Added PIR sensor switch usermod.
2021-04-19 22:24:55 +02:00
Blaz Kristan
1cd56decab Rewritten usermod config saving/reloading.
Changed temperature reading (to work on ESP32 more reliably).
Added Animated staircase usermod to the collection.
2021-04-17 17:04:36 +02:00
Blaz Kristan
585f8f4683 WLED math optimisations. 2021-04-16 20:07:54 +02:00
Blaz Kristan
1070d8d3fa Fix for AutoSave checkbox not saving. 2021-04-15 22:29:26 +02:00
Blaz Kristan
dcc7ba8f93 Changed ability to add multiple busses as compile time defaults,
using the esp32_multistrip usermod define syntax.
2021-04-15 22:19:58 +02:00
Blaz Kristan
7d5b20314c Ahhhh. 2021-04-14 18:22:00 +02:00
Blaz Kristan
29e048af7b Merge branch 'master' into dev
Conflicts:
	CHANGELOG.md
	package.json
	platformio.ini
	usermods/Temperature/usermod_temperature.h
	wled00/FX.cpp
	wled00/FX.h
	wled00/FX_fcn.cpp
	wled00/cfg.cpp
	wled00/data/index.js
	wled00/data/settings_leds.htm
	wled00/data/settings_time.htm
	wled00/data/style.css
	wled00/html_other.h
	wled00/html_settings.h
	wled00/html_ui.h
	wled00/ntp.cpp
	wled00/usermods_list.cpp
	wled00/wled.cpp
	wled00/wled.h
2021-04-14 18:19:51 +02:00
Blaž Kristan
c38f0d751b Cleanup & typo fix. 2021-04-13 08:11:51 +02:00
Blaz Kristan
3623afa721 Minor tweaks. 2021-04-12 23:32:54 +02:00
Blaz Kristan
6a096fbb27 Fixed #define typo.
Made usermod Auto Save runtime configurable.
String optimisations.
2021-04-12 21:10:47 +02:00
Blaz Kristan
6404071a01 Holidy wallpapers. 2021-04-11 21:11:43 +02:00
Blaz Kristan
735205492e 4LineDisplay enhancements.
Boot loop (preset apply) fix.
2021-04-11 16:47:53 +02:00
Blaz Kristan
a6feb77e52 4LineDisplay rewrite for dynamic configuration.
Added handling for multiple pins in usermod.
Fixed minor bugs.
2021-04-11 00:38:13 +02:00
Blaz Kristan
13b3b2fd23 1st working usermod settings (Temperature).
Added color on pin conflicts in LEDs setting page.
2021-04-10 00:17:15 +02:00
Blaz Kristan
9a6d709082 Reduced rev:2 API use.
Changed version to 0.12.1-a0
2021-04-08 15:46:18 +02:00
Blaz Kristan
6eafab8286 Per strip "skip first led".
Removed RGBW override from UI.
Saving presets uses rev:1 API if possible.
2021-04-07 21:04:54 +02:00
Blaz Kristan
c901512db0 Removed STATUSLED
Fix for possible Drip effect ESP reboot.
2021-04-06 22:30:23 +02:00
Blaz Kristan
31ea032054 Added segment names. 2021-04-04 21:10:44 +02:00
Blaz Kristan
89543e927a Added multiple ledmaps, selectable via JSON API. 2021-04-04 13:54:34 +02:00
Blaz Kristan
a52386e6ad 0.12 release
- removed AUX
- fix for negative values in LED settings
- fix for iOS app
2021-04-03 19:43:08 +02:00
Blaz Kristan
70546cd2ec UI code optimisations. 2021-04-01 22:13:44 +02:00
Blaz Kristan
a7c99cbbd2 Option to use segment length instead of stop. 2021-04-01 17:12:45 +02:00
Blaž Kristan
40780ccec7 Settings cleanup for pins. 2021-04-01 14:03:43 +02:00
Blaž Kristan
7078c91f7d Skip first led cleanup. 2021-04-01 12:53:01 +02:00
Blaz Kristan
0e2168392c Checkboxes for pins. 2021-03-31 21:36:19 +02:00
Blaz Kristan
380006c9d8 UI sync button refresh fix. 2021-03-31 20:07:37 +02:00
Blaz Kristan
4127882e5f Increased JSON buffer to 9k.
Removed daytime symbol from info page.
2021-03-31 16:41:20 +02:00
Blaz Kristan
5f17d30973 Getting on par with master. 2021-03-30 20:43:46 +02:00
Blaz Kristan
6ace46eece Merge branch 'master' into dev.
Few other modifications.

Conflicts:
	package.json
	platformio.ini
	wled00/FX.h
	wled00/FX_fcn.cpp
	wled00/bus_wrapper.h
	wled00/cfg.cpp
	wled00/data/index.css
	wled00/data/index.htm
	wled00/data/settings_leds.htm
	wled00/html_other.h
	wled00/html_settings.h
	wled00/html_ui.h
	wled00/json.cpp
	wled00/set.cpp
	wled00/wled.cpp
	wled00/wled.h
	wled00/wled_eeprom.cpp
	wled00/wled_server.cpp
	wled00/xml.cpp
2021-03-29 23:12:19 +02:00
Blaž Kristan
37cab07295 Reverting HSPI use on ESP32. 2021-03-29 09:00:41 +02:00
Blaz Kristan
cfeb88f649 Version bump. :( 2021-03-28 22:50:09 +02:00
Blaz Kristan
7ce197e0c8 Adding skinning capabilities to WLED. 2021-03-28 22:49:41 +02:00
Blaz Kristan
f93b1167f1 Reduced SPI speed for WS2801 to 2MHz.
Added HW SPI for busses 0 and 1.
2021-03-28 21:00:07 +02:00
Blaz Kristan
152ca63529 Possible fix for HW SPI on ESP32. 2021-03-28 17:33:53 +02:00
Blaz Kristan
2e8d5311a5 New font. UI fixes.
Skinning with CSS.
2021-03-28 17:15:26 +02:00
Blaž Kristan
23b5fd1c12 BusManager static method. 2021-03-26 11:52:04 +01:00
Blaz Kristan
7a8ba7d47d Still some fixes for UI. 2021-03-25 21:49:11 +01:00
Blaz Kristan
1a509cf3e0 Palette preview fix. 2021-03-25 21:13:47 +01:00
Blaz Kristan
9848f9613c UI bugfixes. 2021-03-25 20:34:39 +01:00
Blaz Kristan
93cefb88f5 CRLF madness. :( 2021-03-25 20:00:08 +01:00
Blaz Kristan
7132e1fee1 Further compatibility enhancement. 2021-03-25 17:20:07 +01:00
Blaz Kristan
e70e1b8ad7 Adding backwards compatibility. 2021-03-25 17:07:03 +01:00
Blaz Kristan
77d8a8e43d Reducing JSON buffer size requirements.
Increasing maximum number of segments.
2021-03-24 23:55:39 +01:00
Blaz Kristan
0b75a7d0d3 Fix current calculation. 2021-03-23 15:34:46 +01:00
Blaž Kristan
f6772eaf59 FPS drop workaround. 2021-03-23 07:05:40 +01:00
Blaz Kristan
7ac5abe7f8 Missing include. 2021-03-22 23:27:40 +01:00
Blaz Kristan
157e6b2a33 Sticky default & solid. 2021-03-22 23:19:39 +01:00
Blaz Kristan
a385ea7c52 UI tweaks. 2021-03-21 22:33:04 +01:00
Blaz Kristan
c58a3c41d8 Version bump. 2021-03-21 10:35:29 +01:00
Blaz Kristan
0a7df86f3f Better ADALights pin 3 handling. 2021-03-21 10:34:47 +01:00
Blaz Kristan
f8df7ebb7c UI optimisation. 2021-03-21 00:08:42 +01:00
Blaz Kristan
60503c31fb IR pin saving. 2021-03-20 23:59:17 +01:00
Blaz Kristan
77220e24dd Reserved pins management.
Disabling ADALight by default.
2021-03-20 23:52:38 +01:00
Blaz Kristan
3c25e11c5f Moved from alpha to beta. 2021-03-20 23:20:03 +01:00
Blaz Kristan
be2ffc31b2 Reduction of buffer size.
Caching tweak.
2021-03-20 23:04:24 +01:00
Blaz Kristan
adfb24ce02 Removed mobile Nodes button.
Tapping on node name triigers the same.
2021-03-20 16:03:59 +01:00
Blaz Kristan
e6d50f94ee Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Conflicts:
	wled00/data/index.css
	wled00/data/index.htm
	wled00/data/index.js
	wled00/html_ui.h
	wled00/json.cpp
2021-03-20 14:48:49 +01:00
Blaz Kristan
520798bfa6 Fixing include. 2021-03-20 13:12:11 +01:00
Blaz Kristan
e539a36ae7 Fix for empty WS reponse.
Scroll selected preset into view.
2021-03-20 13:11:10 +01:00
Blaz Kristan
bfab2d405b Removed unnecessary vars. 2021-03-19 16:23:16 +01:00
Blaz Kristan
df38f00cf2 Optimised websockets UI refresh. 2021-03-19 16:09:24 +01:00
Blaž Kristan
a30ce1c44d Websockets handling of JSON response. 2021-03-19 10:28:41 +01:00
Blaž Kristan
baf4a241a2 Remove toggleOnOff() and use setBrightness().
Return state to Off if it was Off when realtime mode started.
2021-03-19 08:24:45 +01:00
Blaz Kristan
c59e792178 Reduced JSON buffer by 1k.
Increased max RAM FX usage on ESP32 to 20k.
Added relay On handling on realtime data if Off (@JDTSmith).
Added UI refreshing via websockets (@korkbaum).
2021-03-18 23:19:17 +01:00
Blaz Kristan
e6a99c1d33 UI Info page fix. 2021-03-18 17:31:34 +01:00
Blaz Kristan
3548628c2c Mobile Nodes button is back! 2021-03-17 17:11:05 +01:00
Blaž Kristan
bb84157a21 Cosmetic fixes & size optimisation. 2021-03-17 09:30:23 +01:00
Blaz Kristan
eb10aa8c97 Semicolon. 2021-03-15 22:47:04 +01:00
Blaz Kristan
07428922c3 Auto refreshing UI every 15secons. 2021-03-14 22:34:27 +01:00
Blaz Kristan
0f7e22d8b7 Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Conflicts:
	wled00/cfg.cpp
	wled00/data/index.js
	wled00/fcn_declare.h
	wled00/html_ui.h
	wled00/json.cpp
	wled00/playlist.cpp
	wled00/wled.h
2021-03-14 11:41:55 +01:00
Blaz Kristan
caae57d960 Adding multiple compile time pins. 2021-03-12 23:56:29 +01:00
Blaz Kristan
f91384596c PIR sensor usermod pin reservation.
Time settings UI tweaks.
2021-03-10 18:46:13 +01:00
Blaz Kristan
cb38976162 Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Conflicts:
	wled00/NodeStruct.h
	wled00/data/index.htm
	wled00/data/index.js
	wled00/fcn_declare.h
	wled00/html_ui.h
	wled00/json.cpp
	wled00/udp.cpp
	wled00/wled.cpp
	wled00/wled.h
2021-03-10 13:23:03 +01:00
Blaz Kristan
4c5c4d1700 Minor UI tweak. 2021-03-09 14:01:18 +01:00
Blaz Kristan
e3fabe92bd Fixed slow NTP respone for calculating sunrise.
Fixed saving/loading only sunset trigger.
2021-03-09 13:24:20 +01:00
Blaz Kristan
142740f080 Sunrise/sunset re-calculated after saving time settings. 2021-03-08 19:52:43 +01:00
Blaz Kristan
09e51c2399 Sunrise/sunset info added to settings..
Sunrise/sunset calculated every minute (debug).
2021-03-08 19:40:06 +01:00
Blaz Kristan
0892eb271d Minor F() fixes. 2021-03-08 07:53:27 +01:00
Blaz Kristan
536be76ecb Switched lat/lon. 2021-03-08 06:27:00 +01:00
Blaz Kristan
6bfdf0eb4d Whitespace fix (dtostrf) for lat/lon. 2021-03-07 20:50:54 +01:00
Blaz Kristan
8320ed5a92 Bugfixes. 2021-03-07 18:34:06 +01:00
Blaz Kristan
43677685bb Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Conflicts:
	wled00/cfg.cpp
	wled00/const.h
	wled00/data/settings_leds.htm
	wled00/html_settings.h
	wled00/set.cpp
	wled00/wled.h
	wled00/xml.cpp
2021-03-07 17:53:15 +01:00
Blaz Kristan
61e0aa9845 Fixed missing ellipsis. 2021-03-07 15:33:08 +01:00
Blaz Kristan
34eee005a8 Add comment & update fcn_declare. 2021-03-07 12:43:13 +01:00
Blaz Kristan
6fa136da0c Minor tweaks & optimisations. 2021-03-07 11:14:16 +01:00
Blaz Kristan
b5abc6c724 Added sunrise/sunset triggered presets. 2021-03-07 00:04:46 +01:00
Blaz Kristan
f74a45a33e Sunris/sunset detection. 2021-03-05 23:05:09 +01:00
Blaz Kristan
0a1d04495d Version bump 2021-03-05 13:10:59 +01:00
Blaz Kristan
49dee560fd Sticky save & back buttons. 2021-03-05 09:50:59 +01:00
Blaz Kristan
dfb3dfb74d platformio.ini cleanup 2021-03-04 23:08:06 +01:00
Blaz Kristan
c4689c3bcc Added version info in autodiscovery packet. 2021-03-04 14:24:25 +01:00
Blaz Kristan
83452d73bc Code clean-up. 2021-03-04 11:17:17 +01:00
Blaz Kristan
e5417d12ca General cleanup & optimisations.
Pushing memory to (safe-ish) limits.
2021-03-03 22:04:24 +01:00
Blaz Kristan
6e19e6f0a0 Add reserved pins for ESP32 too. 2021-03-02 11:46:25 +01:00
Blaz Kristan
071281c13a Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Minor warning suppressions.

Conflicts:
	wled00/FX.cpp
	wled00/FX_fcn.cpp
	wled00/cfg.cpp
	wled00/wled.h
	wled00/xml.cpp
2021-03-02 11:00:07 +01:00
Blaz Kristan
61101987f9 Minor tweaks to Chunchun & Plasma FX. 2021-03-01 19:50:14 +01:00
Blaz Kristan
a057e50684 Forgotten .h file. 2021-03-01 12:41:14 +01:00
Blaz Kristan
5f3dc660c8 Fix for index count in settings.
Pin conflict on submit.
2021-03-01 11:56:02 +01:00
Blaz Kristan
51ead2f6bd Version bump. 2021-03-01 10:28:43 +01:00
Blaz Kristan
d433b25627 Fix for deallocation of PWM pins (missing destructor). 2021-03-01 10:27:55 +01:00
Blaz Kristan
bd7671c07e Debug for analog pin.
Minor tweaks.
2021-02-28 22:54:30 +01:00
Blaz Kristan
847178b7be Move node discovery in separate page. 2021-02-28 18:16:24 +01:00
Blaž Kristan
a899ea8b4d Prevent RGBW checkbox modification for analog LEDs 2021-02-27 18:46:35 +01:00
Blaz Kristan
7b83b99ac9 Fix for resetting segments. 2021-02-27 12:06:14 +01:00
Blaz Kristan
c11acb6308 Minor UI tweaks. 2021-02-26 22:43:57 +01:00
Blaz Kristan
d76103eb76 Minor UI tweak. 2021-02-26 18:46:16 +01:00
Blaz Kristan
779f984a30 Minor UI fix. 2021-02-26 16:46:46 +01:00
Blaz Kristan
9c55017191 Stray } fix. 2021-02-26 16:21:49 +01:00
Blaz Kristan
c6f575d8d3 Preprocessor fix. 2021-02-26 16:05:05 +01:00
Blaž Kristan
2c0c22dbf3 RGBW override cleanup, UI fix. 2021-02-26 08:34:38 +01:00
Blaz Kristan
73a99a7dea Merge branch 'dev' of https://github.com/aircoookie/WLED into dev 2021-02-25 23:02:37 +01:00
Blaz Kristan
3c81337630 PWM pins saving (hack bug) fix. UI changes. 2021-02-25 22:55:49 +01:00
Blaž Kristan
3f41ba6bdf Pin clash fix, minimization. 2021-02-25 13:22:29 +01:00
Blaž Kristan
2812f61957 Debug pin fix. 2021-02-25 09:56:09 +01:00
Blaž Kristan
f23cee17eb Minor fixes and optimisations.
Temperature usermod update for pin saving.
2021-02-25 09:54:10 +01:00
Blaz Kristan
f24fcfca69 Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Conflicts:
	wled00/set.cpp
	wled00/xml.cpp
2021-02-24 22:11:27 +01:00
Blaz Kristan
d60506a75d Skip 1st fix, save LED count, removed reverse. 2021-02-24 21:33:44 +01:00
Blaz Kristan
77dee439e6 1st attempt at 'blazoncek' 0.12 2021-02-24 20:23:32 +01:00
pjhatch
56a74bc54c Update FX.cpp
Added the improvements suggested by Gregor Hartmann
2020-08-15 12:34:13 -05:00
pjhatch
a20358b61b Adding 2 ball track modes
With and without collisions
2020-07-12 08:33:48 -05:00
pjhatch
341d9d1697 Update FX.cpp
Still 1 bug to fix - this was a test.
2020-07-05 14:55:14 -05:00
pjhatch
9cee424383 Update FX.cpp 2020-07-05 14:53:14 -05:00
pjhatch
37cb51cfd6 Adding Collision
A couple of bugs still need sorting
2020-07-02 14:16:25 -05:00
pjhatch
84b7bfb989 update for lost balls
Added some protection - so that when intensity is lowered and raised some time later balls that have moved way off the track are recovered.
2020-06-28 19:59:46 -05:00
pjhatch
04d17e4839 Added Ball Track V1
In this version the balls bounce of the edges and do not interact with one another.
2020-06-28 19:43:56 -05:00
336 changed files with 74506 additions and 25306 deletions

4
.github/FUNDING.yml vendored
View File

@ -1,2 +1,2 @@
github: [Aircoookie] github: [Aircoookie,blazoncek]
custom: ['https://paypal.me/Aircoookie'] custom: ['https://paypal.me/Aircoookie','https://paypal.me/blazoncek']

View File

@ -1,27 +0,0 @@
---
name: Bug
about: Noticed an issue with your lights?
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is. Please quickly search existing issues first!
**To Reproduce**
Steps to reproduce the behavior, if consistently possible
**Expected behavior**
A clear and concise description of what you expected to happen.
**WLED version**
- Board: [e.g. Wemos D1, ESP32 dev]
- Version [e.g. 0.10.0, dev200603]
- Format [e.g. Binary, self-compiled]
**Additional context**
Anything else you'd like to say about the problem?
Thank you for your help!

86
.github/ISSUE_TEMPLATE/bug.yml vendored Normal file
View File

@ -0,0 +1,86 @@
name: Bug Report
description: File a bug report
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Please quickly search existing issues first before submitting a bug.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: A clear and concise description of what the bug is.
placeholder: Tell us what the problem is.
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: To Reproduce Bug
description: Steps to reproduce the behavior, if consistently possible.
placeholder: Tell us how to make the bug appear.
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
placeholder: Tell us what you expected to happen.
validations:
required: true
- type: dropdown
id: install_format
attributes:
label: Install Method
description: How did you install WLED?
options:
- Binary from WLED.me
- Self-Compiled
validations:
required: true
- type: input
id: version
attributes:
label: What version of WLED?
description: You can find this in by going to Config -> Security & Updates -> Scroll to Bottom. Copy and paste the entire line after "Server message"
placeholder: "e.g. WLED 0.13.1 (build 2203150)"
validations:
required: true
- type: dropdown
id: Board
attributes:
label: Which microcontroller/board are you seeing the problem on?
multiple: true
options:
- ESP8266
- ESP32
- ESP32-S3
- ESP32-S2
- ESP32-C3
- Other
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log/trace output
description: Please copy and paste any relevant log output if you have it. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
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)
options:
- label: I agree to follow this project's Code of Conduct
required: true

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: WLED Discord community
url: https://discord.gg/KuqP7NE
about: Please ask and answer questions and discuss setup issues here!
- name: WLED community forum
url: https://wled.discourse.group/
about: For issues and ideas that might need longer discussion.
- name: kno.wled.ge base
url: https://kno.wled.ge/basics/faq/
about: Take a look at the frequently asked questions and documentation, perhaps your question is already answered!

View File

@ -1,19 +0,0 @@
---
name: Question
about: Have a question about using WLED?
title: ''
labels: question
assignees: ''
---
**Take a look at the wiki and FAQ, perhaps your question is already answered!**
[FAQ](https://github.com/Aircoookie/WLED/wiki/FAQ)
**Please consider asking your question on the WLED forum or Discord**
[Forum](https://wled.discourse.group/)
[Discord](https://discord.gg/KuqP7NE)
[What to post where?](https://github.com/Aircoookie/WLED/issues/658)
**If you do not like to use these platforms, delete this template and ask away!**
Please keep in mind though that the issue section is generally not the preferred place for general questions.

View File

@ -8,21 +8,23 @@ jobs:
name: Gather Environments name: Gather Environments
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Cache pip - name: Cache pip
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/.cache/pip path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pip- ${{ runner.os }}-pip-
- uses: actions/setup-python@v2 - uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install PlatformIO - name: Install PlatformIO
run: pip install -r requirements.txt run: pip install -r requirements.txt
- name: Get default environments - name: Get default environments
id: envs id: envs
run: | run: |
echo "::set-output name=environments::$(pio project config --json-output | jq -cr '.[0][1][0][1]')" echo "environments=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT
outputs: outputs:
environments: ${{ steps.envs.outputs.environments }} environments: ${{ steps.envs.outputs.environments }}
@ -32,24 +34,27 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: get_default_envs needs: get_default_envs
strategy: strategy:
fail-fast: false
matrix: matrix:
environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }} environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Cache pip - name: Cache pip
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/.cache/pip path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pip- ${{ runner.os }}-pip-
- name: Cache PlatformIO - name: Cache PlatformIO
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/.platformio path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install PlatformIO - name: Install PlatformIO
run: pip install -r requirements.txt run: pip install -r requirements.txt
- name: Build firmware - name: Build firmware

29
.gitignore vendored
View File

@ -1,17 +1,24 @@
.pio
.cache .cache
.clang-format
.direnv
.DS_Store
.gitignore
.idea
.pio
.pioenvs .pioenvs
.piolibdeps .piolibdeps
.vscode .vscode
!.vscode/extensions.json
/wled00/Release esp01-update.sh
platformio_override.ini
replace_fs.py
wled-update.sh
/build_output/
/node_modules/
/wled00/extLibs /wled00/extLibs
/platformio_override.ini /wled00/LittleFS
/wled00/my_config.h /wled00/my_config.h
/build_output /wled00/Release
.DS_Store /wled00/wled00.ino.cpp
.gitignore
.clang-format
node_modules
.idea
.direnv

2
.gitpod.Dockerfile vendored
View File

@ -1,5 +1,3 @@
FROM gitpod/workspace-full FROM gitpod/workspace-full
USER gitpod USER gitpod
RUN pip3 install -U platformio

View File

@ -1,12 +1,11 @@
tasks: tasks:
- command: platformio run - command: pip3 install -U platformio && platformio run
image: image:
file: .gitpod.Dockerfile file: .gitpod.Dockerfile
vscode: vscode:
extensions: extensions:
- ms-vscode.cpptools@0.26.3:u3GsZ5PK12Ddr79vh4TWgQ== - Atishay-Jain.All-Autocomplete
- eamodio.gitlens@10.2.1:e0IYyp0efFqVsrZwsIe8CA== - esbenp.prettier-vscode
- Atishay-Jain.All-Autocomplete@0.0.23:fbZNfSpnd8XkAHGfAPS2rA== - shardulm94.trailing-spaces
- 2gua.rainbow-brackets@0.0.6:Tbu8dTz0i+/bgcKQTQ5b8g==

View File

@ -3,5 +3,8 @@
// for the documentation about the extensions.json format // for the documentation about the extensions.json format
"recommendations": [ "recommendations": [
"platformio.platformio-ide" "platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
] ]
} }

View File

@ -1,6 +1,384 @@
## WLED changelog ## WLED changelog
### Builds after release 0.12.0 #### Build 2310010, build 2310130
- Release of WLED version 0.14.0 "Hoshi"
- Bugfixes for #3400, #3403, #3405
- minor HTML optimizations
- audioreactive: bugfix for UDP sound sync (partly initialized packets)
#### Build 2309240
- Release of WLED beta version 0.14.0-b6 "Hoshi"
- Effect bugfixes and improvements (Meteor, Meteor Smooth, Scrolling Text)
- audioreactive: bugfixes for ES8388 and ES7243 init; minor improvements for analog inputs
#### Build 2309100
- Release of WLED beta version 0.14.0-b5 "Hoshi"
- New standard esp32 build with audioreactive
- Effect blending bugfixes, and minor optimizations
#### Build 2309050
- Effect blending (#3311) (finally effect transitions!)
*WARNING*: May not work well with ESP8266, with plenty of segments or usermods (low RAM condition)!!!
- Added receive and send sync groups to JSON API (#3317) (you can change sync groups using preset)
- Internal temperature usermod (#3246)
- MQTT server and topic length overrides (#3354) (new build flags)
- Animated Staircase usermod enhancement (#3348) (on/off toggle/relay control)
- Added local time info to Info page (#3351)
- New effect: Rolling Balls (a.k.a. linear bounce) (#1039)
- Various bug fixes and enhancements.
#### Build 2308110
- Release of WLED beta version 0.14.0-b4 "Hoshi"
- Reset effect data immediately upon mode change
#### Build 2308030
- Improved random palette handling and blending
- Soap bugfix
- Fix ESP-NOW crash with AP mode Always
#### Build 2307180
- Bus-level global buffering (#3280)
- Removed per-segment LED buffer (SEGMENT.leds)
- various fixes and improvements (ESP variants platform 5.3.0, effect optimizations, /json/cfg pin allocation)
#### Build 2307130
- larger `oappend()` stack buffer (3.5k) for ESP32
- Preset cycle bugfix (#3262)
- Rotary encoder ALT fix for large LED count (#3276)
- effect updates (2D Plasmaball), `blur()` speedup
- On/Off toggle from nodes view (may show unknown device type on older versions) (#3291)
- various fixes and improvements (ABL, crashes when changing presets with different segments)
#### Build 2306270
- ESP-NOW remote support (#3237)
- Pixel Magic tool (display pixel art) (#3249)
- Websocket (peek) fallback when connection cannot be established, WS retries (#3267)
- Add WiFi network scan RPC command to Improv Serial (#3271)
- Longer (custom option available) segment name for ESP32
- various fixes and improvements
#### Build 2306210
- 0.14.0-b3 release
- respect global I2C in all usermods (no local initialization of I2C bus)
- Multi relay usermod compile-time enabled option (-D MULTI_RELAY_ENABLED=true|false)
#### Build 2306180
- Added client-side option for applying effect defaults from metadata
- Improved ESP8266 stability by reducing WebSocket response resends
- Updated ESP8266 core to 3.1.2
#### Build 2306141
- Lissajous improvements
- Scrolling Text improvements (leading 0)
#### Build 2306140
- Add settings PIN (un)locking to JSON post API
#### Build 2306130
- Bumped version to 0.14-b3 (beta 3)
- added pin dropdowns in LED preferences (not for LED pins) and usermods
- introduced (unused ATM) NeoGammaWLEDMethod class
- Reverse proxy support
- PCF8754 support for Rotary encoder (requires wiring INT pin to ESP GPIO)
- Rely on global I2C pins for usermods (breaking change)
- various fixes and enhancements
#### Build 2306020
- Support for segment sets (PR #3171)
- Reduce sound simulation modes to 2 to facilitate segment sets
- Trigger button immediately on press if all configured presets are the same (PR #3226)
- Changes for allowing Alexa to change light color to White when auto-calculating from RGB (PR #3211)
#### Build 2305280
- DDP protocol update (#3193)
- added PCF8574 I2C port expander support for Multi relay usermod
- MQTT multipacket (fragmented) message fix
- added option to retain MQTT brightness and color messages
- new ethernet board: @srg74 Ethernet Shield
- new 2D effects: Soap (#3184) & Octopus & Waving cell (credit @St3P40 https://github.com/80Stepko08)
- various fixes and enhancements
#### Build 2305090
- new ethernet board: @Wladi ABC! WLED Eth
- Battery usermod voltage calculation (#3116)
- custom palette editor (#3164)
- improvements in Dancing Shadows and Tartan effects
- UCS389x support
- switched to NeoPixelBus 2.7.5 (replaced NeoPixelBrightnessBus with NeoPixelBusLg)
- SPI bus clock selection (for LEDs) (#3173)
- DMX mode preset fix (#3134)
- iOS fix for scroll (#3182)
- Wordclock "Norddeutsch" fix (#3161)
- various fixes and enhancements
#### Build 2304090
- updated Arduino ESP8266 core to 4.1.0 (newer compiler)
- updated NeoPixelBus to 2.7.3 (with support for UCS890x chipset)
- better support for ESP32-C3, ESP32-S2 and ESP32-S3 (Arduino ESP32 core 5.2.0)
- iPad/tablet with 1024 pixels width in landscape orientation PC mode support (#3153)
- fix for Pixel Art Converter (#3155)
#### Build 2303240
- Peek scaling of large 2D matrices
- Added 0D (1 pixel) metadata for effects & enhance 0D (analog strip) UI handling
- Added ability to disable ADAlight (-D WLED_DISABLE_ADALIGHT)
- Fixed APA102 output on Ethernet enabled controllers
- Added ArtNet virtual/network output (#3121)
- Klipper usermod (#3106)
- Remove DST from CST timezone
- various fixes and enhancements
#### Build 2302180
- Removed Blynk support (servers shut down on 31st Dec 2022)
- Added `ledgap.json` to complement ledmaps for 2D matrices
- Added support for white addressable strips (#3073)
- Ability to use SHT temperature usermod with PWM fan usermod
- Added `onStateChange()` callback to usermods (#3081)
- Refactored `bus_manager` [internal]
- Dual 1D & 2D mode (add 1D strip after the matrix)
- Removed 1D -> 2D mapping for individual pixel control
- effect tweak: Fireworks 1D
- various bugfixes
#### Build 2301240
- Version bump to v0.14.0-b2 "Hoshi"
- PixelArt converter (convert any image to pixel art and display it on a matrix) (PR #3042)
- various effect updates and optimisations
- added Overlay option to some effects (allows overlapping segments)
- added gradient text on Scrolling Text
- added #DDMM, #MMDD & #HHMM date and time options for Scrolling Text effect (PR #2990)
- deprecated: Dynamic Smooth, Dissolve Rnd, Solid Glitter
- optimised & enhanced loading of default values
- new effect: Distortion Waves (2D)
- 2D support for Ripple effect
- slower minimum speed for Railway effect
- DMX effect mode & segment controls (PR #2891)
- Optimisations for conditional compiles (further reduction of code size)
- better UX with effect sliders (PR #3012)
- enhanced support for ESP32 variants: C3, S2 & S3
- usermod enhancements (PIR, Temperature, Battery (PR #2975), Analog Clock (PR #2993))
- new usermod SHT (PR #2963)
- 2D matrix set up with gaps or irregular panels (breaking change!) (PR #2892)
- palette blending/transitions
- random palette smooth changes
- hex color notations in custom palettes
- allow more virtual buses
- plethora of bugfixes
### WLED release 0.14.0-b1
#### Build 2212222
- Version bump to v0.14.0-b1 "Hoshi"
- 2D matrix support (including mapping 1D effects to 2D and 2D peek)
- [internal] completely rewritten Segment & WS2812FX handling code
- [internal] ability to add custom effects via usermods
- [internal] set of 2D drawing functions
- transitions on every segment (including ESP8266)
- enhanced old and new 2D effects (metadata: default values)
- custom palettes (up to 10; upload palette0.json, palette1.json, ...)
- custom effect sliders and options, quick filters
- global I2C and SPI GPIO allocation (for usermods)
- usermod settings page enhancements (dropdown & info)
- asynchronous preset loading (and added "pd" JSON API call for direct preset apply)
- new usermod Boblight (PR #2917)
- new usermod PWM Outputs (PR #2912)
- new usermod Audioreactive
- new usermod Word Clock Matrix (PR #2743)
- new usermod Ping Pong Clock (PR #2746)
- new usermod ADS1115 (PR #2752)
- new usermod Analog Clock (PR #2736)
- various usermod enhancements and updates
- allow disabling pull-up resistors on buttons
- SD card support (PR #2877)
- enhanced HTTP API to support custom effect sliders & options (X1, X2, X3, M1, M2, M3)
- multiple UDP sync message retries (PR #2830)
- network debug printer (PR #2870)
- automatic UI PC mode on large displays
- removed support for upgrading from pre-0.10 (EEPROM)
- support for setting GPIO level when LEDs are off (RMT idle level, ESP32 only) (PR #2478)
- Pakistan time-zone (PKT)
- ArtPoll support
- TM1829 LED support
- experimental support for ESP32 S2, S3 and C3
- general improvements and bugfixes
### WLED release 0.13.3
- Version bump to v0.13.3 "Toki"
- Disable ESP watchdog by default (fixes flickering and boot issues on a fresh install)
- Added support for LPD6803
### WLED release 0.13.2
#### Build 2208140
- Version bump to v0.13.2 "Toki"
- Added option to receive live data on the main segment only (PR #2601)
- Enable ESP watchdog by default (PR #2657)
- Fixed race condition when saving bus config
- Better potentiometer filtering (PR #2693)
- More suitable DMX libraries (PR #2652)
- Fixed outgoing serial TPM2 message length (PR #2628)
- Fixed next universe overflow and Art-Net DMX start address (PR #2607)
- Fixed relative segment brightness (PR #2665)
### Builds between releases 0.13.1 and 0.13.2
#### Build 2203191
- Fixed sunrise/set calculation (once again)
#### Build 2203190
- Fixed `/json/cfg` unable to set busses (#2589)
- Fixed Peek with odd LED counts > 255 (#2586)
#### Build 2203160
- Version bump to v0.13.2-a0 "Toki"
- Add ability to skip up to 255 LEDs
- Dependency version bumps
### WLED release 0.13.1
#### Build 2203150
- Version bump to v0.13.1 "Toki"
- Fix persistent preset bug, preventing save of new presets
### WLED release 0.13.0
#### Build 2203142
- Release of WLED v0.13.0 "Toki"
- Reduce APA102 hardware SPI frequency to 5Mhz
- Remove `persistent` parameter in `savePreset()`
### Builds between releases 0.12.0 and 0.13.0
#### Build 2203140
- Added factory reset by pressing button 0 for >10 seconds
- Added ability to set presets from DMX Effect mode
- Simplified label hiding JS in user interface
- Fixed JSON `{"live":true}` indefinite realtime mode
#### Build 2203080
- Disabled auto white mode in segments with no RGB bus
- Fixed hostname string not 0-terminated
- Fixed Popcorn mode not lighting first LED on pop
#### Build 2203060
- Dynamic hiding of unused color controls in UI (PR #2567)
- Removed native Cronixie support and added Cronixie usermod
- Fixed disabled timed preset expanding calendar
- Fixed Color Order setting shown for analog busses
- Fixed incorrect operator (#2566)
#### Build 2203011
- IR rewrite (PR #2561), supports CCT
- Added locate button to Time settings
- CSS fixes and adjustments
- Consistent Tab indentation in index JS and CSS
- Added initial contribution style guideline
#### Build 2202222
- Version bump to 0.13.0-b7 "Toki"
- Fixed HTTP API commands not applying to all selected segments in some conditions
- Blynk support is not compiled in by default on ESP32 builds
#### Build 2202210
- Fixed HTTP API commands not applying to all selected segments if called from JSON
- Improved Stream effects, no longer rely on LED state and won't fade out at low brightness
#### Build 2202200
- Added `info.leds.seglc` per-segment light capability info (PR #2552)
- Fixed `info.leds.rgbw` behavior
- Segment bounds sync (PR #2547)
- WebSockets auto reconnection and error handling
- Disable relay pin by default (PR #2531)
- Various fixes (ESP32 touch pin 33, floats, PR #2530, #2534, #2538)
- Deprecated `info.leds.cct`, `info.leds.wv` and `info.leds.rgbw`
- Deprecated `/url` endpoint
#### Build 2202030
- Switched to binary format for WebSockets peek (PR #2516)
- Playlist bugfix
- Added `extractModeName()` utility function
- Added serial out (PR #2517)
- Added configurable baud rate
#### Build 2201260
- Initial ESP32-C3 and ESP32-S2 support (PRs #2452, #2454, #2502)
- Full segment sync (PR #2427)
- Allow overriding of color order by ranges (PR #2463)
- Added white channel to Peek
#### Build 2112080
- Version bump to 0.13.0-b6 "Toki"
- Added "ESP02" (ESP8266 with 2M of flash) to PIO/release binaries
#### Build 2112070
- Added new effect "Fairy", replacing "Police All"
- Added new effect "Fairytwinkle", replacing "Two Areas"
- Static single JSON buffer (performance and stability improvement) (PR #2336)
#### Build 2112030
- Fixed ESP32 crash on Colortwinkles brightness change
- Fixed setting picker to black resetting hue and saturation
- Fixed auto white mode not saved to config
#### Build 2111300
- Added CCT and white balance correction support (PR #2285)
- Unified UI slider style
- Added LED settings config template upload
#### Build 2111220
- Fixed preset cycle not working from preset called by UI
- Reintroduced permanent min. and max. cycle bounds
#### Build 2111190
- Changed default ESP32 LED pin from 16 to 2
- Renamed "Running 2" to "Chase 2"
- Renamed "Tri Chase" to "Chase 3"
#### Build 2111170
- Version bump to 0.13.0-b5 "Toki"
- Improv Serial support (PR #2334)
- Button improvements (PR #2284)
- Added two time zones (PR #2264, 2311)
- JSON in/decrementing support for brightness and presets
- Fixed no gamma correction for JSON individual LED control
- Preset cycle bugfix
- Removed ledCount
- LED settings buffer bugfix
- Network pin conflict bugfix
- Changed default ESP32 partition layout to 4M, 1M FS
#### Build 2110110
- Version bump to 0.13.0-b4 "Toki"
- Added option for bus refresh if off (PR #2259)
- New auto segment logic
- Fixed current calculations for virtual or non-linear configs (PR #2262)
#### Build 2110060 #### Build 2110060
@ -367,6 +745,7 @@
- Added support for WESP32 ethernet board (PR #1764) - Added support for WESP32 ethernet board (PR #1764)
- Added Caching for main UI (PR #1704) - Added Caching for main UI (PR #1704)
- Added Tetrix mode (PR #1729) - Added Tetrix mode (PR #1729)
- Removed Merry Christmas mode (use "Chase 2" - called Running 2 before 0.13.0)
- Added memory check on Bus creation - Added memory check on Bus creation
#### Build 2102050 #### Build 2102050

78
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,78 @@
## Thank you for making WLED better!
Here are a few suggestions to make it easier for you to contribute!
### Code style
When in doubt, it is easiest to replicate the code style you find in the files you want to edit :)
Below are the guidelines we use in the WLED repository.
#### Indentation
We use tabs for Indentation in Web files (.html/.css/.js) and spaces (2 per indentation level) for all other files.
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.
Good:
```cpp
if (a == b) {
doStuff(a);
}
```
```cpp
if (a == b)
{
doStuff(a);
}
```
```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.
Spaces between variables and operators are up to the authors discretion.
There should be no space between function names and their argument parenthesis.
Good:
```cpp
if (a == b) {
doStuff(a);
}
```
Not good:
```cpp
if( a==b ){
doStuff ( a);
}
```
#### Comments
Comments should have a space between the delimiting characters (e.g. `//`) and the comment text.
Note: This is a recent change, the majority of the codebase still has comments without spaces.
Good:
```
// This is a comment.
/* This is a CSS inline comment */
/*
* This is a comment
* wrapping over multiple lines,
* used in WLED for file headers and function explanations
*/
<!-- This is an HTML comment -->
```
There is no set character limit for a comment within a line,
though as a rule of thumb you should wrap your comment if it exceeds the width of your editor window.
Inline comments are OK if they describe that line only and are not exceedingly wide.

753
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "wled", "name": "wled",
"version": "0.13.0-b3", "version": "0.14.0",
"description": "Tools for WLED project", "description": "Tools for WLED project",
"main": "tools/cdata.js", "main": "tools/cdata.js",
"directories": { "directories": {
@ -25,7 +25,7 @@
"clean-css": "^4.2.3", "clean-css": "^4.2.3",
"html-minifier-terser": "^5.1.1", "html-minifier-terser": "^5.1.1",
"inliner": "^1.13.1", "inliner": "^1.13.1",
"nodemon": "^2.0.4", "nodemon": "^2.0.20",
"zlib": "^1.0.5" "zlib": "^1.0.5"
} }
} }

View File

@ -6,20 +6,23 @@
# ENVIRONMENTS # ENVIRONMENTS
# #
# Please uncomment one of the lines below to select your board(s) # Please uncomment one of the lines below to select your board(s)
# (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Travis CI binaries (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example) # CI binaries
; default_envs = travis_esp8266, travis_esp32 ; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth # ESP32 variant builds are temporarily excluded from CI due to toolchain issues on the GitHub Actions Linux environment
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi
# Release binaries # Release binaries
default_envs = nodemcuv2, esp01_1m_full, esp32dev, esp32_eth ; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB
# Build everything # Build everything
; default_envs = esp32dev, esp8285_4CH_MagicHome, esp8285_4CH_H801, codm-controller-0.6-rev2, codm-controller-0.6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, travis_esp8266, travis_esp32, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_5CH_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips ; default_envs = esp32dev, esp8285_4CH_MagicHome, codm-controller-0_6-rev2, codm-controller-0_6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips
# Single binaries (uncomment your board) # Single binaries (uncomment your board)
; default_envs = elekstube_ips ; default_envs = elekstube_ips
; default_envs = nodemcuv2 ; default_envs = nodemcuv2
; default_envs = esp8266_2m
; default_envs = esp01_1m_full ; default_envs = esp01_1m_full
; default_envs = esp07 ; default_envs = esp07
; default_envs = d1_mini ; default_envs = d1_mini
@ -29,12 +32,16 @@ default_envs = nodemcuv2, esp01_1m_full, esp32dev, esp32_eth
; default_envs = d1_mini_ota ; default_envs = d1_mini_ota
; default_envs = esp32dev ; default_envs = esp32dev
; default_envs = esp8285_4CH_MagicHome ; default_envs = esp8285_4CH_MagicHome
; default_envs = esp8285_4CH_H801 ; default_envs = esp8285_H801
; default_envs = esp8285_5CH_H801
; default_envs = d1_mini_5CH_Shojo_PCB ; default_envs = d1_mini_5CH_Shojo_PCB
; default_envs = wemos_shield_esp32 ; default_envs = wemos_shield_esp32
; default_envs = m5atom ; default_envs = m5atom
; default_envs = esp32_eth ; default_envs = esp32_eth
; default_envs = esp32dev_qio80
; default_envs = esp32_eth_ota1mapp
; default_envs = esp32s2_saola
; default_envs = esp32c3dev
; default_envs = lolin_s2_mini
src_dir = ./wled00 src_dir = ./wled00
data_dir = ./wled00/data data_dir = ./wled00/data
@ -53,33 +60,45 @@ extra_configs =
arduino_core_2_6_3 = espressif8266@2.3.3 arduino_core_2_6_3 = espressif8266@2.3.3
arduino_core_2_7_4 = espressif8266@2.6.2 arduino_core_2_7_4 = espressif8266@2.6.2
arduino_core_3_0_0 = espressif8266@3.0.0 arduino_core_3_0_0 = espressif8266@3.0.0
arduino_core_3_2_0 = espressif8266@3.2.0
arduino_core_4_1_0 = espressif8266@4.1.0
arduino_core_3_1_2 = espressif8266@4.2.0
# Development platforms # Development platforms
arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop
arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage
# Platform to use for ESP8266 # Platform to use for ESP8266
platform_wled_default = ${common.arduino_core_2_7_4} platform_wled_default = ${common.arduino_core_3_1_2}
# We use 2.7.4.7 for all, includes PWM flicker fix and Wstring optimization # We use 2.7.4.7 for all, includes PWM flicker fix and Wstring optimization
platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7 #platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7
platformio/toolchain-xtensa @ ~2.40802.200502 platform_packages = platformio/framework-arduinoespressif8266
platformio/tool-esptool @ ~1.413.0 platformio/toolchain-xtensa @ ~2.100300.220621 #2.40802.200502
platformio/tool-esptoolpy @ ~1.30000.0 platformio/tool-esptool #@ ~1.413.0
platformio/tool-esptoolpy #@ ~1.30000.0
## previous platform for 8266, in case of problems with the new one
## you'll need makuna/NeoPixelBus@ 2.6.9 for arduino_core_3_2_0, which does not support Ucs890x
;; platform_wled_default = ${common.arduino_core_3_2_0}
;; platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7
;; platformio/toolchain-xtensa @ ~2.40802.200502
;; platformio/tool-esptool @ ~1.413.0
;; platformio/tool-esptoolpy @ ~1.30000.0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# FLAGS: DEBUG # FLAGS: DEBUG
# # esp8266 : see https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level
# esp32 : see https://docs.platformio.org/en/latest/platforms/espressif32.html#debug-level
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM debug_flags = -D DEBUG=1 -D WLED_DEBUG
#if needed (for memleaks etc) also add; -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h" -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM ;; for esp8266
#-DDEBUG_ESP_CORE is not working right now # if needed (for memleaks etc) also add; -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h"
# -DDEBUG_ESP_CORE is not working right now
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# FLAGS: ldscript (available ldscripts at https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld) # FLAGS: ldscript (available ldscripts at https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld)
# ldscript_1m0m (1024 KB) = 999 KB sketch, 4 KB eeprom, no spiffs, 16 KB reserved
# ldscript_2m1m (2048 KB) = 1019 KB sketch, 4 KB eeprom, 1004 KB spiffs, 16 KB reserved # ldscript_2m1m (2048 KB) = 1019 KB sketch, 4 KB eeprom, 1004 KB spiffs, 16 KB reserved
# ldscript_4m1m (4096 KB) = 1019 KB sketch, 4 KB eeprom, 1002 KB spiffs, 16 KB reserved, 2048 KB empty/ota? # ldscript_4m1m (4096 KB) = 1019 KB sketch, 4 KB eeprom, 1002 KB spiffs, 16 KB reserved, 2048 KB empty/ota?
# ldscript_4m3m (4096 KB) = 1019 KB sketch, 4 KB eeprom, 3040 KB spiffs, 16 KB reserved
# #
# Available lwIP variants (macros): # Available lwIP variants (macros):
# -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH = v1.4 Higher Bandwidth (default) # -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH = v1.4 Higher Bandwidth (default)
@ -99,11 +118,13 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT
# This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m). # This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m).
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
build_flags = build_flags =
-Wno-attributes
-DMQTT_MAX_PACKET_SIZE=1024 -DMQTT_MAX_PACKET_SIZE=1024
-DSECURE_CLIENT=SECURE_CLIENT_BEARSSL -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL
-DBEARSSL_SSL_BASIC -DBEARSSL_SSL_BASIC
-D CORE_DEBUG_LEVEL=0 -D CORE_DEBUG_LEVEL=0
-D NDEBUG -D NDEBUG
-Wno-attributes ;; silence warnings about unknown attribute 'maybe_unused' in NeoPixelBus
#build_flags for the IRremoteESP8266 library (enabled decoders have to appear here) #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here)
-D _IR_ENABLE_DEFAULT_=false -D _IR_ENABLE_DEFAULT_=false
-D DECODE_HASH=true -D DECODE_HASH=true
@ -111,20 +132,17 @@ build_flags =
-D DECODE_SONY=true -D DECODE_SONY=true
-D DECODE_SAMSUNG=true -D DECODE_SAMSUNG=true
-D DECODE_LG=true -D DECODE_LG=true
;-Dregister= # remove warnings in C++17 due to use of deprecated register keyword by the FastLED library ;; warning: this breaks framework code on ESP32-C3 and ESP32-S2
-DWLED_USE_MY_CONFIG -DWLED_USE_MY_CONFIG
; -D USERMOD_SENSORSTOMQTT ; -D USERMOD_SENSORSTOMQTT
#For ADS1115 sensor uncomment following
; -D USERMOD_ADS1115
build_unflags = build_unflags =
# enables all features for travis CI
build_flags_all_features =
-D WLED_ENABLE_ADALIGHT
-D WLED_ENABLE_DMX
-D WLED_ENABLE_MQTT
-D WLED_ENABLE_WEBSOCKETS
build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags} build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags}
build_flags_esp32 = ${common.build_flags} ${esp32.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_1m128k = eagle.flash.1m128.ld
ldscript_2m512k = eagle.flash.2m512.ld ldscript_2m512k = eagle.flash.2m512.ld
@ -154,77 +172,155 @@ upload_speed = 115200
# LIBRARIES: required dependencies # LIBRARIES: required dependencies
# Please note that we don't always use the latest version of a library. # Please note that we don't always use the latest version of a library.
# #
# The following libraries have been included (and some of them changd) in the source: # The following libraries have been included (and some of them changed) in the source:
# ArduinoJson@5.13.5, Blynk@0.5.4(changed), E131@1.0.0(changed), Time@1.5, Timezone@1.2.1 # ArduinoJson@5.13.5, E131@1.0.0(changed), Time@1.5, Timezone@1.2.1
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
lib_compat_mode = strict lib_compat_mode = strict
lib_deps = lib_deps =
fastled/FastLED @ 3.4.0 fastled/FastLED @ 3.6.0
IRremoteESP8266 @ 2.7.18 IRremoteESP8266 @ 2.8.2
https://github.com/lorol/LITTLEFS.git makuna/NeoPixelBus @ 2.7.5
https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.2 https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.7
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
#TFT_eSPI #TFT_eSPI
#For use SSD1306 OLED display uncomment following #For compatible OLED display uncomment following
#U8g2@~2.27.2 #U8g2 #@ ~2.33.15
#For Dallas sensor uncomment following 2 lines #For Dallas sensor uncomment following
#OneWire@~2.3.5 #OneWire @ ~2.3.7
#milesburton/DallasTemperature@^3.9.0
#For BME280 sensor uncomment following #For BME280 sensor uncomment following
#BME280@~3.0.0 #BME280 @ ~3.0.0
; adafruit/Adafruit BMP280 Library @ 2.1.0 ; adafruit/Adafruit BMP280 Library @ 2.1.0
; adafruit/Adafruit CCS811 Library @ 1.0.4 ; adafruit/Adafruit CCS811 Library @ 1.0.4
; adafruit/Adafruit Si7021 Library @ 1.4.0 ; adafruit/Adafruit Si7021 Library @ 1.4.0
#For ADS1115 sensor uncomment following
; adafruit/Adafruit BusIO @ 1.13.2
; adafruit/Adafruit ADS1X15 @ 2.4.0
extra_scripts = ${scripts_defaults.extra_scripts} extra_scripts = ${scripts_defaults.extra_scripts}
[esp8266] [esp8266]
build_flags = build_flags =
-DESP8266 -DESP8266
-DFP_IN_IROM -DFP_IN_IROM
;-Wno-deprecated-declarations ;-Wno-deprecated-declarations
;-Wno-register ;-Wno-register ;; leaves some warnings when compiling C files: command-line option '-Wno-register' is valid for C++/ObjC++ but not for C
; NONOSDK22x_190703 = 2.2.2-dev(38a443e) ;-Dregister= # remove warnings in C++17 due to use of deprecated register keyword by the FastLED library ;; warning: this can be dangerous
-Wno-misleading-indentation
; NONOSDK22x_190703 = 2.2.2-dev(38a443e)
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
; lwIP 2 - Higher Bandwidth no Features ; lwIP 2 - Higher Bandwidth no Features
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH ; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
; lwIP 1.4 - Higher Bandwidth (Aircoookie has) ; lwIP 1.4 - Higher Bandwidth (Aircoookie has)
-DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
; VTABLES in Flash ; VTABLES in Flash
-DVTABLES_IN_FLASH -DVTABLES_IN_FLASH
; restrict to minimal mime-types ; restrict to minimal mime-types
-DMIMETYPE_MINIMAL -DMIMETYPE_MINIMAL
; other special-purpose framework flags (see https://docs.platformio.org/en/latest/platforms/espressif8266.html)
; -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
lib_deps = lib_deps =
${env.lib_deps} #https://github.com/lorol/LITTLEFS.git
# ESPAsyncTCP @ 1.2.0 ESPAsyncTCP @ 1.2.2
ESPAsyncUDP ESPAsyncUDP
makuna/NeoPixelBus @ 2.6.7 # 2.6.5/2.6.6 and newer do not compile on ESP core < 3.0.0 ${env.lib_deps}
[esp32] [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_flags = -g build_flags = -g
-DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32
-DCONFIG_LITTLEFS_FOR_IDF_3_2 #-DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0 -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
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
lib_deps = lib_deps =
${env.lib_deps} https://github.com/lorol/LITTLEFS.git
makuna/NeoPixelBus @ 2.6.7
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${env.lib_deps}
# additional build flags for audioreactive
AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT
AR_lib_deps = https://github.com/kosme/arduinoFFT#develop @ ^1.9.2
[esp32_idf_V4]
;; experimental build environment for ESP32 using ESP-IDF 4.4.x / arduino-esp32 v2.0.5
;; very similar to the normal ESP32 flags, but omitting Lorol LittleFS, as littlefs is included in the new framework already.
;;
;; 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 =
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
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${env.lib_deps}
[esp32s2] [esp32s2]
;; generic definitions for all ESP32-S2 boards
platform = espressif32@5.3.0
platform_packages =
build_flags = -g build_flags = -g
-DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32
-DCONFIG_LITTLEFS_FOR_IDF_3_2
-DARDUINO_ARCH_ESP32S2 -DARDUINO_ARCH_ESP32S2
-DCONFIG_IDF_TARGET_ESP32S2 -DCONFIG_IDF_TARGET_ESP32S2=1
-D CONFIG_ASYNC_TCP_USE_WDT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
-DCO -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
lib_deps = lib_deps =
${env.lib_deps}
makuna/NeoPixelBus @ 2.6.7
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${env.lib_deps}
[esp32c3]
;; generic definitions for all ESP32-C3 boards
platform = espressif32@5.3.0
platform_packages =
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
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${env.lib_deps}
[esp32s3]
;; generic definitions for all ESP32-S3 boards
platform = espressif32@5.3.0
platform_packages =
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
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
${env.lib_deps}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# WLED BUILDS # WLED BUILDS
@ -236,7 +332,17 @@ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages} platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m} board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 #-DWLED_DISABLE_2D
lib_deps = ${esp8266.lib_deps}
monitor_filters = esp8266_exception_decoder
[env:esp8266_2m]
board = esp_wroom_02
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
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
[env:esp01_1m_full] [env:esp01_1m_full]
@ -246,6 +352,7 @@ platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k} board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA 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
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
[env:esp07] [env:esp07]
@ -288,32 +395,142 @@ lib_deps = ${esp8266.lib_deps}
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev
platform = espressif32@2.0 platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
build_unflags = ${common.build_unflags} 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} -D WLED_RELEASE_NAME=ESP32 #-D WLED_DISABLE_BROWNOUT_DET
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
[env:esp32dev_audioreactive]
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_audioreactive #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags}
lib_deps = ${esp32.lib_deps}
${esp32.AR_lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
; board_build.f_flash = 80000000L
; board_build.flash_mode = dio
[env:esp32dev_qio80]
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
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 = qio
[env:esp32dev_V4_dio80]
;; experimental ESP32 env using ESP-IDF V4.4.x
;; Warning: this build environment is not stable!!
;; please erase your device before installing.
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
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32_idf_V4.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = dio
[env:esp32_eth] [env:esp32_eth]
board = esp32-poe board = esp32-poe
platform = espressif32@2.0 platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 921600 upload_speed = 921600
build_unflags = ${common.build_unflags} 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 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
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.default_partitions}
[env:esp32s2_saola] [env:esp32s2_saola]
board = esp32dev board = esp32-s2-saola-1
board_build.mcu = esp32s2 platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
platform = espressif32
platform_packages = platform_packages =
toolchain-xtensa32s2
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0-alpha1
framework = arduino framework = arduino
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
board_build.flash_mode = qio
upload_speed = 460800 upload_speed = 460800
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME=S2_saola
;-DLOLIN_WIFI_FIX ;; try this in case Wifi does not work
-DARDUINO_USB_CDC_ON_BOOT=1
lib_deps = ${esp32s2.lib_deps} lib_deps = ${esp32s2.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
-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
;-DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip
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")
;-D WLED_DEBUG
lib_deps = ${esp32s3.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)
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
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags}
-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")
; -D WLED_RELEASE_NAME=ESP32-S3_PSRAM
-D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used
lib_deps = ${esp32s3.lib_deps}
board_build.partitions = tools/WLED_ESP32_8MB.csv
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
[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 = 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
[env:esp8285_4CH_MagicHome] [env:esp8285_4CH_MagicHome]
board = esp8285 board = esp8285
platform = ${common.platform_wled_default} platform = ${common.platform_wled_default}
@ -323,16 +540,7 @@ build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
[env:esp8285_4CH_H801] [env:esp8285_H801]
board = esp8285
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
lib_deps = ${esp8266.lib_deps}
[env:esp8285_5CH_H801]
board = esp8285 board = esp8285
platform = ${common.platform_wled_default} platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages} platform_packages = ${common.platform_packages}
@ -385,13 +593,60 @@ 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} -D LEDPIN=12 -D IRPIN=-1 -D RLYPIN=2
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
[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
build_unflags = ${common.build_unflags} #-DARDUINO_USB_CDC_ON_BOOT=1
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT=1 # try disabling and enabling unflag above in case of board-specific issues, will disable Serial
-DARDUINO_USB_MSC_ON_BOOT=0
-DARDUINO_USB_DFU_ON_BOOT=0
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_USE_PSRAM
; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 6792 bytes FLASH
-D WLED_WATCHDOG_TIMEOUT=0
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D LEDPIN=16
-D BTNPIN=18
-D RLYPIN=9
-D IRPIN=7
-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
lib_deps = ${esp32s2.lib_deps}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# custom board configurations # custom board configurations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:esp32c3dev_2MB]
;; for ESP32-C3 boards with 2MB flash (instead of 4MB).
;; this board need a specific partition file. OTA not possible.
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
-D WLED_WATCHDOG_TIMEOUT=0
-D WLED_DISABLE_OTA
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
-DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip
build_unflags = ${common.build_unflags}
upload_speed = 115200
lib_deps = ${esp32c3.lib_deps}
board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
board_build.flash_mode = dio
[env:wemos_shield_esp32] [env:wemos_shield_esp32]
board = esp32dev board = esp32dev
platform = espressif32@3.2 platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 460800 upload_speed = 460800
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} build_flags = ${common.build_flags_esp32}
@ -403,16 +658,22 @@ build_flags = ${common.build_flags_esp32}
-D USERMOD_DALLASTEMPERATURE -D USERMOD_DALLASTEMPERATURE
-D USERMOD_FOUR_LINE_DISPLAY -D USERMOD_FOUR_LINE_DISPLAY
-D TEMPERATURE_PIN=23 -D TEMPERATURE_PIN=23
-D USE_ALT_DISPlAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
-D USERMOD_AUDIOREACTIVE
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
OneWire@~2.3.5 OneWire@~2.3.5
olikraus/U8g2 @ ^2.28.8 olikraus/U8g2 @ ^2.28.8
https://github.com/blazoncek/arduinoFFT.git
board_build.partitions = ${esp32.default_partitions}
[env:m5atom] [env:m5atom]
board = esp32dev board = esp32dev
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39 build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
platform = espressif32@3.2 platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
board_build.partitions = ${esp32.default_partitions}
[env:sp501e] [env:sp501e]
board = esp_wroom_02 board = esp_wroom_02
@ -428,28 +689,73 @@ 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} -D LEDPIN=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
# ------------------------------------------------------------------------------ [env:Athom_RGBCW] ;7w and 5w(GU10) bulbs
# travis test board configurations board = esp8285
# ------------------------------------------------------------------------------ platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
[env:travis_esp8266] board_build.ldscript = ${common.ldscript_2m512k}
extends = env:d1_mini
build_type = debug
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build_flags_all_features} 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
lib_deps = ${esp8266.lib_deps}
[env:travis_esp32]
extends = env:esp32dev [env:Athom_15w_RGBCW] ;15w bulb
; build_type = debug board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features} 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
lib_deps = ${esp8266.lib_deps}
[env:Athom_3Pin_Controller] ;small controller with only data
board = esp8285
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
lib_deps = ${esp8266.lib_deps}
[env:Athom_4Pin_Controller] ; With clock and data interface
board = esp8285
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
lib_deps = ${esp8266.lib_deps}
[env:Athom_5Pin_Controller] ;Analog light strip controller
board = esp8285
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
lib_deps = ${esp8266.lib_deps}
[env:MY9291]
board = esp01_1m
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
lib_deps = ${esp8266.lib_deps}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# codm pixel controller board configurations # codm pixel controller board configurations
# codm-controller-0.6 can also be used for the TYWE3S controller # codm-controller-0_6 can also be used for the TYWE3S controller
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:codm-controller-0.6] [env:codm-controller-0_6]
board = esp_wroom_02 board = esp_wroom_02
platform = ${common.platform_wled_default} platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages} platform_packages = ${common.platform_packages}
@ -458,7 +764,7 @@ build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp8266} build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps} lib_deps = ${esp8266.lib_deps}
[env:codm-controller-0.6-rev2] [env:codm-controller-0_6-rev2]
board = esp_wroom_02 board = esp_wroom_02
platform = ${common.platform_wled_default} platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages} platform_packages = ${common.platform_packages}
@ -472,7 +778,8 @@ lib_deps = ${esp8266.lib_deps}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:elekstube_ips] [env:elekstube_ips]
board = esp32dev board = esp32dev
platform = espressif32@3.2 platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 921600 upload_speed = 921600
build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
-D USERMOD_RTC -D USERMOD_RTC
@ -480,7 +787,6 @@ build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_D
-D LEDPIN=12 -D LEDPIN=12
-D RLYPIN=27 -D RLYPIN=27
-D BTNPIN=34 -D BTNPIN=34
-D WLED_DISABLE_INFRARED
-D DEFAULT_LED_COUNT=6 -D DEFAULT_LED_COUNT=6
# Display config # Display config
-D ST7789_DRIVER -D ST7789_DRIVER
@ -498,3 +804,4 @@ monitor_filters = esp32_exception_decoder
lib_deps = lib_deps =
${esp32.lib_deps} ${esp32.lib_deps}
TFT_eSPI @ ^2.3.70 TFT_eSPI @ ^2.3.70
board_build.partitions = ${esp32.default_partitions}

View File

@ -19,10 +19,13 @@ build_flags = ${common.build_flags_esp8266}
; *** Use custom settings from file my_config.h ; *** Use custom settings from file my_config.h
-DWLED_USE_MY_CONFIG -DWLED_USE_MY_CONFIG
; ********************************************************************* ; *********************************************************************
;
;
; *** To use the below defines/overrides, copy and paste each onto it's own line just below build_flags in the section above.
;
; disable specific features
; -D WLED_DISABLE_OTA ; -D WLED_DISABLE_OTA
; -D WLED_DISABLE_ALEXA ; -D WLED_DISABLE_ALEXA
; -D WLED_DISABLE_BLYNK
; -D WLED_DISABLE_CRONIXIE
; -D WLED_DISABLE_HUESYNC ; -D WLED_DISABLE_HUESYNC
; -D WLED_DISABLE_INFRARED ; -D WLED_DISABLE_INFRARED
; -D WLED_DISABLE_WEBSOCKETS ; -D WLED_DISABLE_WEBSOCKETS
@ -45,3 +48,18 @@ build_flags = ${common.build_flags_esp8266}
; for the Magic Home LED Controller use PWM pins 5,12,13,15 ; for the Magic Home LED Controller use PWM pins 5,12,13,15
; for the H801 controller use PINs 15,13,12,14 (W2 = 04) ; for the H801 controller use PINs 15,13,12,14 (W2 = 04)
; for the BW-LT11 controller use PINs 12,4,14,5 ; for the BW-LT11 controller use PINs 12,4,14,5
;
; 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
;
; 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 default color order of your led strip
; -D DEFAULT_LED_COLOR_ORDER=COL_ORDER_GRB

View File

@ -3,7 +3,7 @@
<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://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://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://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://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/KuqP7NE"><img src="https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&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://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://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/Aircoookie/WLED"><img src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?style=flat-square&logo=gitpod"></a>
@ -15,11 +15,11 @@
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 ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based chipsets like the WS2801 and APA102!
## ⚙️ Features ## ⚙️ Features
- WS2812FX library integrated for over 100 special effects - WS2812FX library with more than 100 special effects
- FastLED noise effects and 50 palettes - FastLED noise effects and 50 palettes
- Modern UI with color, effect and segment controls - Modern UI with color, effect and segment controls
- Segments to set different effects and colors to parts of the LEDs - Segments to set different effects and colors to user defined parts of the LED string
- Settings page - configuration over network - Settings page - configuration via the network
- Access Point and station mode - automatic failsafe AP - Access Point and station mode - automatic failsafe AP
- Up to 10 LED outputs per instance - Up to 10 LED outputs per instance
- Support for RGBW strips - Support for RGBW strips
@ -27,15 +27,14 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control
- Presets can be used to automatically execute API calls - Presets can be used to automatically execute API calls
- Nightlight function (gradually dims down) - Nightlight function (gradually dims down)
- Full OTA software updatability (HTTP + ArduinoOTA), password protectable - Full OTA software updatability (HTTP + ArduinoOTA), password protectable
- Configurable analog clock + support for the Cronixie kit by Diamex - Configurable analog clock (Cronixie, 7-segment and EleksTube IPS clock support via usermods)
- Configurable Auto Brightness limit for safer operation - Configurable Auto Brightness limit for safe operation
- Filesystem-based config for easier backup of presets and settings - Filesystem-based config for easier backup of presets and settings
## 💡 Supported light control interfaces ## 💡 Supported light control interfaces
- WLED app for [Android](https://play.google.com/store/apps/details?id=com.aircoookie.WLED) and [iOS](https://apps.apple.com/us/app/wled/id1475695033) - WLED app for [Android](https://play.google.com/store/apps/details?id=com.aircoookie.WLED) and [iOS](https://apps.apple.com/us/app/wled/id1475695033)
- JSON and HTTP request APIs - JSON and HTTP request APIs
- MQTT - MQTT
- Blynk IoT
- E1.31, Art-Net, DDP and TPM2.net - E1.31, Art-Net, DDP and TPM2.net
- [diyHue](https://github.com/diyhue/diyHue) (Wled is supported by diyHue, including Hue Sync Entertainment under udp. Thanks to [Gregory Mallios](https://github.com/gmallios)) - [diyHue](https://github.com/diyhue/diyHue) (Wled is supported by diyHue, including Hue Sync Entertainment under udp. Thanks to [Gregory Mallios](https://github.com/gmallios))
- [Hyperion](https://github.com/hyperion-project/hyperion.ng) - [Hyperion](https://github.com/hyperion-project/hyperion.ng)
@ -51,52 +50,35 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control
See the [documentation on our official site](https://kno.wled.ge)! See the [documentation on our official site](https://kno.wled.ge)!
[On this page](https://github.com/Aircoookie/WLED/wiki/Learning-the-ropes) you can find excellent tutorials made by the community and helpful tools to help you get your new lamp up and running! [On this page](https://kno.wled.ge/basics/tutorials/) you can find excellent tutorials and tools to help you get your new project up and running!
## 🖼️ Images ## 🖼️ User interface
<img src="/images/macbook-pro-space-gray-on-the-wooden-table.jpg" width="50%"><img src="/images/walking-with-iphone-x.jpg" width="50%"> <img src="images/macbook-pro-space-gray-on-the-wooden-table.jpg" width="50%"><img src="images/walking-with-iphone-x.jpg" width="50%">
## 💾 Compatible LED Strips ## 💾 Compatible hardware
Type | Voltage | Comments
|---|---|---|
WS2812B | 5v |
WS2813 | 5v |
SK6812 | 5v | RGBW
APA102 | 5v | C/D
WS2801 | 5v | C/D
LPD8806 | 5v | C/D
TM1814 | 12v | RGBW
WS2811 | 12v | 3-LED segments
WS2815 | 12v |
GS8208 | 12v |
Analog/non-addressable | any | Requires additional circuitry
## 🧊 Compatible PC RGB Fans and ARGB accessories
Brand | Model | Comments
|---|---|---|
Corsair | HD120 Fan | Uses WS2812B, data-in only
PCCOOLER | Moonlight 5-pack Fans | Uses WS2812B, includes Data-out connector to keep each fan uniquely addressable if wired in series like traditional LED strips
Any | 5v 3-pin ARGB for PC | Any PC RGB device that supports the 5v 3-pin ARGB motherboard header should work fine with WLED. All the major motherboard vendors support the Corsair HD120 and PCCOOLER fans listed, so we can safely assume any device that supports motherboard ARGB 5V 3-Pin standard will work with WLED.
See [here](https://kno.wled.ge/basics/compatible-hardware)!
## ✌️ Other ## ✌️ Other
Licensed under the MIT license Licensed under the MIT license
Credits [here](https://github.com/Aircoookie/WLED/wiki/Contributors-&-About)! Credits [here](https://kno.wled.ge/about/contributors/)!
Uses Linearicons by Perxis!
Join the Discord server to discuss everything about WLED! Join the Discord server to discuss everything about WLED!
<a href="https://discord.gg/KuqP7NE"><img src="https://discordapp.com/api/guilds/473448917040758787/widget.png?style=banner2" width="25%"></a> <a href="https://discord.gg/QAh7wJHrRM"><img src="https://discordapp.com/api/guilds/473448917040758787/widget.png?style=banner2" width="25%"></a>
Check out the WLED [Discourse forum](https://wled.discourse.group)! Check out the WLED [Discourse forum](https://wled.discourse.group)!
You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com), but please only do so if you want to talk to me privately.
If WLED really brightens up your every day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie) You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com), but please, only do so if you want to talk to me privately.
If WLED really brightens up your day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie)
*Disclaimer:* *Disclaimer:*
If you are sensitive to photosensitive epilepsy it is not recommended that you use this software.
In case you still want to try, don't use strobe, lighting or noise modes or high effect speed settings. 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 MIT license, I assume no liability for any damage to you or any other person or equipment.

View File

@ -1,54 +1,58 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.8
# To update, run: # To update, run:
# #
# pip-compile # pip-compile
# #
aiofiles==0.6.0 aiofiles==22.1.0
# via platformio # via platformio
ajsonrpc==1.1.0 ajsonrpc==1.2.0
# via platformio # via platformio
bottle==0.12.19 anyio==3.6.2
# via starlette
bottle==0.12.25
# via platformio # via platformio
certifi==2020.12.5 certifi==2023.7.22
# via requests # via requests
chardet==4.0.0 charset-normalizer==3.1.0
# via requests # via requests
click==7.1.2 click==8.1.3
# via # via
# platformio # platformio
# uvicorn # uvicorn
colorama==0.4.4 colorama==0.4.6
# via platformio # via platformio
h11==0.12.0 h11==0.14.0
# via # via
# uvicorn # uvicorn
# wsproto # wsproto
idna==2.10 idna==3.4
# via requests # via
ifaddr==0.1.7 # anyio
# via zeroconf # requests
marshmallow==3.11.1 marshmallow==3.19.0
# via platformio # via platformio
platformio==5.1.1 packaging==23.1
# via marshmallow
platformio==6.1.6
# via -r requirements.in # via -r requirements.in
pyelftools==0.27 pyelftools==0.29
# via platformio # via platformio
pyserial==3.5 pyserial==3.5
# via platformio # via platformio
requests==2.25.1 requests==2.31.0
# via platformio # via platformio
semantic-version==2.8.5 semantic-version==2.10.0
# via platformio # via platformio
starlette==0.14.2 sniffio==1.3.0
# via anyio
starlette==0.23.1
# via platformio # via platformio
tabulate==0.8.9 tabulate==0.9.0
# via platformio # via platformio
urllib3==1.26.5 urllib3==1.26.15
# via requests # via requests
uvicorn==0.13.4 uvicorn==0.20.0
# via platformio # via platformio
wsproto==1.0.0 wsproto==1.2.0
# via platformio
zeroconf==0.28.8
# via platformio # via platformio

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, 0x180000,
app1, app, ota_1, 0x190000,0x180000,
spiffs, data, spiffs, 0x310000,0xF0000,
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 0x180000
5 app1 app ota_1 0x190000 0x180000
6 spiffs data spiffs 0x310000 0xF0000

View File

@ -0,0 +1,8 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x300000,
app1, app, ota_1, 0x310000,0x300000,
spiffs, data, spiffs, 0x610000,0x9E0000,
coredump, data, coredump,,64K
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage
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, 0x300000,
5 app1, app, ota_1, 0x310000,0x300000,
6 spiffs, data, spiffs, 0x610000,0x9E0000,
7 coredump, data, coredump,,64K
8 # to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage

View File

@ -0,0 +1,5 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 20K,
otadata, data, ota, 0xe000, 8K,
app0, app, ota_0, 0x10000, 1536K,
spiffs, data, spiffs, 0x190000, 384K,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 20K
3 otadata data ota 0xe000 8K
4 app0 app ota_0 0x10000 1536K
5 spiffs data spiffs 0x190000 384K

View File

@ -3,4 +3,5 @@ nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000, otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x200000, app0, app, ota_0, 0x10000, 0x200000,
app1, app, ota_1, 0x210000,0x200000, app1, app, ota_1, 0x210000,0x200000,
spiffs, data, spiffs, 0x410000,0x3F0000, spiffs, data, spiffs, 0x410000,0x3E0000,
coredump, data, coredump,,64K

1 # Name # Name, Type, SubType, Offset, Size, Flags Type SubType Offset Size Flags
3 otadata otadata, data, ota, 0xe000, 0x2000, data ota 0xe000 0x2000
4 app0 app0, app, ota_0, 0x10000, 0x200000, app ota_0 0x10000 0x200000
5 app1 app1, app, ota_1, 0x210000,0x200000, app ota_1 0x210000 0x200000
6 spiffs spiffs, data, spiffs, 0x410000,0x3E0000, data spiffs 0x410000 0x3F0000
7 coredump, data, coredump,,64K

View File

@ -16,20 +16,31 @@
*/ */
const fs = require("fs"); const fs = require("fs");
const inliner = require("inliner");
const zlib = require("zlib");
const CleanCSS = require("clean-css");
const MinifyHTML = require("html-minifier-terser").minify;
const packageJson = require("../package.json"); const packageJson = require("../package.json");
/** /**
* *
*/ */
function hexdump(buffer) { function hexdump(buffer,isHex=false) {
let lines = []; let lines = [];
for (let i = 0; i < buffer.length; i += 16) { for (let i = 0; i < buffer.length; i +=(isHex?32:16)) {
let block = buffer.slice(i, i + 16); // cut buffer into blocks of 16 var block;
let hexArray = []; let hexArray = [];
if (isHex) {
for (let value of block) { block = buffer.slice(i, i + 32)
hexArray.push("0x" + value.toString(16).padStart(2, "0")); for (let j = 0; j < block.length; j +=2 ) {
hexArray.push("0x" + block.slice(j,j+2))
}
} else {
block = buffer.slice(i, i + 16); // cut buffer into blocks of 16
for (let value of block) {
hexArray.push("0x" + value.toString(16).padStart(2, "0"));
}
} }
let hexString = hexArray.join(", "); let hexString = hexArray.join(", ");
@ -40,9 +51,6 @@ function hexdump(buffer) {
return lines.join(",\n"); return lines.join(",\n");
} }
const inliner = require("inliner");
const zlib = require("zlib");
function strReplace(str, search, replacement) { function strReplace(str, search, replacement) {
return str.split(search).join(replacement); return str.split(search).join(replacement);
} }
@ -56,16 +64,52 @@ function adoptVersionAndRepo(html) {
html = strReplace(html, "https://github.com/atuline/WLED", repoUrl); html = strReplace(html, "https://github.com/atuline/WLED", repoUrl);
html = strReplace(html, "https://github.com/Aircoookie/WLED", repoUrl); html = strReplace(html, "https://github.com/Aircoookie/WLED", repoUrl);
} }
let version = packageJson.version; let version = packageJson.version;
if (version) { if (version) {
html = strReplace(html, "##VERSION##", version); html = strReplace(html, "##VERSION##", version);
} }
return html; return html;
} }
function writeHtmlGzipped(sourceFile, resultFile) { function filter(str, type) {
str = adoptVersionAndRepo(str);
if (type === undefined) {
return str;
} else if (type == "css-minify") {
return new CleanCSS({}).minify(str).styles;
} else if (type == "js-minify") {
return MinifyHTML('<script>' + str + '</script>', {
collapseWhitespace: true,
minifyJS: true,
continueOnParseError: false,
removeComments: true,
}).replace(/<[\/]*script>/g,'');
} else if (type == "html-minify") {
return MinifyHTML(str, {
collapseWhitespace: true,
maxLineLength: 80,
minifyCSS: true,
minifyJS: true,
continueOnParseError: false,
removeComments: true,
});
} else if (type == "html-minify-ui") {
return MinifyHTML(str, {
collapseWhitespace: true,
conservativeCollapse: true,
maxLineLength: 80,
minifyCSS: true,
minifyJS: true,
continueOnParseError: false,
removeComments: true,
});
} else {
console.warn("Unknown filter: " + type);
return str;
}
}
function writeHtmlGzipped(sourceFile, resultFile, page) {
console.info("Reading " + sourceFile); console.info("Reading " + sourceFile);
new inliner(sourceFile, function (error, html) { new inliner(sourceFile, function (error, html) {
console.info("Inlined " + html.length + " characters"); console.info("Inlined " + html.length + " characters");
@ -95,8 +139,8 @@ function writeHtmlGzipped(sourceFile, resultFile) {
*/ */
// Autogenerated from ${sourceFile}, do not edit!! // Autogenerated from ${sourceFile}, do not edit!!
const uint16_t PAGE_index_L = ${result.length}; const uint16_t PAGE_${page}_L = ${result.length};
const uint8_t PAGE_index[] PROGMEM = { const uint8_t PAGE_${page}[] PROGMEM = {
${array} ${array}
}; };
`; `;
@ -106,41 +150,6 @@ ${array}
}); });
} }
const CleanCSS = require("clean-css");
const MinifyHTML = require("html-minifier-terser").minify;
function filter(str, type) {
str = adoptVersionAndRepo(str);
if (type === undefined) {
return str;
} else if (type == "css-minify") {
return new CleanCSS({}).minify(str).styles;
} else if (type == "html-minify") {
return MinifyHTML(str, {
collapseWhitespace: true,
maxLineLength: 80,
minifyCSS: true,
minifyJS: true,
continueOnParseError: false,
removeComments: true,
});
} else if (type == "html-minify-ui") {
return MinifyHTML(str, {
collapseWhitespace: true,
conservativeCollapse: true,
maxLineLength: 80,
minifyCSS: true,
minifyJS: true,
continueOnParseError: false,
removeComments: true,
});
} else {
console.warn("Unknown filter: " + type);
return str;
}
}
function specToChunk(srcDir, s) { function specToChunk(srcDir, s) {
if (s.method == "plaintext") { if (s.method == "plaintext") {
const buf = fs.readFileSync(srcDir + "/" + s.file); const buf = fs.readFileSync(srcDir + "/" + s.file);
@ -153,6 +162,21 @@ const char ${s.name}[] PROGMEM = R"${s.prepend || ""}${filter(str, s.filter)}${
`; `;
return s.mangle ? s.mangle(chunk) : chunk; return s.mangle ? s.mangle(chunk) : chunk;
} else if (s.method == "gzip") {
const buf = fs.readFileSync(srcDir + "/" + s.file);
var str = buf.toString('utf-8');
if (s.mangle) str = s.mangle(str);
const zip = zlib.gzipSync(filter(str, s.filter), { level: zlib.constants.Z_BEST_COMPRESSION });
const result = hexdump(zip.toString('hex'), true);
const chunk = `
// Autogenerated from ${srcDir}/${s.file}, do not edit!!
const uint16_t ${s.name}_length = ${zip.length};
const uint8_t ${s.name}[] PROGMEM = {
${result}
};
`;
return chunk;
} else if (s.method == "binary") { } else if (s.method == "binary") {
const buf = fs.readFileSync(srcDir + "/" + s.file); const buf = fs.readFileSync(srcDir + "/" + s.file);
const result = hexdump(buf); const result = hexdump(buf);
@ -164,7 +188,7 @@ ${result}
}; };
`; `;
return s.mangle ? s.mangle(chunk) : chunk; return chunk;
} else { } else {
console.warn("Unknown method: " + s.method); console.warn("Unknown method: " + s.method);
return undefined; return undefined;
@ -194,160 +218,114 @@ function writeChunks(srcDir, specs, resultFile) {
fs.writeFileSync(resultFile, src); fs.writeFileSync(resultFile, src);
} }
writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h"); writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h", 'index');
writeHtmlGzipped("wled00/data/simple.htm", "wled00/html_simple.h", 'simple');
writeHtmlGzipped("wled00/data/pixart/pixart.htm", "wled00/html_pixart.h", 'pixart');
writeHtmlGzipped("wled00/data/cpal/cpal.htm", "wled00/html_cpal.h", 'cpal');
writeHtmlGzipped("wled00/data/pxmagic/pxmagic.htm", "wled00/html_pxmagic.h", 'pxmagic');
/*
writeChunks(
"wled00/data",
[
{
file: "simple.css",
name: "PAGE_simpleCss",
method: "gzip",
filter: "css-minify",
},
{
file: "simple.js",
name: "PAGE_simpleJs",
method: "gzip",
filter: "js-minify",
},
{
file: "simple.htm",
name: "PAGE_simple",
method: "gzip",
filter: "html-minify-ui",
}
],
"wled00/html_simplex.h"
);
*/
writeChunks( writeChunks(
"wled00/data", "wled00/data",
[ [
{ {
file: "style.css", file: "style.css",
name: "PAGE_settingsCss", name: "PAGE_settingsCss",
prepend: "=====(<style>", method: "gzip",
append: "</style>)=====",
method: "plaintext",
filter: "css-minify", filter: "css-minify",
mangle: (str) =>
str
.replace("%%","%")
}, },
{ {
file: "settings.htm", file: "settings.htm",
name: "PAGE_settings", name: "PAGE_settings",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace("%", "%%")
.replace(/User Interface\<\/button\>\<\/form\>/gms, "User Interface\<\/button\>\<\/form\>%DMXMENU%"),
}, },
{ {
file: "settings_wifi.htm", file: "settings_wifi.htm",
name: "PAGE_settings_wifi", name: "PAGE_settings_wifi",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(
/function GetV().*\<\/script\>/gms,
"function GetV() {var d=document;\n"
),
}, },
{ {
file: "settings_leds.htm", file: "settings_leds.htm",
name: "PAGE_settings_leds", name: "PAGE_settings_leds",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(
/function GetV().*\<\/script\>/gms,
"function GetV() {var d=document;\n"
),
}, },
{ {
file: "settings_dmx.htm", file: "settings_dmx.htm",
name: "PAGE_settings_dmx", name: "PAGE_settings_dmx",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) => {
const nocss = str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(
/function GetV().*\<\/script\>/gms,
"function GetV() {var d=document;\n"
);
return `
#ifdef WLED_ENABLE_DMX
${nocss}
#else
const char PAGE_settings_dmx[] PROGMEM = R"=====()=====";
#endif
`;
},
}, },
{ {
file: "settings_ui.htm", file: "settings_ui.htm",
name: "PAGE_settings_ui", name: "PAGE_settings_ui",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(
/function GetV().*\<\/script\>/gms,
"function GetV() {var d=document;\n"
),
}, },
{ {
file: "settings_sync.htm", file: "settings_sync.htm",
name: "PAGE_settings_sync", name: "PAGE_settings_sync",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(/function GetV().*\<\/script\>/gms, "function GetV() {\n"),
}, },
{ {
file: "settings_time.htm", file: "settings_time.htm",
name: "PAGE_settings_time", name: "PAGE_settings_time",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(/function GetV().*\<\/script\>/gms, "function GetV() {\n"),
}, },
{ {
file: "settings_sec.htm", file: "settings_sec.htm",
name: "PAGE_settings_sec", name: "PAGE_settings_sec",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(/\<link rel="stylesheet".*\>/gms, "")
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%")
.replace(
/function GetV().*\<\/script\>/gms,
"function GetV() {var d=document;\n"
),
}, },
{ {
file: "settings_um.htm", file: "settings_um.htm",
name: "PAGE_settings_um", name: "PAGE_settings_um",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) => },
str {
.replace(/\<link rel="stylesheet".*\>/gms, "") file: "settings_2D.htm",
.replace(/\<style\>.*\<\/style\>/gms, "%CSS%%SCSS%") name: "PAGE_settings_2D",
.replace( method: "gzip",
/function GetV().*\<\/script\>/gms, filter: "html-minify",
"function GetV() {var d=document;\n" },
), {
file: "settings_pin.htm",
name: "PAGE_settings_pin",
method: "gzip",
filter: "html-minify"
} }
], ],
"wled00/html_settings.h" "wled00/html_settings.h"
@ -359,9 +337,7 @@ writeChunks(
{ {
file: "usermod.htm", file: "usermod.htm",
name: "PAGE_usermod", name: "PAGE_usermod",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) => mangle: (str) =>
str.replace(/fetch\("http\:\/\/.*\/win/gms, 'fetch("/win'), str.replace(/fetch\("http\:\/\/.*\/win/gms, 'fetch("/win'),
@ -393,41 +369,37 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
{ {
file: "update.htm", file: "update.htm",
name: "PAGE_update", name: "PAGE_update",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
mangle: (str) =>
str
.replace(
/function GetV().*\<\/script\>/gms,
"</script><script src=\"/settings/s.js?p=9\"></script>"
)
}, },
{ {
file: "welcome.htm", file: "welcome.htm",
name: "PAGE_welcome", name: "PAGE_welcome",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
}, },
{ {
file: "liveview.htm", file: "liveview.htm",
name: "PAGE_liveview", name: "PAGE_liveview",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
}, },
{ {
file: "liveviewws.htm", file: "liveviewws2D.htm",
name: "PAGE_liveviewws", name: "PAGE_liveviewws2D",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
}, },
{ {
file: "404.htm", file: "404.htm",
name: "PAGE_404", name: "PAGE_404",
prepend: "=====(", method: "gzip",
append: ")=====",
method: "plaintext",
filter: "html-minify", filter: "html-minify",
}, },
{ {
@ -435,6 +407,16 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
name: "favicon", name: "favicon",
method: "binary", method: "binary",
}, },
{
file: "iro.js",
name: "iroJs",
method: "gzip"
},
{
file: "rangetouch.js",
name: "rangetouchJs",
method: "gzip"
}
], ],
"wled00/html_other.h" "wled00/html_other.h"
); );

View File

@ -0,0 +1,15 @@
#include "wled.h"
namespace ADS1115
{
struct ChannelSettings {
const String settingName;
bool isEnabled;
String name;
String units;
const uint16_t mux;
float multiplier;
float offset;
uint8_t decimals;
};
}

View File

@ -0,0 +1,10 @@
# ADS1115 16-Bit ADC with four inputs
This usermod will read from an ADS1115 ADC. The voltages are displayed in the Info section of the web UI.
Configuration is performed via the Usermod menu. There are no parameters to set in code!
## Installation
Add the build flag `-D USERMOD_ADS1115` to your platformio environment.
Uncomment libraries with comment `#For ADS1115 sensor uncomment following`

View File

@ -0,0 +1,255 @@
#pragma once
#include "wled.h"
#include <Adafruit_ADS1X15.h>
#include <math.h>
#include "ChannelSettings.h"
using namespace ADS1115;
class ADS1115Usermod : public Usermod {
public:
void setup() {
ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V
if (!ads.begin()) {
Serial.println("Failed to initialize ADS");
return;
}
if (!initChannel()) {
isInitialized = true;
return;
}
startReading();
isEnabled = true;
isInitialized = true;
}
void loop() {
if (isEnabled && millis() - lastTime > loopInterval) {
lastTime = millis();
// If we don't have new data, skip this iteration.
if (!ads.conversionComplete()) {
return;
}
updateResult();
moveToNextChannel();
startReading();
}
}
void addToJsonInfo(JsonObject& root)
{
if (!isEnabled) {
return;
}
JsonObject user = root[F("u")];
if (user.isNull()) user = root.createNestedObject(F("u"));
for (uint8_t i = 0; i < channelsCount; i++) {
ChannelSettings* settingsPtr = &(channelSettings[i]);
if (!settingsPtr->isEnabled) {
continue;
}
JsonArray lightArr = user.createNestedArray(settingsPtr->name); //name
float value = round((readings[i] + settingsPtr->offset) * settingsPtr->multiplier, settingsPtr->decimals);
lightArr.add(value); //value
lightArr.add(" " + settingsPtr->units); //unit
}
}
void addToConfig(JsonObject& root)
{
JsonObject top = root.createNestedObject(F("ADC ADS1115"));
for (uint8_t i = 0; i < channelsCount; i++) {
ChannelSettings* settingsPtr = &(channelSettings[i]);
JsonObject channel = top.createNestedObject(settingsPtr->settingName);
channel[F("Enabled")] = settingsPtr->isEnabled;
channel[F("Name")] = settingsPtr->name;
channel[F("Units")] = settingsPtr->units;
channel[F("Multiplier")] = settingsPtr->multiplier;
channel[F("Offset")] = settingsPtr->offset;
channel[F("Decimals")] = settingsPtr->decimals;
}
top[F("Loop Interval")] = loopInterval;
}
bool readFromConfig(JsonObject& root)
{
JsonObject top = root[F("ADC ADS1115")];
bool configComplete = !top.isNull();
bool hasEnabledChannels = false;
for (uint8_t i = 0; i < channelsCount && configComplete; i++) {
ChannelSettings* settingsPtr = &(channelSettings[i]);
JsonObject channel = top[settingsPtr->settingName];
configComplete &= !channel.isNull();
configComplete &= getJsonValue(channel[F("Enabled")], settingsPtr->isEnabled);
configComplete &= getJsonValue(channel[F("Name")], settingsPtr->name);
configComplete &= getJsonValue(channel[F("Units")], settingsPtr->units);
configComplete &= getJsonValue(channel[F("Multiplier")], settingsPtr->multiplier);
configComplete &= getJsonValue(channel[F("Offset")], settingsPtr->offset);
configComplete &= getJsonValue(channel[F("Decimals")], settingsPtr->decimals);
hasEnabledChannels |= settingsPtr->isEnabled;
}
configComplete &= getJsonValue(top[F("Loop Interval")], loopInterval);
isEnabled = isInitialized && configComplete && hasEnabledChannels;
return configComplete;
}
uint16_t getId()
{
return USERMOD_ID_ADS1115;
}
private:
static const uint8_t channelsCount = 8;
ChannelSettings channelSettings[channelsCount] = {
{
"Differential reading from AIN0 (P) and AIN1 (N)",
false,
"Differential AIN0 AIN1",
"V",
ADS1X15_REG_CONFIG_MUX_DIFF_0_1,
1,
0,
3
},
{
"Differential reading from AIN0 (P) and AIN3 (N)",
false,
"Differential AIN0 AIN3",
"V",
ADS1X15_REG_CONFIG_MUX_DIFF_0_3,
1,
0,
3
},
{
"Differential reading from AIN1 (P) and AIN3 (N)",
false,
"Differential AIN1 AIN3",
"V",
ADS1X15_REG_CONFIG_MUX_DIFF_1_3,
1,
0,
3
},
{
"Differential reading from AIN2 (P) and AIN3 (N)",
false,
"Differential AIN2 AIN3",
"V",
ADS1X15_REG_CONFIG_MUX_DIFF_2_3,
1,
0,
3
},
{
"Single-ended reading from AIN0",
false,
"Single-ended AIN0",
"V",
ADS1X15_REG_CONFIG_MUX_SINGLE_0,
1,
0,
3
},
{
"Single-ended reading from AIN1",
false,
"Single-ended AIN1",
"V",
ADS1X15_REG_CONFIG_MUX_SINGLE_1,
1,
0,
3
},
{
"Single-ended reading from AIN2",
false,
"Single-ended AIN2",
"V",
ADS1X15_REG_CONFIG_MUX_SINGLE_2,
1,
0,
3
},
{
"Single-ended reading from AIN3",
false,
"Single-ended AIN3",
"V",
ADS1X15_REG_CONFIG_MUX_SINGLE_3,
1,
0,
3
},
};
float readings[channelsCount] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned long loopInterval = 1000;
unsigned long lastTime = 0;
Adafruit_ADS1115 ads;
uint8_t activeChannel;
bool isEnabled = false;
bool isInitialized = false;
static float round(float value, uint8_t decimals) {
return roundf(value * powf(10, decimals)) / powf(10, decimals);
}
bool initChannel() {
for (uint8_t i = 0; i < channelsCount; i++) {
if (channelSettings[i].isEnabled) {
activeChannel = i;
return true;
}
}
activeChannel = 0;
return false;
}
void moveToNextChannel() {
uint8_t oldActiveChannel = activeChannel;
do
{
if (++activeChannel >= channelsCount){
activeChannel = 0;
}
}
while (!channelSettings[activeChannel].isEnabled && oldActiveChannel != activeChannel);
}
void startReading() {
ads.startADCReading(channelSettings[activeChannel].mux, /*continuous=*/false);
}
void updateResult() {
int16_t results = ads.getLastConversionResults();
readings[activeChannel] = ads.computeVolts(results);
}
};

View File

@ -0,0 +1,256 @@
#pragma once
#include "wled.h"
/*
* Usermod for analog clock
*/
extern Timezone* tz;
class AnalogClockUsermod : public Usermod {
private:
static constexpr uint32_t refreshRate = 50; // per second
static constexpr uint32_t refreshDelay = 1000 / refreshRate;
struct Segment {
// config
int16_t firstLed = 0;
int16_t lastLed = 59;
int16_t centerLed = 0;
// runtime
int16_t size;
Segment() {
update();
}
void validateAndUpdate() {
if (firstLed < 0 || firstLed >= strip.getLengthTotal() ||
lastLed < firstLed || lastLed >= strip.getLengthTotal()) {
*this = {};
return;
}
if (centerLed < firstLed || centerLed > lastLed) {
centerLed = firstLed;
}
update();
}
void update() {
size = lastLed - firstLed + 1;
}
};
// configuration (available in API and stored in flash)
bool enabled = false;
Segment mainSegment;
bool hourMarksEnabled = true;
uint32_t hourMarkColor = 0xFF0000;
uint32_t hourColor = 0x0000FF;
uint32_t minuteColor = 0x00FF00;
bool secondsEnabled = true;
Segment secondsSegment;
uint32_t secondColor = 0xFF0000;
bool blendColors = true;
uint16_t secondsEffect = 0;
// runtime
bool initDone = false;
uint32_t lastOverlayDraw = 0;
void validateAndUpdate() {
mainSegment.validateAndUpdate();
secondsSegment.validateAndUpdate();
if (secondsEffect < 0 || secondsEffect > 1) {
secondsEffect = 0;
}
}
int16_t adjustToSegment(double progress, Segment const& segment) {
int16_t led = segment.centerLed + progress * segment.size;
return led > segment.lastLed
? segment.firstLed + led - segment.lastLed - 1
: led;
}
void setPixelColor(uint16_t n, uint32_t c) {
if (!blendColors) {
strip.setPixelColor(n, c);
} else {
uint32_t oldC = strip.getPixelColor(n);
strip.setPixelColor(n, qadd32(oldC, c));
}
}
String colorToHexString(uint32_t c) {
char buffer[9];
sprintf(buffer, "%06X", c);
return buffer;
}
bool hexStringToColor(String const& s, uint32_t& c, uint32_t def) {
char *ep;
unsigned long long r = strtoull(s.c_str(), &ep, 16);
if (*ep == 0) {
c = r;
return true;
} else {
c = def;
return false;
}
}
void secondsEffectSineFade(int16_t secondLed, Toki::Time const& time) {
uint32_t ms = time.ms % 1000;
uint8_t b0 = (cos8(ms * 64 / 1000) - 128) * 2;
setPixelColor(secondLed, gamma32(scale32(secondColor, b0)));
uint8_t b1 = (sin8(ms * 64 / 1000) - 128) * 2;
setPixelColor(inc(secondLed, 1, secondsSegment), gamma32(scale32(secondColor, b1)));
}
static inline uint32_t qadd32(uint32_t c1, uint32_t c2) {
return RGBW32(
qadd8(R(c1), R(c2)),
qadd8(G(c1), G(c2)),
qadd8(B(c1), B(c2)),
qadd8(W(c1), W(c2))
);
}
static inline uint32_t scale32(uint32_t c, fract8 scale) {
return RGBW32(
scale8(R(c), scale),
scale8(G(c), scale),
scale8(B(c), scale),
scale8(W(c), scale)
);
}
static inline int16_t dec(int16_t n, int16_t i, Segment const& seg) {
return n - seg.firstLed >= i
? n - i
: seg.lastLed - seg.firstLed - i + n + 1;
}
static inline int16_t inc(int16_t n, int16_t i, Segment const& seg) {
int16_t r = n + i;
if (r > seg.lastLed) {
return seg.firstLed + n - seg.lastLed;
}
return r;
}
public:
AnalogClockUsermod() {
}
void setup() override {
initDone = true;
validateAndUpdate();
}
void loop() override {
if (millis() - lastOverlayDraw > refreshDelay) {
strip.trigger();
}
}
void handleOverlayDraw() override {
if (!enabled) {
return;
}
lastOverlayDraw = millis();
auto time = toki.getTime();
double secondP = second(localTime) / 60.0;
double minuteP = minute(localTime) / 60.0;
double hourP = (hour(localTime) % 12) / 12.0 + minuteP / 12.0;
if (hourMarksEnabled) {
for (int Led = 0; Led <= 55; Led = Led + 5)
{
int16_t hourmarkled = adjustToSegment(Led / 60.0, mainSegment);
setPixelColor(hourmarkled, hourMarkColor);
}
}
if (secondsEnabled) {
int16_t secondLed = adjustToSegment(secondP, secondsSegment);
switch (secondsEffect) {
case 0: // no effect
setPixelColor(secondLed, secondColor);
break;
case 1: // fading seconds
secondsEffectSineFade(secondLed, time);
break;
}
// TODO: move to secondsTrailEffect
// for (uint16_t i = 1; i < secondsTrail + 1; ++i) {
// uint16_t trailLed = dec(secondLed, i, secondsSegment);
// uint8_t trailBright = 255 / (secondsTrail + 1) * (secondsTrail - i + 1);
// setPixelColor(trailLed, gamma32(scale32(secondColor, trailBright)));
// }
}
setPixelColor(adjustToSegment(minuteP, mainSegment), minuteColor);
setPixelColor(adjustToSegment(hourP, mainSegment), hourColor);
}
void addToConfig(JsonObject& root) override {
validateAndUpdate();
JsonObject top = root.createNestedObject(F("Analog Clock"));
top[F("Overlay Enabled")] = enabled;
top[F("First LED (Main Ring)")] = mainSegment.firstLed;
top[F("Last LED (Main Ring)")] = mainSegment.lastLed;
top[F("Center/12h LED (Main Ring)")] = mainSegment.centerLed;
top[F("Hour Marks Enabled")] = hourMarksEnabled;
top[F("Hour Mark Color (RRGGBB)")] = colorToHexString(hourMarkColor);
top[F("Hour Color (RRGGBB)")] = colorToHexString(hourColor);
top[F("Minute Color (RRGGBB)")] = colorToHexString(minuteColor);
top[F("Show Seconds")] = secondsEnabled;
top[F("First LED (Seconds Ring)")] = secondsSegment.firstLed;
top[F("Last LED (Seconds Ring)")] = secondsSegment.lastLed;
top[F("Center/12h LED (Seconds Ring)")] = secondsSegment.centerLed;
top[F("Second Color (RRGGBB)")] = colorToHexString(secondColor);
top[F("Seconds Effect (0-1)")] = secondsEffect;
top[F("Blend Colors")] = blendColors;
}
bool readFromConfig(JsonObject& root) override {
JsonObject top = root[F("Analog Clock")];
bool configComplete = !top.isNull();
String color;
configComplete &= getJsonValue(top[F("Overlay Enabled")], enabled, false);
configComplete &= getJsonValue(top[F("First LED (Main Ring)")], mainSegment.firstLed, 0);
configComplete &= getJsonValue(top[F("Last LED (Main Ring)")], mainSegment.lastLed, 59);
configComplete &= getJsonValue(top[F("Center/12h LED (Main Ring)")], mainSegment.centerLed, 0);
configComplete &= getJsonValue(top[F("Hour Marks Enabled")], hourMarksEnabled, false);
configComplete &= getJsonValue(top[F("Hour Mark Color (RRGGBB)")], color, F("161616")) && hexStringToColor(color, hourMarkColor, 0x161616);
configComplete &= getJsonValue(top[F("Hour Color (RRGGBB)")], color, F("0000FF")) && hexStringToColor(color, hourColor, 0x0000FF);
configComplete &= getJsonValue(top[F("Minute Color (RRGGBB)")], color, F("00FF00")) && hexStringToColor(color, minuteColor, 0x00FF00);
configComplete &= getJsonValue(top[F("Show Seconds")], secondsEnabled, true);
configComplete &= getJsonValue(top[F("First LED (Seconds Ring)")], secondsSegment.firstLed, 0);
configComplete &= getJsonValue(top[F("Last LED (Seconds Ring)")], secondsSegment.lastLed, 59);
configComplete &= getJsonValue(top[F("Center/12h LED (Seconds Ring)")], secondsSegment.centerLed, 0);
configComplete &= getJsonValue(top[F("Second Color (RRGGBB)")], color, F("FF0000")) && hexStringToColor(color, secondColor, 0xFF0000);
configComplete &= getJsonValue(top[F("Seconds Effect (0-1)")], secondsEffect, 0);
configComplete &= getJsonValue(top[F("Blend Colors")], blendColors, true);
if (initDone) {
validateAndUpdate();
}
return configComplete;
}
uint16_t getId() override {
return USERMOD_ID_ANALOG_CLOCK;
}
};

View File

@ -25,6 +25,7 @@ class Animated_Staircase : public Usermod {
bool useUSSensorBottom = false; // using PIR or UltraSound sensor? bool useUSSensorBottom = false; // using PIR or UltraSound sensor?
unsigned int topMaxDist = 50; // default maximum measured distance in cm, top unsigned int topMaxDist = 50; // default maximum measured distance in cm, top
unsigned int bottomMaxDist = 50; // default maximum measured distance in cm, bottom unsigned int bottomMaxDist = 50; // default maximum measured distance in cm, bottom
bool togglePower = false; // toggle power on/off with staircase on/off
/* runtime variables */ /* runtime variables */
bool initDone = false; bool initDone = false;
@ -65,7 +66,7 @@ class Animated_Staircase : public Usermod {
// The maximum number of configured segments. // The maximum number of configured segments.
// Dynamically updated based on user configuration. // Dynamically updated based on user configuration.
byte maxSegmentId = 1; byte maxSegmentId = 1;
byte mainSegmentId = 0; byte minSegmentId = 0;
// These values are used by the API to read the // These values are used by the API to read the
// last sensor state, or trigger a sensor // last sensor state, or trigger a sensor
@ -90,39 +91,37 @@ class Animated_Staircase : public Usermod {
static const char _bottomEcho_pin[]; static const char _bottomEcho_pin[];
static const char _topEchoCm[]; static const char _topEchoCm[];
static const char _bottomEchoCm[]; static const char _bottomEchoCm[];
static const char _togglePower[];
void publishMqtt(bool bottom, const char* state) void publishMqtt(bool bottom, const char* state) {
{ #ifndef WLED_DISABLE_MQTT
//Check if MQTT Connected, otherwise it will crash the 8266 //Check if MQTT Connected, otherwise it will crash the 8266
if (WLED_MQTT_CONNECTED){ if (WLED_MQTT_CONNECTED){
char subuf[64]; char subuf[64];
sprintf_P(subuf, PSTR("%s/motion/%d"), mqttDeviceTopic, (int)bottom); sprintf_P(subuf, PSTR("%s/motion/%d"), mqttDeviceTopic, (int)bottom);
mqtt->publish(subuf, 0, false, state); mqtt->publish(subuf, 0, false, state);
} }
#endif
} }
void updateSegments() { void updateSegments() {
mainSegmentId = strip.getMainSegmentId(); for (int i = minSegmentId; i < maxSegmentId; i++) {
WS2812FX::Segment* segments = strip.getSegments(); Segment &seg = strip.getSegment(i);
for (int i = 0; i < MAX_NUM_SEGMENTS; i++, segments++) { if (!seg.isActive()) continue; // skip gaps
if (!segments->isActive()) {
maxSegmentId = i - 1;
break;
}
if (i >= onIndex && i < offIndex) { if (i >= onIndex && i < offIndex) {
segments->setOption(SEG_OPTION_ON, 1, 1); seg.setOption(SEG_OPTION_ON, true);
// We may need to copy mode and colors from segment 0 to make sure // We may need to copy mode and colors from segment 0 to make sure
// changes are propagated even when the config is changed during a wipe // changes are propagated even when the config is changed during a wipe
// segments->mode = mainsegment.mode; // seg.setMode(mainsegment.mode);
// segments->colors[0] = mainsegment.colors[0]; // seg.setColor(0, mainsegment.colors[0]);
} else { } else {
segments->setOption(SEG_OPTION_ON, 0, 1); seg.setOption(SEG_OPTION_ON, false);
} }
// Always mark segments as "transitional", we are animating the staircase // Always mark segments as "transitional", we are animating the staircase
segments->setOption(SEG_OPTION_TRANSITIONAL, 1, 1); //seg.setOption(SEG_OPTION_TRANSITIONAL, true); // not needed anymore as setOption() does it
} }
strip.trigger(); // force strip refresh
stateChanged = true; // inform external devices/UI of change
colorUpdated(CALL_MODE_DIRECT_CHANGE); colorUpdated(CALL_MODE_DIRECT_CHANGE);
} }
@ -199,6 +198,7 @@ class Animated_Staircase : public Usermod {
if (on) { if (on) {
lastSensor = topSensorRead; lastSensor = topSensorRead;
} else { } else {
if (togglePower && onIndex == offIndex && offMode) toggleOnOff(); // toggle power on if off
// If the bottom sensor triggered, we need to swipe up, ON // If the bottom sensor triggered, we need to swipe up, ON
swipe = bottomSensorRead; swipe = bottomSensorRead;
@ -208,9 +208,9 @@ class Animated_Staircase : public Usermod {
if (onIndex == offIndex) { if (onIndex == offIndex) {
// Position the indices for a correct on-swipe // Position the indices for a correct on-swipe
if (swipe == SWIPE_UP) { if (swipe == SWIPE_UP) {
onIndex = mainSegmentId; onIndex = minSegmentId;
} else { } else {
onIndex = maxSegmentId+1; onIndex = maxSegmentId;
} }
offIndex = onIndex; offIndex = onIndex;
} }
@ -222,7 +222,7 @@ class Animated_Staircase : public Usermod {
} }
void autoPowerOff() { void autoPowerOff() {
if (on && ((millis() - lastSwitchTime) > on_time_ms)) { if ((millis() - lastSwitchTime) > on_time_ms) {
// if sensors are still on, do nothing // if sensors are still on, do nothing
if (bottomSensorState || topSensorState) return; if (bottomSensorState || topSensorState) return;
@ -239,10 +239,12 @@ class Animated_Staircase : public Usermod {
if ((millis() - lastTime) > segment_delay_ms) { if ((millis() - lastTime) > segment_delay_ms) {
lastTime = millis(); lastTime = millis();
byte oldOn = onIndex;
byte oldOff = offIndex;
if (on) { if (on) {
// Turn on all segments // Turn on all segments
onIndex = MAX(mainSegmentId, onIndex - 1); onIndex = MAX(minSegmentId, onIndex - 1);
offIndex = MIN(maxSegmentId + 1, offIndex + 1); offIndex = MIN(maxSegmentId, offIndex + 1);
} else { } else {
if (swipe == SWIPE_UP) { if (swipe == SWIPE_UP) {
onIndex = MIN(offIndex, onIndex + 1); onIndex = MIN(offIndex, onIndex + 1);
@ -250,7 +252,10 @@ class Animated_Staircase : public Usermod {
offIndex = MAX(onIndex, offIndex - 1); offIndex = MAX(onIndex, offIndex - 1);
} }
} }
updateSegments(); if (oldOn != onIndex || oldOff != offIndex) {
updateSegments(); // reduce the number of updates to necessary ones
if (togglePower && onIndex == offIndex && !offMode && !on) toggleOnOff(); // toggle power off for all segments off
}
} }
} }
@ -288,16 +293,23 @@ class Animated_Staircase : public Usermod {
pinMode(topPIRorTriggerPin, OUTPUT); pinMode(topPIRorTriggerPin, OUTPUT);
pinMode(topEchoPin, INPUT); pinMode(topEchoPin, INPUT);
} }
onIndex = minSegmentId = strip.getMainSegmentId(); // it may not be the best idea to start with main segment as it may not be the first one
offIndex = maxSegmentId = strip.getLastActiveSegmentId() + 1;
// shorten the strip transition time to be equal or shorter than segment delay
transitionDelayTemp = transitionDelay = segment_delay_ms;
strip.setTransition(segment_delay_ms/100);
strip.trigger();
} else { } else {
if (togglePower && !on && offMode) toggleOnOff(); // toggle power on if off
// Restore segment options // Restore segment options
WS2812FX::Segment* segments = strip.getSegments(); for (int i = 0; i <= strip.getLastActiveSegmentId(); i++) {
for (int i = 0; i < MAX_NUM_SEGMENTS; i++, segments++) { Segment &seg = strip.getSegment(i);
if (!segments->isActive()) { if (!seg.isActive()) continue; // skip vector gaps
maxSegmentId = i - 1; seg.setOption(SEG_OPTION_ON, true);
break;
}
segments->setOption(SEG_OPTION_ON, 1, 1);
} }
strip.trigger(); // force strip update
stateChanged = true; // inform external dvices/UI of change
colorUpdated(CALL_MODE_DIRECT_CHANGE); colorUpdated(CALL_MODE_DIRECT_CHANGE);
DEBUG_PRINTLN(F("Animated Staircase disabled.")); DEBUG_PRINTLN(F("Animated Staircase disabled."));
} }
@ -333,13 +345,16 @@ class Animated_Staircase : public Usermod {
void loop() { void loop() {
if (!enabled || strip.isUpdating()) return; if (!enabled || strip.isUpdating()) return;
minSegmentId = strip.getMainSegmentId(); // it may not be the best idea to start with main segment as it may not be the first one
maxSegmentId = strip.getLastActiveSegmentId() + 1;
checkSensors(); checkSensors();
autoPowerOff(); if (on) autoPowerOff();
updateSwipe(); updateSwipe();
} }
uint16_t getId() { return USERMOD_ID_ANIMATED_STAIRCASE; } uint16_t getId() { return USERMOD_ID_ANIMATED_STAIRCASE; }
#ifndef WLED_DISABLE_MQTT
/** /**
* handling of MQTT message * handling of MQTT message
* topic only contains stripped topic (part after /wled/MAC) * topic only contains stripped topic (part after /wled/MAC)
@ -377,6 +392,7 @@ class Animated_Staircase : public Usermod {
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
} }
} }
#endif
void addToJsonState(JsonObject& root) { void addToJsonState(JsonObject& root) {
JsonObject staircase = root[FPSTR(_name)]; JsonObject staircase = root[FPSTR(_name)];
@ -393,19 +409,29 @@ class Animated_Staircase : public Usermod {
*/ */
void readFromJsonState(JsonObject& root) { void readFromJsonState(JsonObject& root) {
if (!initDone) return; // prevent crash on boot applyPreset() if (!initDone) return; // prevent crash on boot applyPreset()
bool en = enabled;
JsonObject staircase = root[FPSTR(_name)]; JsonObject staircase = root[FPSTR(_name)];
if (!staircase.isNull()) { if (!staircase.isNull()) {
if (staircase[FPSTR(_enabled)].is<bool>()) { if (staircase[FPSTR(_enabled)].is<bool>()) {
enabled = staircase[FPSTR(_enabled)].as<bool>(); en = staircase[FPSTR(_enabled)].as<bool>();
} else { } else {
String str = staircase[FPSTR(_enabled)]; // checkbox -> off or on String str = staircase[FPSTR(_enabled)]; // checkbox -> off or on
enabled = (bool)(str!="off"); // off is guaranteed to be present en = (bool)(str!="off"); // off is guaranteed to be present
} }
if (en != enabled) enable(en);
readSensorsFromJson(staircase); readSensorsFromJson(staircase);
DEBUG_PRINTLN(F("Staircase sensor state read from API.")); DEBUG_PRINTLN(F("Staircase sensor state read from API."));
} }
} }
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
}
/* /*
* Writes the configuration to internal flash memory. * Writes the configuration to internal flash memory.
*/ */
@ -425,6 +451,7 @@ class Animated_Staircase : public Usermod {
staircase[FPSTR(_bottomEcho_pin)] = useUSSensorBottom ? bottomEchoPin : -1; staircase[FPSTR(_bottomEcho_pin)] = useUSSensorBottom ? bottomEchoPin : -1;
staircase[FPSTR(_topEchoCm)] = topMaxDist; staircase[FPSTR(_topEchoCm)] = topMaxDist;
staircase[FPSTR(_bottomEchoCm)] = bottomMaxDist; staircase[FPSTR(_bottomEchoCm)] = bottomMaxDist;
staircase[FPSTR(_togglePower)] = togglePower;
DEBUG_PRINTLN(F("Staircase config saved.")); DEBUG_PRINTLN(F("Staircase config saved."));
} }
@ -469,6 +496,8 @@ class Animated_Staircase : public Usermod {
bottomMaxDist = top[FPSTR(_bottomEchoCm)] | bottomMaxDist; bottomMaxDist = top[FPSTR(_bottomEchoCm)] | bottomMaxDist;
bottomMaxDist = min(150,max(30,(int)bottomMaxDist)); // max distance ~1.5m (a lag of 9ms may be expected) bottomMaxDist = min(150,max(30,(int)bottomMaxDist)); // max distance ~1.5m (a lag of 9ms may be expected)
togglePower = top[FPSTR(_togglePower)] | togglePower; // staircase toggles power on/off
DEBUG_PRINT(FPSTR(_name)); DEBUG_PRINT(FPSTR(_name));
if (!initDone) { if (!initDone) {
// first run: reading from cfg.json // first run: reading from cfg.json
@ -492,7 +521,7 @@ class Animated_Staircase : public Usermod {
if (changed) setup(); if (changed) setup();
} }
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features // use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return true; return !top[FPSTR(_togglePower)].isNull();
} }
/* /*
@ -500,22 +529,22 @@ class Animated_Staircase : public Usermod {
* tab of the web-UI. * tab of the web-UI.
*/ */
void addToJsonInfo(JsonObject& root) { void addToJsonInfo(JsonObject& root) {
JsonObject staircase = root["u"]; JsonObject user = root["u"];
if (staircase.isNull()) { if (user.isNull()) {
staircase = root.createNestedObject("u"); user = root.createNestedObject("u");
} }
JsonArray usermodEnabled = staircase.createNestedArray(F("Staircase")); // name JsonArray infoArr = user.createNestedArray(FPSTR(_name)); // name
String btn = F("<button class=\"btn infobtn\" onclick=\"requestJson({staircase:{enabled:");
if (enabled) { String uiDomString = F("<button class=\"btn btn-xs\" onclick=\"requestJson({");
btn += F("false}},false,false);loadInfo();\">"); uiDomString += FPSTR(_name);
btn += F("enabled"); uiDomString += F(":{");
} else { uiDomString += FPSTR(_enabled);
btn += F("true}},false,false);loadInfo();\">"); uiDomString += enabled ? F(":false}});\">") : F(":true}});\">");
btn += F("disabled"); uiDomString += F("<i class=\"icons ");
} uiDomString += enabled ? "on" : "off";
btn += F("</button>"); uiDomString += F("\">&#xe08f;</i></button>");
usermodEnabled.add(btn); // value infoArr.add(uiDomString);
} }
}; };
@ -532,3 +561,4 @@ const char Animated_Staircase::_bottomPIRorTrigger_pin[] PROGMEM = "bottomPIR
const char Animated_Staircase::_bottomEcho_pin[] PROGMEM = "bottomEcho_pin"; const char Animated_Staircase::_bottomEcho_pin[] PROGMEM = "bottomEcho_pin";
const char Animated_Staircase::_topEchoCm[] PROGMEM = "top-dist-cm"; const char Animated_Staircase::_topEchoCm[] PROGMEM = "top-dist-cm";
const char Animated_Staircase::_bottomEchoCm[] PROGMEM = "bottom-dist-cm"; const char Animated_Staircase::_bottomEchoCm[] PROGMEM = "bottom-dist-cm";
const char Animated_Staircase::_togglePower[] PROGMEM = "toggle-on-off";

View File

@ -1,14 +1,14 @@
# Usermod Animated Staircase # Usermod Animated Staircase
This usermod makes your staircase look cool by switching it on with an animation. It uses This usermod makes your staircase look cool by illuminating it with an animation. It uses
PIR or ultrasonic sensors at the top and bottom of your stairs to: PIR or ultrasonic sensors at the top and bottom of your stairs to:
- Light up the steps in your walking direction, leading the way. - Light up the steps in the direction you're walking.
- Switch off the steps after you, in the direction of the last detected movement. - Switch off the steps after you, in the direction of the last detected movement.
- Always switch on when one of the sensors detects movement, even if an effect - Always switch on when one of the sensors detects movement, even if an effect
is still running. It can therewith handle multiple people on the stairs gracefully. is still running. It can gracefully handle multiple people on the stairs.
The Animated Staircase can be controlled by the WLED API. Change settings such as The Animated Staircase can be controlled by the WLED API. Change settings such as
speed, on/off time and distance settings by sending an HTTP request, see below. speed, on/off time and distance by sending an HTTP request, see below.
## WLED integration ## WLED integration
To include this usermod in your WLED setup, you have to be able to [compile WLED from source](https://github.com/Aircoookie/WLED/wiki/Compiling-WLED). To include this usermod in your WLED setup, you have to be able to [compile WLED from source](https://github.com/Aircoookie/WLED/wiki/Compiling-WLED).
@ -20,17 +20,16 @@ Edit `usermods_list.cpp`:
2. add `#include "../usermods/Animated_Staircase/Animated_Staircase.h"` to the top of the file 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. 3. add `usermods.add(new Animated_Staircase());` to the end of the `void registerUsermods()` function.
You can configure usermod using Usermods settings page. You can configure usermod using the Usermods settings page.
Please enter GPIO pins for PIR sensors or ultrasonic sensor (trigger and echo). Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo).
If you use PIR sensor enter -1 for echo pin. If you use PIR sensor enter -1 for echo pin.
Maximum distance for ultrasonic sensor can be configured as a time needed for echo (see below). Maximum distance for ultrasonic sensor can be configured as the time needed for an echo (see below).
## Hardware installation ## Hardware installation
1. Stick the LED strip under each step of the stairs. 1. Attach the LED strip to each step of the stairs.
2. Connect the ESP8266 pin D4 or ESP32 pin D2 to the first LED data pin at the bottom step 2. Connect the ESP8266 pin D4 or ESP32 pin D2 to the first LED data pin at the bottom step.
of your stairs.
3. Connect the data-out pin at the end of each strip per step to the data-in pin on the 3. Connect the data-out pin at the end of each strip per step to the data-in pin on the
other end of the next step, creating one large virtual LED strip. next step, creating one large virtual LED strip.
4. Mount sensors of choice at the bottom and top of the stairs and connect them to the ESP. 4. Mount sensors of choice at the bottom and top of the stairs and connect them to the ESP.
5. To make sure all LEDs get enough power and have your staircase lighted evenly, power each 5. To make sure all LEDs get enough power and have your staircase lighted evenly, power each
step from one side, using at least AWG14 or 2.5mm^2 cable. Don't connect them serial as you step from one side, using at least AWG14 or 2.5mm^2 cable. Don't connect them serial as you
@ -62,7 +61,7 @@ or remove them and put everything on one line.
To read the current settings, open a browser to `http://xxx.xxx.xxx.xxx/json/state` (use your WLED To read the current settings, open a browser to `http://xxx.xxx.xxx.xxx/json/state` (use your WLED
device IP address). The device will respond with a json object containing all WLED settings. device IP address). The device will respond with a json object containing all WLED settings.
The staircase settings and sensor states are inside the WLED status element: The staircase settings and sensor states are inside the WLED "state" element:
```json ```json
{ {
@ -70,14 +69,14 @@ The staircase settings and sensor states are inside the WLED status element:
"staircase": { "staircase": {
"enabled": true, "enabled": true,
"bottom-sensor": false, "bottom-sensor": false,
"tops-ensor": false "top-sensor": false
}, },
} }
``` ```
### Enable/disable the usermod ### Enable/disable the usermod
By disabling the usermod you will be able to keep the LED's on, independent from the sensor By disabling the usermod you will be able to keep the LED's on, independent from the sensor
activity. This enables to play with the lights without the usermod switching them on or off. activity. This enables you to play with the lights without the usermod switching them on or off.
To disable the usermod: To disable the usermod:
@ -92,17 +91,17 @@ To enable the usermod again, use `"enabled":true`.
Alternatively you can use _Usermod_ Settings page where you can change other parameters as well. Alternatively you can use _Usermod_ Settings page where you can change other parameters as well.
### Changing animation parameters and detection range of the ultrasonic HC-SR04 sensor ### Changing animation parameters and detection range of the ultrasonic HC-SR04 sensor
Using _Usermod_ Settings page you can define different usermod parameters, includng sensor pins, delay between segment activation and so on. Using _Usermod_ Settings page you can define different usermod parameters, includng sensor pins, delay between segment activation etc.
When an ultrasonic sensor is enabled you can enter maximum detection distance in centimeters separately for top and bottom sensors. When an ultrasonic sensor is enabled you can enter maximum detection distance in centimeters separately for top and bottom sensors.
**Please note:** that using an HC-SR04 sensor, particularly when detecting echos at longer **Please note:** using an HC-SR04 sensor, particularly when detecting echos at longer
distances creates delays in the WLED software, and _might_ introduce timing hickups in your animations or distances creates delays in the WLED software, _might_ introduce timing hiccups in your animation or
a less responsive web interface. It is therefore advised to keep the detection distance as short as possible. a less responsive web interface. It is therefore advised to keep the detection distance as short as possible.
### Animation triggering through the API ### Animation triggering through the API
Instead of stairs activation by one of the sensors, you can also trigger the animation through In addition to activation by one of the stair sensors, you can also trigger the animation manually
the API. To simulate triggering the bottom sensor, use: via the API. To simulate triggering the bottom sensor, use:
```bash ```bash
curl -X POST -H "Content-Type: application/json" \ curl -X POST -H "Content-Type: application/json" \
@ -110,7 +109,7 @@ curl -X POST -H "Content-Type: application/json" \
xxx.xxx.xxx.xxx/json/state xxx.xxx.xxx.xxx/json/state
``` ```
Likewise, to trigger the top sensor, use: Likewise, to trigger the top sensor:
```bash ```bash
curl -X POST -H "Content-Type: application/json" \ curl -X POST -H "Content-Type: application/json" \
@ -119,7 +118,7 @@ curl -X POST -H "Content-Type: application/json" \
``` ```
**MQTT** **MQTT**
You can publish a message with either `up` or `down` on topic `/swipe` to trigger animation. You can publish a message with either `up` or `down` on topic `/swipe` to trigger animation.
You can also use `on` or `off` for enabling or disabling usermod. You can also use `on` or `off` for enabling or disabling the usermod.
Have fun with this usermod.<br/> Have fun with this usermod.<br/>
www.rolfje.com www.rolfje.com

View File

@ -24,7 +24,7 @@ void RGBNET_readValues() {
int channel = UDP.read(); int channel = UDP.read();
//channel data is not used we only supports one channel //channel data is not used we only supports one channel
int len = UDP.read(RGBNET_packet, ledCount*3); int len = UDP.read(RGBNET_packet, strip.getLengthTotal()*3);
if(len==0){ if(len==0){
return; return;
} }
@ -50,7 +50,7 @@ void handleConfig(AsyncWebServerRequest *request)
\"channels\": [\ \"channels\": [\
{\ {\
\"channel\": 1,\ \"channel\": 1,\
\"leds\": " + ledCount + "\ \"leds\": " + strip.getLengthTotal() + "\
},\ },\
{\ {\
\"channel\": 2,\ \"channel\": 2,\

View File

@ -0,0 +1,49 @@
# BH1750 usermod
This usermod will read from an ambient light sensor like the BH1750.
The luminance is displayed in both the Info section of the web UI, as well as published to the `/luminance` MQTT topic if enabled.
## 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.
## Compiliation
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
```
### Configuration Options
The following settings can be set at compile-time but are configurable on the usermod menu (except First Measurement time):
* `USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL` - the max number of milliseconds between measurements, defaults to 10000ms
* `USERMOD_BH1750_MIN_MEASUREMENT_INTERVAL` - the min number of milliseconds between measurements, defaults to 500ms
* `USERMOD_BH1750_OFFSET_VALUE` - the offset value to report on, defaults to 1
* `USERMOD_BH1750_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 10000 ms
In addition, the Usermod screen allows you to:
- enable/disable the usermod
- Enable Home Assistant Discovery of usermod
- Configure the SCL/SDA pins
## API
The following method is available to interact with the usermod from other code modules:
- `getIlluminance` read the brightness from the sensor
## Change Log
Jul 2022
- Added Home Assistant Discovery
- Implemented PinManager to register pins
- Made pins configurable in usermod menu
- Added API call to read luminance from other modules
- Enhanced info-screen outputs
- Updated `readme.md`

View File

@ -0,0 +1,252 @@
// 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>
// the max frequency to check photoresistor, 10 seconds
#ifndef USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL
#define USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL 10000
#endif
// the min frequency to check photoresistor, 500 ms
#ifndef USERMOD_BH1750_MIN_MEASUREMENT_INTERVAL
#define USERMOD_BH1750_MIN_MEASUREMENT_INTERVAL 500
#endif
// how many seconds after boot to take first measurement, 10 seconds
#ifndef USERMOD_BH1750_FIRST_MEASUREMENT_AT
#define USERMOD_BH1750_FIRST_MEASUREMENT_AT 10000
#endif
// only report if differance grater than offset value
#ifndef USERMOD_BH1750_OFFSET_VALUE
#define USERMOD_BH1750_OFFSET_VALUE 1
#endif
class Usermod_BH1750 : public Usermod
{
private:
int8_t offset = USERMOD_BH1750_OFFSET_VALUE;
unsigned long maxReadingInterval = USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL;
unsigned long minReadingInterval = USERMOD_BH1750_MIN_MEASUREMENT_INTERVAL;
unsigned long lastMeasurement = UINT32_MAX - (USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL - USERMOD_BH1750_FIRST_MEASUREMENT_AT);
unsigned long lastSend = UINT32_MAX - (USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL - USERMOD_BH1750_FIRST_MEASUREMENT_AT);
// flag to indicate we have finished the first readLightLevel call
// allows this library to report to the user how long until the first
// measurement
bool getLuminanceComplete = false;
// flag set at startup
bool enabled = true;
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _enabled[];
static const char _maxReadInterval[];
static const char _minReadInterval[];
static const char _offset[];
static const char _HomeAssistantDiscovery[];
bool initDone = false;
bool sensorFound = false;
// Home Assistant and MQTT
String mqttLuminanceTopic = F("");
bool mqttInitialized = false;
bool HomeAssistantDiscovery = true; // Publish Home Assistant Discovery messages
BH1750 lightMeter;
float lastLux = -1000;
bool checkBoundSensor(float newValue, float prevValue, float maxDiff)
{
return isnan(prevValue) || newValue <= prevValue - maxDiff || newValue >= prevValue + maxDiff || (newValue == 0.0 && prevValue > 0.0);
}
// set up Home Assistant discovery entries
void _mqttInitialize()
{
mqttLuminanceTopic = String(mqttDeviceTopic) + F("/brightness");
if (HomeAssistantDiscovery) _createMqttSensor(F("Brightness"), mqttLuminanceTopic, F("Illuminance"), F(" lx"));
}
// Create an MQTT Sensor for Home Assistant Discovery purposes, this includes a pointer to the topic that is published to in the Loop.
void _createMqttSensor(const String &name, const String &topic, const String &deviceClass, const String &unitOfMeasurement)
{
String t = String(F("homeassistant/sensor/")) + mqttClientID + F("/") + name + F("/config");
StaticJsonDocument<600> doc;
doc[F("name")] = String(serverDescription) + F(" ") + 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");
device[F("model")] = F("FOSS");
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());
}
public:
void setup()
{
if (i2c_scl<0 || i2c_sda<0) { enabled = false; return; }
sensorFound = lightMeter.begin();
initDone = true;
}
void loop()
{
if ((!enabled) || strip.isUpdating())
return;
unsigned long now = millis();
// check to see if we are due for taking a measurement
// lastMeasurement will not be updated until the conversion
// is complete the the reading is finished
if (now - lastMeasurement < minReadingInterval)
{
return;
}
bool shouldUpdate = now - lastSend > maxReadingInterval;
float lux = lightMeter.readLightLevel();
lastMeasurement = millis();
getLuminanceComplete = true;
if (shouldUpdate || checkBoundSensor(lux, lastLux, offset))
{
lastLux = lux;
lastSend = millis();
#ifndef WLED_DISABLE_MQTT
if (WLED_MQTT_CONNECTED)
{
if (!mqttInitialized)
{
_mqttInitialize();
mqttInitialized = true;
}
mqtt->publish(mqttLuminanceTopic.c_str(), 0, true, String(lux).c_str());
DEBUG_PRINTLN(F("Brightness: ") + String(lux) + F("lx"));
}
else
{
DEBUG_PRINTLN(F("Missing MQTT connection. Not publishing data"));
}
#endif
}
}
inline float getIlluminance() {
return (float)lastLux;
}
void addToJsonInfo(JsonObject &root)
{
JsonObject user = root[F("u")];
if (user.isNull())
user = root.createNestedObject(F("u"));
JsonArray lux_json = user.createNestedArray(F("Luminance"));
if (!enabled) {
lux_json.add(F("disabled"));
} else if (!sensorFound) {
// if no sensor
lux_json.add(F("BH1750 "));
lux_json.add(F("Not Found"));
} else if (!getLuminanceComplete) {
// if we haven't read the sensor yet, let the user know
// that we are still waiting for the first measurement
lux_json.add((USERMOD_BH1750_FIRST_MEASUREMENT_AT - millis()) / 1000);
lux_json.add(F(" sec until read"));
return;
} else {
lux_json.add(lastLux);
lux_json.add(F(" lx"));
}
}
// (called from set.cpp) stores persistent properties to cfg.json
void addToConfig(JsonObject &root)
{
// we add JSON object.
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
top[FPSTR(_enabled)] = enabled;
top[FPSTR(_maxReadInterval)] = maxReadingInterval;
top[FPSTR(_minReadInterval)] = minReadingInterval;
top[FPSTR(_HomeAssistantDiscovery)] = HomeAssistantDiscovery;
top[FPSTR(_offset)] = offset;
DEBUG_PRINTLN(F("BH1750 config saved."));
}
// called before setup() to populate properties from values stored in cfg.json
bool readFromConfig(JsonObject &root)
{
// we look for JSON object.
JsonObject top = root[FPSTR(_name)];
if (top.isNull())
{
DEBUG_PRINT(FPSTR(_name));
DEBUG_PRINT(F("BH1750"));
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
bool configComplete = !top.isNull();
configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled, false);
configComplete &= getJsonValue(top[FPSTR(_maxReadInterval)], maxReadingInterval, 10000); //ms
configComplete &= getJsonValue(top[FPSTR(_minReadInterval)], minReadingInterval, 500); //ms
configComplete &= getJsonValue(top[FPSTR(_HomeAssistantDiscovery)], HomeAssistantDiscovery, false);
configComplete &= getJsonValue(top[FPSTR(_offset)], offset, 1);
DEBUG_PRINT(FPSTR(_name));
if (!initDone) {
DEBUG_PRINTLN(F(" config loaded."));
} else {
DEBUG_PRINTLN(F(" config (re)loaded."));
}
return configComplete;
}
uint16_t getId()
{
return USERMOD_ID_BH1750;
}
};
// strings to reduce flash memory usage (used more than twice)
const char Usermod_BH1750::_name[] PROGMEM = "BH1750";
const char Usermod_BH1750::_enabled[] PROGMEM = "enabled";
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";

View File

@ -1,36 +1,60 @@
Hello! I have written a v2 usermod for the BME280/BMP280 sensor based on the [existing v1 usermod](https://github.com/Aircoookie/WLED/blob/master/usermods/Wemos_D1_mini%2BWemos32_mini_shield/usermod_bme280.cpp). It is not just a refactor, there are many changes which I made to fit my use case, and I hope they will fit the use cases of others as well! Most notably, this usermod is *just* for the BME280 and does not control a display like in the v1 usermod designed for the WeMos shield. # Usermod BME280
This Usermod is designed to read a `BME280` or `BMP280` sensor and output the following:
- Temperature
- Humidity (`BME280` only)
- Pressure
- Heat Index (`BME280` only)
- Dew Point (`BME280` only)
- Requires libraries `BME280@~3.0.0` (by [finitespace](https://github.com/finitespace/BME280)) and `Wire`. Please add these under `lib_deps` in your `platform.ini` (or `platform_override.ini`). 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:
- Data is published over MQTT so make sure you've enabled the MQTT sync interface. - Temperature Decimals (number of decimal places to output)
- This usermod also writes to serial (GPIO1 on ESP8266). Please make sure nothing else listening on the serial TX pin of your board will get confused by log messages! - Humidity Decimals
- Pressure Decimals
- Temperature Interval (how many seconds between temperature and humidity measurements)
- Pressure Interval
- Publish Always (turn off to only publish changes, on to publish whether or not value changed)
- Use Celsius (turn off to use Fahrenheit)
- Home Assistant Discovery (turn on to sent MQTT Discovery entries for Home Assistant)
- SCL/SDA GPIO Pins
To enable, compile with `USERMOD_BME280` defined (i.e. `platformio_override.ini`) 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!
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.
- `getTemperatureC()`
- `getTemperatureF()`
- `getHumidity()`
- `getPressure()`
- `getDewPointC()`
- `getDewPointF()`
- `getHeatIndexC()`
- `getHeatIndexF()`
# Compiling
To enable, compile with `USERMOD_BME280` defined (e.g. in `platformio_override.ini`)
```ini ```ini
[env:usermod_bme280_d1_mini]
extends = env:d1_mini
build_flags = build_flags =
${common.build_flags_esp8266} ${common.build_flags_esp8266}
-D USERMOD_BME280 -D USERMOD_BME280
``` lib_deps =
or define `USERMOD_BME280` in `my_config.h` ${esp8266.lib_deps}
```c++ BME280@~3.0.0
#define USERMOD_BME280 Wire
``` ```
Changes include:
- Adjustable measure intervals
- Temperature and pressure have separate intervals due to pressure not frequently changing at any constant altitude
- Adjustment of number of decimal places in published sensor values
- Separate adjustment for temperature, humidity and pressure values
- Values are rounded to the specified number of decimal places
- Pressure measured in units of hPa instead of Pa
- Calculation of heat index (apparent temperature) and dew point
- These, along with humidity measurements, are disabled if the sensor is a BMP280
- 16x oversampling of sensor during measurement
- Values are only published if they are different from the previous value
- Values are published on startup (continually until the MQTT broker acknowledges a successful publication)
Adjustments are made through preprocessor definitions at the start of the class definition. # MQTT
MQTT topics are as follows (`<deviceTopic>` is set in MQTT section of Sync Setup menu):
MQTT topics are as follows:
Measurement type | MQTT topic Measurement type | MQTT topic
--- | --- --- | ---
Temperature | `<deviceTopic>/temperature` Temperature | `<deviceTopic>/temperature`
@ -38,3 +62,29 @@ Humidity | `<deviceTopic>/humidity`
Pressure | `<deviceTopic>/pressure` Pressure | `<deviceTopic>/pressure`
Heat index | `<deviceTopic>/heat_index` Heat index | `<deviceTopic>/heat_index`
Dew point | `<deviceTopic>/dew_point` Dew point | `<deviceTopic>/dew_point`
If you are using Home Assistant, and `Home Assistant Discovery` is turned on, Home Assistant should automatically detect a new device, provided you have the MQTT integration installed. The device is separate from the main WLED device and will contain sensors for Pressure, Humidity, Temperature, Dew Point and Heat Index.
# Revision History
Jul 2022
- Added Home Assistant Discovery
- Added API interface to output data
- Removed compile-time variables
- Added usermod menu interface
- Added value outputs to info screen
- Updated `readme.md`
- Registered usermod
- Implemented PinManager for usermod
- Implemented reallocation of pins without reboot
Apr 2021
- Added `Publish Always` option
Dec 2020
- Ported to V2 Usermod format
- Customizable `measure intervals`
- Customizable number of `decimal places` in published sensor values
- Pressure measured in units of hPa instead of Pa
- Calculation of heat index (apparent temperature) and dew point
- `16x oversampling` of sensor during measurement
- Values only published if they are different from the previous value

View File

@ -1,51 +1,39 @@
// 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 #pragma once
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#include <Wire.h>
#include <BME280I2C.h> // BME280 sensor #include <BME280I2C.h> // BME280 sensor
#include <EnvironmentCalculations.h> // BME280 extended measurements #include <EnvironmentCalculations.h> // BME280 extended measurements
class UsermodBME280 : public Usermod class UsermodBME280 : public Usermod
{ {
private: private:
// User-defined configuration
#define Celsius // Show temperature mesaurement in Celcius. Comment out for Fahrenheit
#define TemperatureDecimals 1 // Number of decimal places in published temperaure values
#define HumidityDecimals 2 // Number of decimal places in published humidity values
#define PressureDecimals 2 // Number of decimal places in published pressure values
#define TemperatureInterval 5 // Interval to measure temperature (and humidity, dew point if available) in seconds
#define PressureInterval 300 // Interval to measure pressure in seconds
#define PublishAlways 0 // Publish values even when they have not changed
// Sanity checks // NOTE: Do not implement any compile-time variables, anything the user needs to configure
#if !defined(TemperatureDecimals) || TemperatureDecimals < 0 // should be configurable from the Usermod menu using the methods below
#define TemperatureDecimals 0 // key settings set via usermod menu
#endif uint8_t TemperatureDecimals = 0; // Number of decimal places in published temperaure values
#if !defined(HumidityDecimals) || HumidityDecimals < 0 uint8_t HumidityDecimals = 0; // Number of decimal places in published humidity values
#define HumidityDecimals 0 uint8_t PressureDecimals = 0; // Number of decimal places in published pressure values
#endif uint16_t TemperatureInterval = 5; // Interval to measure temperature (and humidity, dew point if available) in seconds
#if !defined(PressureDecimals) || PressureDecimals < 0 uint16_t PressureInterval = 300; // Interval to measure pressure in seconds
#define PressureDecimals 0 bool PublishAlways = false; // Publish values even when they have not changed
#endif bool UseCelsius = true; // Use Celsius for Reporting
#if !defined(TemperatureInterval) || TemperatureInterval < 0 bool HomeAssistantDiscovery = false; // Publish Home Assistant Device Information
#define TemperatureInterval 1 bool enabled = true;
#endif
#if !defined(PressureInterval) || PressureInterval < 0
#define PressureInterval TemperatureInterval
#endif
#if !defined(PublishAlways)
#define PublishAlways 0
#endif
#ifdef ARDUINO_ARCH_ESP32 // ESP32 boards // set the default pins based on the architecture, these get overridden by Usermod menu settings
uint8_t SCL_PIN = 22; #ifdef ESP8266
uint8_t SDA_PIN = 21; //uint8_t RST_PIN = 16; // Uncoment for Heltec WiFi-Kit-8
#else // ESP8266 boards #endif
uint8_t SCL_PIN = 5; bool initDone = false;
uint8_t SDA_PIN = 4;
//uint8_t RST_PIN = 16; // Uncoment for Heltec WiFi-Kit-8
#endif
// BME280 sensor settings // BME280 sensor settings
BME280I2C::Settings settings{ BME280I2C::Settings settings{
@ -75,6 +63,7 @@ private:
float sensorHeatIndex; float sensorHeatIndex;
float sensorDewPoint; float sensorDewPoint;
float sensorPressure; float sensorPressure;
String tempScale;
// Track previous sensor values // Track previous sensor values
float lastTemperature; float lastTemperature;
float lastHumidity; float lastHumidity;
@ -82,43 +71,125 @@ private:
float lastDewPoint; float lastDewPoint;
float lastPressure; float lastPressure;
// Store packet IDs of MQTT publications // MQTT topic strings for publishing Home Assistant discovery topics
uint16_t mqttTemperaturePub = 0; bool mqttInitialized = false;
uint16_t mqttPressurePub = 0;
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _enabled[];
// Read the BME280/BMP280 Sensor (which one runs depends on whether Celsius or Farenheit being set in Usermod Menu)
void UpdateBME280Data(int SensorType) void UpdateBME280Data(int SensorType)
{ {
float _temperature, _humidity, _pressure; float _temperature, _humidity, _pressure;
#ifdef Celsius
if (UseCelsius) {
BME280::TempUnit tempUnit(BME280::TempUnit_Celsius); BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
EnvironmentCalculations::TempUnit envTempUnit(EnvironmentCalculations::TempUnit_Celsius); EnvironmentCalculations::TempUnit envTempUnit(EnvironmentCalculations::TempUnit_Celsius);
#else BME280::PresUnit presUnit(BME280::PresUnit_hPa);
bme.read(_pressure, _temperature, _humidity, tempUnit, presUnit);
sensorTemperature = _temperature;
sensorHumidity = _humidity;
sensorPressure = _pressure;
tempScale = F("°C");
if (sensorType == 1)
{
sensorHeatIndex = EnvironmentCalculations::HeatIndex(_temperature, _humidity, envTempUnit);
sensorDewPoint = EnvironmentCalculations::DewPoint(_temperature, _humidity, envTempUnit);
}
} else {
BME280::TempUnit tempUnit(BME280::TempUnit_Fahrenheit); BME280::TempUnit tempUnit(BME280::TempUnit_Fahrenheit);
EnvironmentCalculations::TempUnit envTempUnit(EnvironmentCalculations::TempUnit_Fahrenheit); EnvironmentCalculations::TempUnit envTempUnit(EnvironmentCalculations::TempUnit_Fahrenheit);
#endif BME280::PresUnit presUnit(BME280::PresUnit_hPa);
BME280::PresUnit presUnit(BME280::PresUnit_hPa);
bme.read(_pressure, _temperature, _humidity, tempUnit, presUnit); bme.read(_pressure, _temperature, _humidity, tempUnit, presUnit);
sensorTemperature = _temperature; sensorTemperature = _temperature;
sensorHumidity = _humidity; sensorHumidity = _humidity;
sensorPressure = _pressure; sensorPressure = _pressure;
if (sensorType == 1) tempScale = F("°F");
{ if (sensorType == 1)
sensorHeatIndex = EnvironmentCalculations::HeatIndex(_temperature, _humidity, envTempUnit); {
sensorDewPoint = EnvironmentCalculations::DewPoint(_temperature, _humidity, envTempUnit); sensorHeatIndex = EnvironmentCalculations::HeatIndex(_temperature, _humidity, envTempUnit);
sensorDewPoint = EnvironmentCalculations::DewPoint(_temperature, _humidity, envTempUnit);
}
} }
} }
// Procedure to define all MQTT discovery Topics
void _mqttInitialize()
{
char mqttTemperatureTopic[128];
char mqttHumidityTopic[128];
char mqttPressureTopic[128];
char mqttHeatIndexTopic[128];
char mqttDewPointTopic[128];
snprintf_P(mqttTemperatureTopic, 127, PSTR("%s/temperature"), mqttDeviceTopic);
snprintf_P(mqttPressureTopic, 127, PSTR("%s/pressure"), mqttDeviceTopic);
snprintf_P(mqttHumidityTopic, 127, PSTR("%s/humidity"), mqttDeviceTopic);
snprintf_P(mqttHeatIndexTopic, 127, PSTR("%s/heat_index"), mqttDeviceTopic);
snprintf_P(mqttDewPointTopic, 127, PSTR("%s/dew_point"), mqttDeviceTopic);
if (HomeAssistantDiscovery) {
_createMqttSensor(F("Temperature"), mqttTemperatureTopic, "temperature", tempScale);
_createMqttSensor(F("Pressure"), mqttPressureTopic, "pressure", F("hPa"));
_createMqttSensor(F("Humidity"), mqttHumidityTopic, "humidity", F("%"));
_createMqttSensor(F("HeatIndex"), mqttHeatIndexTopic, "temperature", tempScale);
_createMqttSensor(F("DewPoint"), mqttDewPointTopic, "temperature", tempScale);
}
}
// Create an MQTT Sensor for Home Assistant Discovery purposes, this includes a pointer to the topic that is published to in the Loop.
void _createMqttSensor(const String &name, const String &topic, const String &deviceClass, const String &unitOfMeasurement)
{
String t = String(F("homeassistant/sensor/")) + mqttClientID + F("/") + name + F("/config");
StaticJsonDocument<600> doc;
doc[F("name")] = String(serverDescription) + " " + 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");
device[F("model")] = F("FOSS");
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 publishMqtt(const char *topic, const char* state) {
//Check if MQTT Connected, otherwise it will crash the 8266
if (WLED_MQTT_CONNECTED){
char subuf[128];
snprintf_P(subuf, 127, PSTR("%s/%s"), mqttDeviceTopic, topic);
mqtt->publish(subuf, 0, false, state);
}
}
public: public:
void setup() void setup()
{ {
Wire.begin(SDA_PIN, SCL_PIN); if (i2c_scl<0 || i2c_sda<0) { enabled = false; sensorType = 0; return; }
if (!bme.begin()) if (!bme.begin())
{ {
sensorType = 0; sensorType = 0;
Serial.println("Could not find BME280I2C sensor!"); DEBUG_PRINTLN(F("Could not find BME280 I2C sensor!"));
} }
else else
{ {
@ -126,69 +197,68 @@ public:
{ {
case BME280::ChipModel_BME280: case BME280::ChipModel_BME280:
sensorType = 1; sensorType = 1;
Serial.println("Found BME280 sensor! Success."); DEBUG_PRINTLN(F("Found BME280 sensor! Success."));
break; break;
case BME280::ChipModel_BMP280: case BME280::ChipModel_BMP280:
sensorType = 2; sensorType = 2;
Serial.println("Found BMP280 sensor! No Humidity available."); DEBUG_PRINTLN(F("Found BMP280 sensor! No Humidity available."));
break; break;
default: default:
sensorType = 0; sensorType = 0;
Serial.println("Found UNKNOWN sensor! Error!"); DEBUG_PRINTLN(F("Found UNKNOWN sensor! Error!"));
} }
} }
initDone=true;
} }
void loop() void loop()
{ {
if (!enabled || strip.isUpdating()) return;
// BME280 sensor MQTT publishing // BME280 sensor MQTT publishing
// Check if sensor present and MQTT Connected, otherwise it will crash the MCU // Check if sensor present and Connected, otherwise it will crash the MCU
if (sensorType != 0 && mqtt != nullptr) if (sensorType != 0)
{ {
// Timer to fetch new temperature, humidity and pressure data at intervals // Timer to fetch new temperature, humidity and pressure data at intervals
timer = millis(); timer = millis();
if (timer - lastTemperatureMeasure >= TemperatureInterval * 1000 || mqttTemperaturePub == 0) if (timer - lastTemperatureMeasure >= TemperatureInterval * 1000)
{ {
lastTemperatureMeasure = timer; lastTemperatureMeasure = timer;
UpdateBME280Data(sensorType); UpdateBME280Data(sensorType);
float temperature = roundf(sensorTemperature * pow(10, TemperatureDecimals)) / pow(10, TemperatureDecimals); float temperature = roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
float humidity, heatIndex, dewPoint; float humidity, heatIndex, dewPoint;
// If temperature has changed since last measure, create string populated with device topic // If temperature has changed since last measure, create string populated with device topic
// from the UI and values read from sensor, then publish to broker // from the UI and values read from sensor, then publish to broker
if (temperature != lastTemperature || PublishAlways) if (temperature != lastTemperature || PublishAlways)
{ {
String topic = String(mqttDeviceTopic) + "/temperature"; publishMqtt("temperature", String(temperature, TemperatureDecimals).c_str());
mqttTemperaturePub = mqtt->publish(topic.c_str(), 0, false, String(temperature, TemperatureDecimals).c_str());
} }
lastTemperature = temperature; // Update last sensor temperature for next loop lastTemperature = temperature; // Update last sensor temperature for next loop
if (sensorType == 1) // Only if sensor is a BME280 if (sensorType == 1) // Only if sensor is a BME280
{ {
humidity = roundf(sensorHumidity * pow(10, HumidityDecimals)) / pow(10, HumidityDecimals); humidity = roundf(sensorHumidity * powf(10, HumidityDecimals)) / powf(10, HumidityDecimals);
heatIndex = roundf(sensorHeatIndex * pow(10, TemperatureDecimals)) / pow(10, TemperatureDecimals); heatIndex = roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
dewPoint = roundf(sensorDewPoint * pow(10, TemperatureDecimals)) / pow(10, TemperatureDecimals); dewPoint = roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
if (humidity != lastHumidity || PublishAlways) if (humidity != lastHumidity || PublishAlways)
{ {
String topic = String(mqttDeviceTopic) + "/humidity"; publishMqtt("humidity", String(humidity, HumidityDecimals).c_str());
mqtt->publish(topic.c_str(), 0, false, String(humidity, HumidityDecimals).c_str());
} }
if (heatIndex != lastHeatIndex || PublishAlways) if (heatIndex != lastHeatIndex || PublishAlways)
{ {
String topic = String(mqttDeviceTopic) + "/heat_index"; publishMqtt("heat_index", String(heatIndex, TemperatureDecimals).c_str());
mqtt->publish(topic.c_str(), 0, false, String(heatIndex, TemperatureDecimals).c_str());
} }
if (dewPoint != lastDewPoint || PublishAlways) if (dewPoint != lastDewPoint || PublishAlways)
{ {
String topic = String(mqttDeviceTopic) + "/dew_point"; publishMqtt("dew_point", String(dewPoint, TemperatureDecimals).c_str());
mqtt->publish(topic.c_str(), 0, false, String(dewPoint, TemperatureDecimals).c_str());
} }
lastHumidity = humidity; lastHumidity = humidity;
@ -197,20 +267,190 @@ public:
} }
} }
if (timer - lastPressureMeasure >= PressureInterval * 1000 || mqttPressurePub == 0) if (timer - lastPressureMeasure >= PressureInterval * 1000)
{ {
lastPressureMeasure = timer; lastPressureMeasure = timer;
float pressure = roundf(sensorPressure * pow(10, PressureDecimals)) / pow(10, PressureDecimals); float pressure = roundf(sensorPressure * powf(10, PressureDecimals)) / powf(10, PressureDecimals);
if (pressure != lastPressure || PublishAlways) if (pressure != lastPressure || PublishAlways)
{ {
String topic = String(mqttDeviceTopic) + "/pressure"; publishMqtt("pressure", String(pressure, PressureDecimals).c_str());
mqttPressurePub = mqtt->publish(topic.c_str(), 0, true, String(pressure, PressureDecimals).c_str());
} }
lastPressure = pressure; lastPressure = pressure;
} }
} }
} }
void onMqttConnect(bool sessionPresent)
{
if (WLED_MQTT_CONNECTED && !mqttInitialized)
{
_mqttInitialize();
mqttInitialized = true;
}
}
/*
* API calls te enable data exchange between WLED modules
*/
inline float getTemperatureC() {
if (UseCelsius) {
return (float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
} else {
return (float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) * 1.8f + 32;
}
}
inline float getTemperatureF() {
if (UseCelsius) {
return ((float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) -32) * 0.56f;
} else {
return (float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
}
}
inline float getHumidity() {
return (float)roundf(sensorHumidity * powf(10, HumidityDecimals));
}
inline float getPressure() {
return (float)roundf(sensorPressure * powf(10, PressureDecimals));
}
inline float getDewPointC() {
if (UseCelsius) {
return (float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
} else {
return (float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) * 1.8f + 32;
}
}
inline float getDewPointF() {
if (UseCelsius) {
return ((float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) -32) * 0.56f;
} else {
return (float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
}
}
inline float getHeatIndexC() {
if (UseCelsius) {
return (float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
} else {
return (float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) * 1.8f + 32;
}
}
inline float getHeatIndexF() {
if (UseCelsius) {
return ((float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) -32) * 0.56f;
} else {
return (float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals);
}
}
// Publish Sensor Information to Info Page
void addToJsonInfo(JsonObject &root)
{
JsonObject user = root[F("u")];
if (user.isNull()) user = root.createNestedObject(F("u"));
if (sensorType==0) //No Sensor
{
// if we sensor not detected, let the user know
JsonArray temperature_json = user.createNestedArray(F("BME/BMP280 Sensor"));
temperature_json.add(F("Not Found"));
}
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(tempScale);
pressure_json.add(roundf(sensorPressure * powf(10, PressureDecimals)));
pressure_json.add(F("hPa"));
}
else if (sensorType==1) //BME280
{
JsonArray temperature_json = user.createNestedArray(F("Temperature"));
JsonArray humidity_json = user.createNestedArray(F("Humidity"));
JsonArray pressure_json = user.createNestedArray(F("Pressure"));
JsonArray heatindex_json = user.createNestedArray(F("Heat Index"));
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(F("%"));
pressure_json.add(roundf(sensorPressure * powf(10, PressureDecimals)));
pressure_json.add(F("hPa"));
heatindex_json.add(roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals));
heatindex_json.add(tempScale);
dewpoint_json.add(roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals));
dewpoint_json.add(tempScale);
}
return;
}
// Save Usermod Config Settings
void addToConfig(JsonObject& root)
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[FPSTR(_enabled)] = enabled;
top[F("TemperatureDecimals")] = TemperatureDecimals;
top[F("HumidityDecimals")] = HumidityDecimals;
top[F("PressureDecimals")] = PressureDecimals;
top[F("TemperatureInterval")] = TemperatureInterval;
top[F("PressureInterval")] = PressureInterval;
top[F("PublishAlways")] = PublishAlways;
top[F("UseCelsius")] = UseCelsius;
top[F("HomeAssistantDiscovery")] = HomeAssistantDiscovery;
DEBUG_PRINTLN(F("BME280 config saved."));
}
// Read Usermod Config Settings
bool readFromConfig(JsonObject& root)
{
// 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)];
if (top.isNull()) {
DEBUG_PRINT(F(_name));
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
bool configComplete = !top.isNull();
configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled);
// A 3-argument getJsonValue() assigns the 3rd argument as a default value if the Json value is missing
configComplete &= getJsonValue(top[F("TemperatureDecimals")], TemperatureDecimals, 1);
configComplete &= getJsonValue(top[F("HumidityDecimals")], HumidityDecimals, 0);
configComplete &= getJsonValue(top[F("PressureDecimals")], PressureDecimals, 0);
configComplete &= getJsonValue(top[F("TemperatureInterval")], TemperatureInterval, 30);
configComplete &= getJsonValue(top[F("PressureInterval")], PressureInterval, 30);
configComplete &= getJsonValue(top[F("PublishAlways")], PublishAlways, false);
configComplete &= getJsonValue(top[F("UseCelsius")], UseCelsius, true);
configComplete &= getJsonValue(top[F("HomeAssistantDiscovery")], HomeAssistantDiscovery, false);
DEBUG_PRINT(FPSTR(_name));
if (!initDone) {
// first run: reading from cfg.json
DEBUG_PRINTLN(F(" config loaded."));
} else {
DEBUG_PRINTLN(F(" config (re)loaded."));
// changing parameters from settings page
}
return configComplete;
}
uint16_t getId() {
return USERMOD_ID_BME280;
}
}; };
const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280";
const char UsermodBME280::_enabled[] PROGMEM = "enabled";

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,81 @@
// 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
#ifndef USERMOD_BATTERY_MEASUREMENT_PIN
#ifdef ARDUINO_ARCH_ESP32
#define USERMOD_BATTERY_MEASUREMENT_PIN 35
#else //ESP8266 boards
#define USERMOD_BATTERY_MEASUREMENT_PIN A0
#endif
#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
#endif
//the default ratio for the voltage divider
#ifndef USERMOD_BATTERY_VOLTAGE_MULTIPLIER
#ifdef ARDUINO_ARCH_ESP32
#define USERMOD_BATTERY_VOLTAGE_MULTIPLIER 2.0f
#else //ESP8266 boards
#define USERMOD_BATTERY_VOLTAGE_MULTIPLIER 4.2f
#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
#endif
// offset or calibration value to fine tune the calculated voltage
#ifndef USERMOD_BATTERY_CALIBRATION
#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
#endif
#ifndef USERMOD_BATTERY_AUTO_OFF_THRESHOLD
#define USERMOD_BATTERY_AUTO_OFF_THRESHOLD 10
#endif
// low power indication feature
#ifndef USERMOD_BATTERY_LOW_POWER_INDICATOR_ENABLED
#define USERMOD_BATTERY_LOW_POWER_INDICATOR_ENABLED true
#endif
#ifndef USERMOD_BATTERY_LOW_POWER_INDICATOR_PRESET
#define USERMOD_BATTERY_LOW_POWER_INDICATOR_PRESET 0
#endif
#ifndef USERMOD_BATTERY_LOW_POWER_INDICATOR_THRESHOLD
#define USERMOD_BATTERY_LOW_POWER_INDICATOR_THRESHOLD 20
#endif
#ifndef USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION
#define USERMOD_BATTERY_LOW_POWER_INDICATOR_DURATION 5
#endif

112
usermods/Battery/readme.md Normal file
View File

@ -0,0 +1,112 @@
<p align="center">
<img width="700" src="assets/battery_usermod_logo.png">
</p>
# Welcome to the battery usermod! 🔋
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>
## ⚙️ Features
- 💯 Displays current battery voltage
- 🚥 Displays battery level
- 🚫 Auto-off with configurable Threshold
- 🚨 Low power indicator with many configuration posibilities
## 🎈 Installation
define `USERMOD_BATTERY` in `wled00/my_config.h`
### Example wiring
<p align="center">
<img width="300" src="assets/battery_connection_schematic_01.png">
</p>
### 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 parralel sumed up |
| `USERMOD_BATTERY_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 |
| 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 |
All parameters can be configured at runtime via the Usermods settings page.
## ⚠️ Important
- Make sure you know your battery specifications! All batteries are **NOT** the same!
- Example:
| Your battery specification table | | Options you can define |
| :-------------------------------- |:--------------- | :---------------------------- |
| Capacity | 3500mAh 12,5 Wh | |
| Minimum capacity | 3350mAh 11,9 Wh | |
| 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` |
| 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)
## 🌐 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/
## 📝 Change Log
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
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)
2021-09-02
- 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
- Updated readme, added specification table
2021-08-10
- Created

View File

@ -0,0 +1,787 @@
#pragma once
#include "wled.h"
#include "battery_defaults.h"
/*
* Usermod by Maximilian Mewes
* Mail: mewes.maximilian@gmx.de
* GitHub: itCarl
* Date: 25.12.2022
* If you have any questions, please feel free to contact me.
*/
class UsermodBattery : public Usermod
{
private:
// battery pin can be defined in my_config.h
int8_t batteryPin = USERMOD_BATTERY_MEASUREMENT_PIN;
// 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;
// auto shutdown/shutoff/master off feature
bool autoOffEnabled = USERMOD_BATTERY_AUTO_OFF_ENABLED;
int8_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;
bool lowPowerIndicationDone = false;
unsigned long lowPowerActivationTime = 0; // used temporary during active time
int8_t lastPreset = 0;
bool initDone = false;
bool initializing = true;
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _readInterval[];
static const char _enabled[];
static const char _threshold[];
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;
}
float dot2round(float x)
{
float nx = (int)(x * 100 + .5);
return (float)(nx / 100);
}
/*
* Turn off all leds
*/
void turnOff()
{
bri = 0;
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) return;
if (lowPowerActivationTime <= 1) {
lowPowerActivationTime = millis();
lastPreset = currentPreset;
applyPreset(lowPowerIndicatorPreset);
}
if (lowPowerActivationTime+(lowPowerIndicatorDuration*1000) <= millis()) {
lowPowerIndicationDone = true;
lowPowerActivationTime = 0;
applyPreset(lastPreset);
}
}
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;
#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;
#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()
{
#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)) {
DEBUG_PRINTLN(F("Battery pin allocation succeeded."));
success = true;
voltage = readVoltage();
}
if (!success) {
DEBUG_PRINTLN(F("Battery pin allocation failed."));
batteryPin = -1; // allocation failed
} else {
pinMode(batteryPin, INPUT);
}
#else //ESP8266 boards have only one analog input pin A0
pinMode(batteryPin, INPUT);
voltage = readVoltage();
#endif
nextReadTime = millis() + readingInterval;
lastReadTime = millis();
initDone = true;
}
/*
* connected() is called every time the WiFi is (re)connected
* Use it to initialize network interfaces
*/
void connected()
{
//Serial.println("Connected to WiFi!");
}
/*
* loop() is called continuously. Here you can check for events, read sensors, etc.
*
*/
void loop()
{
if(strip.isUpdating()) return;
lowPowerIndicator();
// check the battery level every USERMOD_BATTERY_MEASUREMENT_INTERVAL (ms)
if (millis() < nextReadTime) return;
nextReadTime = millis() + readingInterval;
lastReadTime = millis();
if (batteryPin < 0) return; // nothing to read
initializing = false;
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;
// 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;
// }
// Auto off -- Master power off
if (autoOffEnabled && (autoOffThreshold >= batteryLevel))
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());
}
#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
*/
void addToJsonInfo(JsonObject& root)
{
JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u");
if (batteryPin < 0) {
JsonArray infoVoltage = user.createNestedArray(F("Battery voltage"));
infoVoltage.add(F("n/a"));
infoVoltage.add(F(" invalid GPIO"));
return; // no GPIO - nothing to report
}
// 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);
infoNextUpdate.add(F(" sec"));
if (initializing) {
infoPercentage.add(FPSTR(_init));
infoVoltage.add(FPSTR(_init));
return;
}
if (batteryLevel < 0) {
infoPercentage.add(F("invalid"));
} else {
infoPercentage.add(batteryLevel);
}
infoPercentage.add(F(" %"));
if (voltage < 0) {
infoVoltage.add(F("invalid"));
} else {
infoVoltage.add(dot2round(voltage));
}
infoVoltage.add(F(" V"));
}
/*
* 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)
{
}
*/
/*
* 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)
{
}
*/
/*
* addToConfig() can be used to add custom persistent settings to the cfg.json file in the "um" (usermod) object.
* It will be called by WLED when settings are actually saved (for example, LED settings are saved)
* If you want to force saving the current state, use serializeConfig() in your loop().
*
* CAUTION: serializeConfig() will initiate a filesystem write operation.
* It might cause the LEDs to stutter and will cause flash wear if called too often.
* Use it sparingly and always in the loop, never in network callbacks!
*
* addToConfig() will make your settings editable through the Usermod Settings page automatically.
*
* Usermod Settings Overview:
* - Numeric values are treated as floats in the browser.
* - If the numeric value entered into the browser contains a decimal point, it will be parsed as a C float
* before being returned to the Usermod. The float data type has only 6-7 decimal digits of precision, and
* doubles are not supported, numbers will be rounded to the nearest float value when being parsed.
* The range accepted by the input field is +/- 1.175494351e-38 to +/- 3.402823466e+38.
* - If the numeric value entered into the browser doesn't contain a decimal point, it will be parsed as a
* C int32_t (range: -2147483648 to 2147483647) before being returned to the usermod.
* Overflows or underflows are truncated to the max/min value for an int32_t, and again truncated to the type
* used in the Usermod when reading the value from ArduinoJson.
* - Pin values can be treated differently from an integer value by using the key name "pin"
* - "pin" can contain a single or array of integer values
* - On the Usermod Settings page there is simple checking for pin conflicts and warnings for special pins
* - Red color indicates a conflict. Yellow color indicates a pin with a warning (e.g. an input-only pin)
* - Tip: use int8_t to store the pin value in the Usermod, so a -1 value (pin not set) can be used
*
* See usermod_v2_auto_save.h for an example that saves Flash space by reusing ArduinoJson key name strings
*
* If you need a dedicated settings page with custom layout for your Usermod, that takes a lot more work.
* You will have to add the setting to the HTML, xml.cpp and set.cpp manually.
* See the WLED Soundreactive fork (code and wiki) for reference. https://github.com/atuline/WLED
*
* I highly recommend checking out the basics of ArduinoJson serialization and deserialization in order to use custom settings!
*/
void addToConfig(JsonObject& root)
{
JsonObject battery = root.createNestedObject(FPSTR(_name)); // usermodname
#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;
// read voltage in case calibration or voltage multiplier changed to see immediate effect
voltage = 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');"));
// 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);"));
// for(int8_t i=1; i < 42; i++) {
// oappend(SET_F("addOption(bd, 'Preset#"));
// oappendi(i);
// oappend(SET_F("',"));
// oappendi(i);
// oappend(SET_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)
*
* readFromConfig() is called BEFORE setup(). This means you can use your persistent values in setup() (e.g. pin assignments, buffer sizes),
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
*
* Return true in case the config values returned from Usermod Settings were complete, or false if you'd like WLED to save your defaults to disk (so any missing values are editable in Usermod Settings)
*
* getJsonValue() returns false if the value is missing, or copies the value into the variable provided and returns true if the value is present
* The configComplete variable is true only if the "exampleUsermod" object and all values are present. If any values are missing, WLED will know to call addToConfig() to save them
*
* This function is guaranteed to be called on boot, but could also be called every time settings are updated
*/
bool readFromConfig(JsonObject& root)
{
#ifdef ARDUINO_ARCH_ESP32
int8_t newBatteryPin = batteryPin;
#endif
JsonObject battery = root[FPSTR(_name)];
if (battery.isNull())
{
DEBUG_PRINT(FPSTR(_name));
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
#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);
setReadingInterval(battery[FPSTR(_readInterval)] | readingInterval);
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));
#ifdef ARDUINO_ARCH_ESP32
if (!initDone)
{
// first run: reading from cfg.json
batteryPin = newBatteryPin;
DEBUG_PRINTLN(F(" config loaded."));
}
else
{
DEBUG_PRINTLN(F(" config (re)loaded."));
// changing parameters from settings page
if (newBatteryPin != batteryPin)
{
// deallocate pin
pinManager.deallocatePin(batteryPin, PinOwner::UM_Battery);
batteryPin = newBatteryPin;
// initialise
setup();
}
}
#endif
return !battery[FPSTR(_readInterval)].isNull();
}
/*
* Generate a preset sample for low power indication
*/
void generateExamplePreset()
{
// 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;
// JsonArray col0 = seg0.createNestedArray("col");
// JsonArray col00 = col0.createNestedArray();
// col00.add(255);
// col00.add(0);
// col00.add(0);
// seg0["fx"] = 1;
// seg0["sx"] = 128;
// seg0["ix"] = 128;
// savePreset(199, "Low power Indicator", preset);
}
/*
*
* Getter and Setter. Just in case some other usermod wants to interact with this in the future
*
*/
/*
* 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.
*/
uint16_t getId()
{
return USERMOD_ID_BATTERY;
}
unsigned long getReadingInterval()
{
return readingInterval;
}
/*
* minimum repetition is 3000ms (3s)
*/
void setReadingInterval(unsigned long newReadingInterval)
{
readingInterval = max((unsigned long)3000, newReadingInterval);
}
/*
* Get lowest configured battery voltage
*/
float getMinBatteryVoltage()
{
return minBatteryVoltage;
}
/*
* Set lowest battery voltage
* can't be below 0 volt
*/
void setMinBatteryVoltage(float voltage)
{
minBatteryVoltage = max(0.0f, voltage);
}
/*
* Get highest configured battery voltage
*/
float getMaxBatteryVoltage()
{
return maxBatteryVoltage;
}
/*
* 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
}
/*
* 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;
}
/*
* 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;
}
/*
* Get the configured calibration value
* a offset value to fine-tune the calculated voltage.
*/
float getCalibration()
{
return calibration;
}
/*
* Set the voltage calibration offset value
* a offset value to fine-tune the calculated voltage.
*/
void setCalibration(float offset)
{
calibration = offset;
}
/*
* Set the voltage multiplier value
* A multiplier that may need adjusting for different voltage divider setups
*/
void setVoltageMultiplier(float multiplier)
{
voltageMultiplier = multiplier;
}
/*
* Get the voltage multiplier value
* A multiplier that may need adjusting for different voltage divider setups
*/
float getVoltageMultiplier()
{
return voltageMultiplier;
}
/*
* Get auto-off feature enabled status
* is auto-off enabled, true/false
*/
bool getAutoOffEnabled()
{
return autoOffEnabled;
}
/*
* Set auto-off feature status
*/
void setAutoOffEnabled(bool enabled)
{
autoOffEnabled = enabled;
}
/*
* Get auto-off threshold in percent (0-100)
*/
int8_t getAutoOffThreshold()
{
return autoOffThreshold;
}
/*
* Set auto-off threshold in percent (0-100)
*/
void setAutoOffThreshold(int8_t threshold)
{
autoOffThreshold = min((int8_t)100, max((int8_t)0, threshold));
// when low power indicator is enabled the auto-off threshold cannot be above indicator threshold
autoOffThreshold = lowPowerIndicatorEnabled /*&& autoOffEnabled*/ ? min(lowPowerIndicatorThreshold-1, (int)autoOffThreshold) : autoOffThreshold;
}
/*
* Get low-power-indicator feature enabled status
* is the low-power-indicator enabled, true/false
*/
bool getLowPowerIndicatorEnabled()
{
return lowPowerIndicatorEnabled;
}
/*
* Set low-power-indicator feature status
*/
void setLowPowerIndicatorEnabled(bool enabled)
{
lowPowerIndicatorEnabled = enabled;
}
/*
* Get low-power-indicator preset to activate when low power is detected
*/
int8_t getLowPowerIndicatorPreset()
{
return lowPowerIndicatorPreset;
}
/*
* Set low-power-indicator preset to activate when low power is detected
*/
void setLowPowerIndicatorPreset(int8_t presetId)
{
// String tmp = ""; For what ever reason this doesn't work :(
// lowPowerIndicatorPreset = getPresetName(presetId, tmp) ? presetId : lowPowerIndicatorPreset;
lowPowerIndicatorPreset = presetId;
}
/*
* Get low-power-indicator threshold in percent (0-100)
*/
int8_t getLowPowerIndicatorThreshold()
{
return lowPowerIndicatorThreshold;
}
/*
* Set low-power-indicator threshold in percent (0-100)
*/
void setLowPowerIndicatorThreshold(int8_t threshold)
{
lowPowerIndicatorThreshold = threshold;
// when auto-off is enabled the indicator threshold cannot be below auto-off threshold
lowPowerIndicatorThreshold = autoOffEnabled /*&& lowPowerIndicatorEnabled*/ ? max(autoOffThreshold+1, (int)lowPowerIndicatorThreshold) : max(5, (int)lowPowerIndicatorThreshold);
}
/*
* Get low-power-indicator duration in seconds
*/
int8_t getLowPowerIndicatorDuration()
{
return lowPowerIndicatorDuration;
}
/*
* Set low-power-indicator duration in seconds
*/
void setLowPowerIndicatorDuration(int8_t duration)
{
lowPowerIndicatorDuration = duration;
}
/*
* Get low-power-indicator status when the indication is done thsi returns true
*/
bool getLowPowerIndicatorDone()
{
return lowPowerIndicationDone;
}
};
// strings to reduce flash memory usage (used more than twice)
const char UsermodBattery::_name[] PROGMEM = "Battery";
const char UsermodBattery::_readInterval[] PROGMEM = "interval";
const char UsermodBattery::_enabled[] PROGMEM = "enabled";
const char UsermodBattery::_threshold[] PROGMEM = "threshold";
const char UsermodBattery::_preset[] PROGMEM = "preset";
const char UsermodBattery::_duration[] PROGMEM = "duration";
const char UsermodBattery::_init[] PROGMEM = "init";

View File

@ -0,0 +1,8 @@
# Cronixie clock usermod
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.
Make sure the Auto Brightness Limiter is enabled at 420mA (!) and configure 60 WS281x LEDs.

View File

@ -0,0 +1,302 @@
#pragma once
#include "wled.h"
class UsermodCronixie : public Usermod {
private:
unsigned long lastTime = 0;
char cronixieDisplay[7] = "HHMMSS";
byte _digitOut[6] = {10,10,10,10,10,10};
byte dP[6] = {255, 255, 255, 255, 255, 255};
// set your config variables to their boot default value (this can also be done in readFromConfig() or a constructor if you prefer)
bool backlight = true;
public:
void initCronixie()
{
if (dP[0] == 255) // if dP[0] is 255, cronixie is not yet init'ed
{
setCronixie();
strip.getSegment(0).grouping = 10; // 10 LEDs per digit
}
}
void setup() {
}
void loop() {
if (!toki.isTick()) return;
initCronixie();
_overlayCronixie();
strip.trigger();
}
byte getSameCodeLength(char code, int index, char const cronixieDisplay[])
{
byte counter = 0;
for (int i = index+1; i < 6; i++)
{
if (cronixieDisplay[i] == code)
{
counter++;
} else {
return counter;
}
}
return counter;
}
void setCronixie()
{
/*
* digit purpose index
* 0-9 | 0-9 (incl. random)
* 10 | blank
* 11 | blank, bg off
* 12 | test upw.
* 13 | test dnw.
* 14 | binary AM/PM
* 15 | BB upper +50 for no trailing 0
* 16 | BBB
* 17 | BBBB
* 18 | BBBBB
* 19 | BBBBBB
* 20 | H
* 21 | HH
* 22 | HHH
* 23 | HHHH
* 24 | M
* 25 | MM
* 26 | MMM
* 27 | MMMM
* 28 | MMMMM
* 29 | MMMMMM
* 30 | S
* 31 | SS
* 32 | SSS
* 33 | SSSS
* 34 | SSSSS
* 35 | SSSSSS
* 36 | Y
* 37 | YY
* 38 | YYYY
* 39 | I
* 40 | II
* 41 | W
* 42 | WW
* 43 | D
* 44 | DD
* 45 | DDD
* 46 | V
* 47 | VV
* 48 | VVV
* 49 | VVVV
* 50 | VVVVV
* 51 | VVVVVV
* 52 | v
* 53 | vv
* 54 | vvv
* 55 | vvvv
* 56 | vvvvv
* 57 | vvvvvv
*/
//H HourLower | HH - Hour 24. | AH - Hour 12. | HHH Hour of Month | HHHH Hour of Year
//M MinuteUpper | MM Minute of Hour | MMM Minute of 12h | MMMM Minute of Day | MMMMM Minute of Month | MMMMMM Minute of Year
//S SecondUpper | SS Second of Minute | SSS Second of 10 Minute | SSSS Second of Hour | SSSSS Second of Day | SSSSSS Second of Week
//B AM/PM | BB 0-6/6-12/12-18/18-24 | BBB 0-3... | BBBB 0-1.5... | BBBBB 0-1 | BBBBBB 0-0.5
//Y YearLower | YY - Year LU | YYYY - Std.
//I MonthLower | II - Month of Year
//W Week of Month | WW Week of Year
//D Day of Week | DD Day Of Month | DDD Day Of Year
DEBUG_PRINT("cset ");
DEBUG_PRINTLN(cronixieDisplay);
for (int i = 0; i < 6; i++)
{
dP[i] = 10;
switch (cronixieDisplay[i])
{
case '_': dP[i] = 10; break;
case '-': dP[i] = 11; break;
case 'r': dP[i] = random(1,7); break; //random btw. 1-6
case 'R': dP[i] = random(0,10); break; //random btw. 0-9
//case 't': break; //Test upw.
//case 'T': break; //Test dnw.
case 'b': dP[i] = 14 + getSameCodeLength('b',i,cronixieDisplay); i = i+dP[i]-14; break;
case 'B': dP[i] = 14 + getSameCodeLength('B',i,cronixieDisplay); i = i+dP[i]-14; break;
case 'h': dP[i] = 70 + getSameCodeLength('h',i,cronixieDisplay); i = i+dP[i]-70; break;
case 'H': dP[i] = 20 + getSameCodeLength('H',i,cronixieDisplay); i = i+dP[i]-20; break;
case 'A': dP[i] = 108; i++; break;
case 'a': dP[i] = 58; i++; break;
case 'm': dP[i] = 74 + getSameCodeLength('m',i,cronixieDisplay); i = i+dP[i]-74; break;
case 'M': dP[i] = 24 + getSameCodeLength('M',i,cronixieDisplay); i = i+dP[i]-24; break;
case 's': dP[i] = 80 + getSameCodeLength('s',i,cronixieDisplay); i = i+dP[i]-80; break; //refresh more often bc. of secs
case 'S': dP[i] = 30 + getSameCodeLength('S',i,cronixieDisplay); i = i+dP[i]-30; break;
case 'Y': dP[i] = 36 + getSameCodeLength('Y',i,cronixieDisplay); i = i+dP[i]-36; break;
case 'y': dP[i] = 86 + getSameCodeLength('y',i,cronixieDisplay); i = i+dP[i]-86; break;
case 'I': dP[i] = 39 + getSameCodeLength('I',i,cronixieDisplay); i = i+dP[i]-39; break; //Month. Don't ask me why month and minute both start with M.
case 'i': dP[i] = 89 + getSameCodeLength('i',i,cronixieDisplay); i = i+dP[i]-89; break;
//case 'W': break;
//case 'w': break;
case 'D': dP[i] = 43 + getSameCodeLength('D',i,cronixieDisplay); i = i+dP[i]-43; break;
case 'd': dP[i] = 93 + getSameCodeLength('d',i,cronixieDisplay); i = i+dP[i]-93; break;
case '0': dP[i] = 0; break;
case '1': dP[i] = 1; break;
case '2': dP[i] = 2; break;
case '3': dP[i] = 3; break;
case '4': dP[i] = 4; break;
case '5': dP[i] = 5; break;
case '6': dP[i] = 6; break;
case '7': dP[i] = 7; break;
case '8': dP[i] = 8; break;
case '9': dP[i] = 9; break;
//case 'V': break; //user var0
//case 'v': break; //user var1
}
}
DEBUG_PRINT("result ");
for (int i = 0; i < 5; i++)
{
DEBUG_PRINT((int)dP[i]);
DEBUG_PRINT(" ");
}
DEBUG_PRINTLN((int)dP[5]);
_overlayCronixie(); // refresh
}
void _overlayCronixie()
{
byte h = hour(localTime);
byte h0 = h;
byte m = minute(localTime);
byte s = second(localTime);
byte d = day(localTime);
byte mi = month(localTime);
int y = year(localTime);
//this has to be changed in time for 22nd century
y -= 2000; if (y<0) y += 30; //makes countdown work
if (useAMPM && !countdownMode)
{
if (h>12) h-=12;
else if (h==0) h+=12;
}
for (int i = 0; i < 6; i++)
{
if (dP[i] < 12) _digitOut[i] = dP[i];
else {
if (dP[i] < 65)
{
switch(dP[i])
{
case 21: _digitOut[i] = h/10; _digitOut[i+1] = h- _digitOut[i]*10; i++; break; //HH
case 25: _digitOut[i] = m/10; _digitOut[i+1] = m- _digitOut[i]*10; i++; break; //MM
case 31: _digitOut[i] = s/10; _digitOut[i+1] = s- _digitOut[i]*10; i++; break; //SS
case 20: _digitOut[i] = h- (h/10)*10; break; //H
case 24: _digitOut[i] = m/10; break; //M
case 30: _digitOut[i] = s/10; break; //S
case 43: _digitOut[i] = weekday(localTime); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //D
case 44: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; i++; break; //DD
case 40: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; i++; break; //II
case 37: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //YY
case 39: _digitOut[i] = 2; _digitOut[i+1] = 0; _digitOut[i+2] = y/10; _digitOut[i+3] = y- _digitOut[i+2]*10; i+=3; break; //YYYY
//case 16: _digitOut[i+2] = ((h0/3)&1)?1:0; i++; //BBB (BBBB NI)
//case 15: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:0; i++; //BB
case 14: _digitOut[i] = (h0>11)?1:0; break; //B
}
} else
{
switch(dP[i])
{
case 71: _digitOut[i] = h/10; _digitOut[i+1] = h- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //hh
case 75: _digitOut[i] = m/10; _digitOut[i+1] = m- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //mm
case 81: _digitOut[i] = s/10; _digitOut[i+1] = s- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ss
//case 66: _digitOut[i+2] = ((h0/3)&1)?1:10; i++; //bbb (bbbb NI)
//case 65: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:10; i++; //bb
case 64: _digitOut[i] = (h0>11)?1:10; break; //b
case 93: _digitOut[i] = weekday(localTime); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //d
case 94: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //dd
case 90: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ii
case 87: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //yy
case 89: _digitOut[i] = 2; _digitOut[i+1] = 0; _digitOut[i+2] = y/10; _digitOut[i+3] = y- _digitOut[i+2]*10; i+=3; break; //yyyy
}
}
}
}
}
void handleOverlayDraw()
{
byte offsets[] = {5, 0, 6, 1, 7, 2, 8, 3, 9, 4};
for (uint16_t i = 0; i < 6; i++)
{
byte o = 10*i;
byte excl = 10;
if(_digitOut[i] < 10) excl = offsets[_digitOut[i]];
excl += o;
if (backlight && _digitOut[i] <11)
{
uint32_t col = gamma32(strip.getSegment(0).colors[1]);
for (uint16_t j=o; j< o+10; j++) {
if (j != excl) strip.setPixelColor(j, col);
}
} else
{
for (uint16_t j=o; j< o+10; j++) {
if (j != excl) strip.setPixelColor(j, 0);
}
}
}
}
void addToJsonState(JsonObject& root)
{
root["nx"] = cronixieDisplay;
}
void readFromJsonState(JsonObject& root)
{
if (root["nx"].is<const char*>()) {
strncpy(cronixieDisplay, root["nx"], 6);
setCronixie();
}
}
void addToConfig(JsonObject& root)
{
JsonObject top = root.createNestedObject(F("Cronixie"));
top["backlight"] = backlight;
}
bool readFromConfig(JsonObject& root)
{
// 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[F("Cronixie")];
bool configComplete = !top.isNull();
configComplete &= getJsonValue(top["backlight"], backlight);
return configComplete;
}
uint16_t getId()
{
return USERMOD_ID_CRONIXIE;
}
};

View File

@ -6,12 +6,13 @@
; USERMOD_DHT_CELSIUS - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported ; USERMOD_DHT_CELSIUS - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported
; USERMOD_DHT_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds ; USERMOD_DHT_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds
; USERMOD_DHT_FIRST_MEASUREMENT_AT - the number of milliseconds after boot to take first measurement, defaults to 90 seconds ; USERMOD_DHT_FIRST_MEASUREMENT_AT - the number of milliseconds after boot to take first measurement, defaults to 90 seconds
; USERMOD_DHT_MQTT - publish measurements to the MQTT broker
; USERMOD_DHT_STATS - For debug, report delay stats ; USERMOD_DHT_STATS - For debug, report delay stats
[env:d1_mini_usermod_dht_C] [env:d1_mini_usermod_dht_C]
extends = env:d1_mini extends = env:d1_mini
build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS
lib_deps = ${env.lib_deps} lib_deps = ${env:d1_mini.lib_deps}
https://github.com/alwynallan/DHT_nonblocking https://github.com/alwynallan/DHT_nonblocking
[env:custom32_LEDPIN_16_usermod_dht_C] [env:custom32_LEDPIN_16_usermod_dht_C]

View File

@ -1,9 +1,13 @@
# DHT Temperature/Humidity sensor usermod # DHT Temperature/Humidity sensor usermod
This usermod will read from an attached DHT22 or DHT11 humidity and temperature sensor. This usermod will read from an attached DHT22 or DHT11 humidity and temperature sensor.
The sensor readings are displayed in the Info section of the web UI. The sensor readings are displayed in the Info section of the web UI (and optionally sent to an MQTT broker).
If sensor is not detected after a while (10 update intervals), this usermod will be disabled. If sensor is not detected after 10 update intervals, the usermod will be disabled.
If enabled, measured temperature and humidity will be published to the following MQTT topics
* `{devceTopic}/dht/temperature`
* `{devceTopic}/dht/humidity`
## Installation ## Installation
@ -11,12 +15,13 @@ Copy the example `platformio_override.ini` to the root directory. This file sho
### Define Your Options ### Define Your Options
* `USERMOD_DHT` - define this to have this user mod included wled00\usermods_list.cpp * `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_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_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 * `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees Celsius, otherwise Fahrenheit will be reported
* `USERMOD_DHT_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60 seconds * `USERMOD_DHT_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60000 ms
* `USERMOD_DHT_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 90 seconds * `USERMOD_DHT_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 90000 ms
* `USERMOD_DHT_MQTT` - publish measurements to an MQTT broker
* `USERMOD_DHT_STATS` - For debug, report delay stats * `USERMOD_DHT_STATS` - For debug, report delay stats
## Project link ## Project link
@ -29,10 +34,12 @@ If you are using `platformio_override.ini`, you should be able to refresh the ta
## Change Log ## Change Log
2022-10-15
* Add ability to publish sensor readings to an MQTT broker
* fix compilation error for sample [env:d1_mini_usermod_dht_C] task
2020-02-04 2020-02-04
* Change default QuinLed pin to Q2 * Change default QuinLed pin to Q2
* Instead of trying to keep updates at constant cadence, space readings out by measurement interval; hope this helps to avoid occasional bursts of readings with errors * Instead of trying to keep updates at constant cadence, space out readings by measurement interval. Hopefully, this helps eliminate occasional bursts of readings with errors
* Add some more (optional) stats * Add some more (optional) stats
2020-02-03 2020-02-03
* Due to poor readouts on ESP32 with previous DHT library, rewrote to use https://github.com/alwynallan/DHT_nonblocking * Due to poor readouts on ESP32 with previous DHT library, rewrote to use https://github.com/alwynallan/DHT_nonblocking

View File

@ -1,6 +1,10 @@
#pragma once #pragma once
#include "wled.h" #include "wled.h"
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include <dht_nonblocking.h> #include <dht_nonblocking.h>
@ -62,6 +66,10 @@ class UsermodDHT : public Usermod {
float humidity, temperature = 0; float humidity, temperature = 0;
bool initializing = true; bool initializing = true;
bool disabled = false; bool disabled = false;
#ifdef USERMOD_DHT_MQTT
char dhtMqttTopic[64];
size_t dhtMqttTopicLen;
#endif
#ifdef USERMOD_DHT_STATS #ifdef USERMOD_DHT_STATS
unsigned long nextResetStatsTime = 0; unsigned long nextResetStatsTime = 0;
uint16_t updates = 0; uint16_t updates = 0;
@ -76,6 +84,10 @@ class UsermodDHT : public Usermod {
void setup() { void setup() {
nextReadTime = millis() + USERMOD_DHT_FIRST_MEASUREMENT_AT; nextReadTime = millis() + USERMOD_DHT_FIRST_MEASUREMENT_AT;
lastReadTime = millis(); lastReadTime = millis();
#ifdef USERMOD_DHT_MQTT
sprintf(dhtMqttTopic, "%s/dht", mqttDeviceTopic);
dhtMqttTopicLen = strlen(dhtMqttTopic);
#endif
#ifdef USERMOD_DHT_STATS #ifdef USERMOD_DHT_STATS
nextResetStatsTime = millis() + 60*60*1000; nextResetStatsTime = millis() + 60*60*1000;
#endif #endif
@ -110,6 +122,25 @@ class UsermodDHT : public Usermod {
temperature = tempC * 9 / 5 + 32; temperature = tempC * 9 / 5 + 32;
#endif #endif
#ifdef USERMOD_DHT_MQTT
// 10^n where n is number of decimal places to display in mqtt message. Please adjust buff size together with this constant
#define FLOAT_PREC 100
if (WLED_MQTT_CONNECTED) {
char buff[10];
strcpy(dhtMqttTopic + dhtMqttTopicLen, "/temperature");
sprintf(buff, "%d.%d", (int)temperature, ((int)(temperature * FLOAT_PREC)) % FLOAT_PREC);
mqtt->publish(dhtMqttTopic, 0, false, buff);
sprintf(buff, "%d.%d", (int)humidity, ((int)(humidity * FLOAT_PREC)) % FLOAT_PREC);
strcpy(dhtMqttTopic + dhtMqttTopicLen, "/humidity");
mqtt->publish(dhtMqttTopic, 0, false, buff);
dhtMqttTopic[dhtMqttTopicLen] = '\0';
}
#undef FLOAT_PREC
#endif
nextReadTime = millis() + USERMOD_DHT_MEASUREMENT_INTERVAL; nextReadTime = millis() + USERMOD_DHT_MEASUREMENT_INTERVAL;
lastReadTime = millis(); lastReadTime = millis();
initializing = false; initializing = false;

View File

@ -1,19 +0,0 @@
# ESP32 Touch Brightness Control
Toggle On/Off with a long press (800ms)
Switch through 5 brightness levels (defined in usermod_touchbrightness.h, values 0-255) with a short (100ms) touch
## Installation
Copy 'usermod_touchbrightness.h' to the wled00 directory.
in 'usermod_list.cpp' add this:
> #include "usermod_touchbrightness.h"
above "void registerUsermods()"
and
> usermods.add(new TouchBrightnessControl());
inside the "registerUsermods()" function

View File

@ -1,89 +0,0 @@
//
// usermod_touchbrightness.h
// github.com/aircoookie/WLED
//
// Created by Justin Kühner on 14.09.2020.
// Copyright © 2020 NeariX. All rights reserved.
// https://github.com/NeariX67/
// Discord: @NeariX#4799
#pragma once
#include "wled.h"
#define threshold 40 //Increase value if touches falsely accur. Decrease value if actual touches are not recognized
#define touchPin T0 //T0 = D4 / GPIO4
//Define the 5 brightness levels
//Long press to turn off / on
#define brightness1 51
#define brightness2 102
#define brightness3 153
#define brightness4 204
#define brightness5 255
#ifdef ESP32
class TouchBrightnessControl : public Usermod {
private:
unsigned long lastTime = 0; //Interval
unsigned long lastTouch = 0; //Timestamp of last Touch
unsigned long lastRelease = 0; //Timestamp of last Touch release
boolean released = true; //current Touch state (touched/released)
uint16_t touchReading = 0; //sensor reading, maybe use uint8_t???
uint16_t touchDuration = 0; //duration of last touch
public:
void setup() {
lastTouch = millis();
lastRelease = millis();
lastTime = millis();
}
void loop() {
if (millis() - lastTime >= 50) { //Check every 50ms if a touch occurs
lastTime = millis();
touchReading = touchRead(touchPin); //Read touch sensor on pin T0 (GPIO4 / D4)
if(touchReading < threshold && released) { //Touch started
released = false;
lastTouch = millis();
}
else if(touchReading >= threshold && !released) { //Touch released
released = true;
lastRelease = millis();
touchDuration = lastRelease - lastTouch; //Calculate duration
}
//Serial.println(touchDuration);
if(touchDuration >= 800 && released) { //Toggle power if button press is longer than 800ms
touchDuration = 0; //Reset touch duration to avoid multiple actions on same touch
toggleOnOff();
colorUpdated(2); //Refresh values
}
else if(touchDuration >= 100 && released) { //Switch to next brightness if touch is between 100 and 800ms
touchDuration = 0; //Reset touch duration to avoid multiple actions on same touch
if(bri < brightness1) {
bri = brightness1;
} else if(bri >= brightness1 && bri < brightness2) {
bri = brightness2;
} else if(bri >= brightness2 && bri < brightness3) {
bri = brightness3;
} else if(bri >= brightness3 && bri < brightness4) {
bri = brightness4;
} else if(bri >= brightness4 && bri < brightness5) {
bri = brightness5;
} else if(bri >= brightness5) {
bri = brightness1;
}
colorUpdated(2); //Refresh values
}
}
}
};
#endif

View File

@ -22,8 +22,12 @@
//class name. Use something descriptive and leave the ": public Usermod" part :) //class name. Use something descriptive and leave the ": public Usermod" part :)
class MyExampleUsermod : public Usermod { class MyExampleUsermod : public Usermod {
private: private:
//Private class members. You can declare variables and functions only accessible to your usermod here
// Private class members. You can declare variables and functions only accessible to your usermod here
bool enabled = false;
bool initDone = false;
unsigned long lastTime = 0; unsigned long lastTime = 0;
// set your config variables to their boot default value (this can also be done in readFromConfig() or a constructor if you prefer) // set your config variables to their boot default value (this can also be done in readFromConfig() or a constructor if you prefer)
@ -37,15 +41,56 @@ class MyExampleUsermod : public Usermod {
long testLong; long testLong;
int8_t testPins[2]; int8_t testPins[2];
// string that are used multiple time (this will save some flash memory)
static const char _name[];
static const char _enabled[];
// any private methods should go here (non-inline methosd should be defined out of class)
void publishMqtt(const char* state, bool retain = false); // example for publishing MQTT message
public: public:
//Functions called by WLED
// non WLED related methods, may be used for data exchange between usermods (non-inline methods should be defined out of class)
/**
* Enable/Disable the usermod
*/
inline void enable(bool enable) { enabled = enable; }
/**
* Get usermod enabled/disabled state
*/
inline bool isEnabled() { return enabled; }
// in such case add the following to another usermod:
// in private vars:
// #ifdef USERMOD_EXAMPLE
// MyExampleUsermod* UM;
// #endif
// in setup()
// #ifdef USERMOD_EXAMPLE
// UM = (MyExampleUsermod*) usermods.lookup(USERMOD_ID_EXAMPLE);
// #endif
// somewhere in loop() or other member method
// #ifdef USERMOD_EXAMPLE
// if (UM != nullptr) isExampleEnabled = UM->isEnabled();
// if (!isExampleEnabled) UM->enable(true);
// #endif
// methods called by WLED (can be inlined as they are called only once but if you call them explicitly define them out of class)
/* /*
* setup() is called once at boot. WiFi is not yet connected at this point. * setup() is called once at boot. WiFi is not yet connected at this point.
* readFromConfig() is called prior to setup()
* You can use it to initialize variables, sensors or similar. * You can use it to initialize variables, sensors or similar.
*/ */
void setup() { void setup() {
// do your set-up here
//Serial.println("Hello from my usermod!"); //Serial.println("Hello from my usermod!");
initDone = true;
} }
@ -69,6 +114,11 @@ class MyExampleUsermod : public Usermod {
* Instead, use a timer check as shown here. * Instead, use a timer check as shown here.
*/ */
void loop() { 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 (!enabled || strip.isUpdating()) return;
// do your magic here
if (millis() - lastTime > 1000) { if (millis() - lastTime > 1000) {
//Serial.println("I'm alive!"); //Serial.println("I'm alive!");
lastTime = millis(); lastTime = millis();
@ -81,19 +131,25 @@ class MyExampleUsermod : public Usermod {
* Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI. * 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 * Below it is shown how this could be used for e.g. a light sensor
*/ */
/*
void addToJsonInfo(JsonObject& root) void addToJsonInfo(JsonObject& root)
{ {
int reading = 20; // if "u" object does not exist yet wee need to create it
//this code adds "u":{"Light":[20," lux"]} to the info object
JsonObject user = root["u"]; JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u"); if (user.isNull()) user = root.createNestedObject("u");
JsonArray lightArr = user.createNestedArray("Light"); //name //this code adds "u":{"ExampleUsermod":[20," lux"]} to the info object
lightArr.add(reading); //value //int reading = 20;
lightArr.add(" lux"); //unit //JsonArray lightArr = user.createNestedArray(FPSTR(_name))); //name
//lightArr.add(reading); //value
//lightArr.add(F(" lux")); //unit
// if you are implementing a sensor usermod, you may publish sensor data
//JsonObject sensor = root[F("sensor")];
//if (sensor.isNull()) sensor = root.createNestedObject(F("sensor"));
//temp = sensor.createNestedArray(F("light"));
//temp.add(reading);
//temp.add(F("lux"));
} }
*/
/* /*
@ -102,7 +158,12 @@ class MyExampleUsermod : public Usermod {
*/ */
void addToJsonState(JsonObject& root) void addToJsonState(JsonObject& root)
{ {
//root["user0"] = userVar0; if (!initDone || !enabled) return; // prevent crash on boot applyPreset()
JsonObject usermod = root[FPSTR(_name)];
if (usermod.isNull()) usermod = root.createNestedObject(FPSTR(_name));
//usermod["user0"] = userVar0;
} }
@ -112,7 +173,14 @@ class MyExampleUsermod : public Usermod {
*/ */
void readFromJsonState(JsonObject& root) void readFromJsonState(JsonObject& root)
{ {
userVar0 = root["user0"] | userVar0; //if "user0" key exists in JSON, update, else keep old value if (!initDone) return; // prevent crash on boot applyPreset()
JsonObject usermod = root[FPSTR(_name)];
if (!usermod.isNull()) {
// expect JSON usermod data in usermod name object: {"ExampleUsermod:{"user0":10}"}
userVar0 = usermod["user0"] | userVar0; //if "user0" key exists in JSON, update, else keep old value
}
// you can as well check WLED state JSON keys
//if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!")); //if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!"));
} }
@ -154,8 +222,10 @@ class MyExampleUsermod : public Usermod {
*/ */
void addToConfig(JsonObject& root) void addToConfig(JsonObject& root)
{ {
JsonObject top = root.createNestedObject("exampleUsermod"); JsonObject top = root.createNestedObject(FPSTR(_name));
top["great"] = userVar0; //save these vars persistently whenever settings are saved top[FPSTR(_enabled)] = enabled;
//save these vars persistently whenever settings are saved
top["great"] = userVar0;
top["testBool"] = testBool; top["testBool"] = testBool;
top["testInt"] = testInt; top["testInt"] = testInt;
top["testLong"] = testLong; top["testLong"] = testLong;
@ -188,7 +258,7 @@ class MyExampleUsermod : public Usermod {
// default settings values could be set here (or below using the 3-argument getJsonValue()) instead of in the class definition or constructor // 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) // 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["exampleUsermod"]; JsonObject top = root[FPSTR(_name)];
bool configComplete = !top.isNull(); bool configComplete = !top.isNull();
@ -201,6 +271,8 @@ class MyExampleUsermod : public Usermod {
// A 3-argument getJsonValue() assigns the 3rd argument as a default value if the Json value is missing // A 3-argument getJsonValue() assigns the 3rd argument as a default value if the Json value is missing
configComplete &= getJsonValue(top["testInt"], testInt, 42); configComplete &= getJsonValue(top["testInt"], testInt, 42);
configComplete &= getJsonValue(top["testLong"], testLong, -42424242); configComplete &= getJsonValue(top["testLong"], testLong, -42424242);
// "pin" fields have special handling in settings page (or some_pin as well)
configComplete &= getJsonValue(top["pin"][0], testPins[0], -1); configComplete &= getJsonValue(top["pin"][0], testPins[0], -1);
configComplete &= getJsonValue(top["pin"][1], testPins[1], -1); configComplete &= getJsonValue(top["pin"][1], testPins[1], -1);
@ -208,6 +280,97 @@ class MyExampleUsermod : public Usermod {
} }
/*
* appendConfigData() is called when user enters usermod settings page
* it may add additional metadata for certain entry fields (adding drop down is possible)
* be careful not to add too much as oappend() buffer is limited to 3k
*/
void appendConfigData()
{
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);"));
}
/*
* handleOverlayDraw() is called just before every show() (LED strip update frame) after effects have set the colors.
* Use this to blank out some LEDs or set them to a different color regardless of the set effect mode.
* Commonly used for custom clocks (Cronixie, 7 segment)
*/
void handleOverlayDraw()
{
//strip.setPixelColor(0, RGBW32(0,0,0,0)) // set the first pixel to black
}
/**
* handleButton() can be used to override default button behaviour. Returning true
* will prevent button working in a default way.
* Replicating button.cpp
*/
bool handleButton(uint8_t b) {
yield();
// ignore certain button types as they may have other consequences
if (!enabled
|| buttonType[b] == BTN_TYPE_NONE
|| buttonType[b] == BTN_TYPE_RESERVED
|| buttonType[b] == BTN_TYPE_PIR_SENSOR
|| buttonType[b] == BTN_TYPE_ANALOG
|| buttonType[b] == BTN_TYPE_ANALOG_INVERTED) {
return false;
}
bool handled = false;
// do your button handling here
return handled;
}
#ifndef WLED_DISABLE_MQTT
/**
* handling of MQTT message
* topic only contains stripped topic (part after /wled/MAC)
*/
bool onMqttMessage(char* topic, char* payload) {
// check if we received a command
//if (strlen(topic) == 8 && strncmp_P(topic, PSTR("/command"), 8) == 0) {
// String action = payload;
// if (action == "on") {
// enabled = true;
// return true;
// } else if (action == "off") {
// enabled = false;
// return true;
// } else if (action == "toggle") {
// enabled = !enabled;
// return true;
// }
//}
return false;
}
/**
* onMqttConnect() is called when MQTT connection is established
*/
void onMqttConnect(bool sessionPresent) {
// do any MQTT related initialisation here
//publishMqtt("I am alive!");
}
#endif
/**
* onStateChanged() is used to detect WLED state change
* @mode parameter is CALL_MODE_... parameter used for notifications
*/
void onStateChange(uint8_t mode) {
// do something if WLED state changed (color, brightness, effect, preset, etc)
}
/* /*
* getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!). * 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. * This could be used in the future for the system to determine whether your usermod is installed.
@ -220,3 +383,24 @@ class MyExampleUsermod : public Usermod {
//More methods can be added in the future, this example will then be extended. //More methods can be added in the future, this example will then be extended.
//Your usermod will remain compatible as it does not need to implement all methods from the Usermod base class! //Your usermod will remain compatible as it does not need to implement all methods from the Usermod base class!
}; };
// add more strings here to reduce flash memory usage
const char MyExampleUsermod::_name[] PROGMEM = "ExampleUsermod";
const char MyExampleUsermod::_enabled[] PROGMEM = "enabled";
// implementation of non-inline member methods
void MyExampleUsermod::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("/example"));
mqtt->publish(subuf, 0, retain, state);
}
#endif
}

View File

@ -12,6 +12,7 @@ class TFTs : public TFT_eSPI {
private: private:
uint8_t digits[NUM_DIGITS]; uint8_t digits[NUM_DIGITS];
// These read 16- and 32-bit types from the SD card file. // These read 16- and 32-bit types from the SD card file.
// BMP data is stored little-endian, Arduino is little-endian too. // BMP data is stored little-endian, Arduino is little-endian too.
// May need to reverse subscript order if porting elsewhere. // May need to reverse subscript order if porting elsewhere.
@ -33,7 +34,16 @@ private:
} }
uint16_t output_buffer[TFT_HEIGHT][TFT_WIDTH]; uint16_t output_buffer[TFT_HEIGHT][TFT_WIDTH];
int16_t w = 135, h = 240, x = 0, y = 0, bufferedDigit = 255;
uint16_t digitR, digitG, digitB, dimming = 255;
uint32_t digitColor = 0;
void drawBuffer() {
bool oldSwapBytes = getSwapBytes();
setSwapBytes(true);
pushImage(x, y, w, h, (uint16_t *)output_buffer);
setSwapBytes(oldSwapBytes);
}
// These BMP functions are stolen directly from the TFT_SPIFFS_BMP example in the TFT_eSPI library. // These BMP functions are stolen directly from the TFT_SPIFFS_BMP example in the TFT_eSPI library.
// Unfortunately, they aren't part of the library itself, so I had to copy them. // Unfortunately, they aren't part of the library itself, so I had to copy them.
@ -41,44 +51,69 @@ private:
//// BEGIN STOLEN CODE //// BEGIN STOLEN CODE
// Draw directly from file stored in RGB565 format // Draw directly from file stored in RGB565 format. Fastest
bool drawBin(const char *filename) { bool drawBin(const char *filename) {
fs::File bmpFS; fs::File bmpFS;
// Open requested file on SD card // Open requested file on SD card
bmpFS = WLED_FS.open(filename, "r"); bmpFS = WLED_FS.open(filename, "r");
if (!bmpFS)
{
Serial.print(F("File not found: "));
Serial.println(filename);
return(false);
}
size_t sz = bmpFS.size(); size_t sz = bmpFS.size();
if (sz <= 64800) if (sz > 64800) {
{ bmpFS.close();
bool oldSwapBytes = getSwapBytes(); return false;
setSwapBytes(true);
int16_t h = sz / (135 * 2);
//draw img that is shorter than 240pix into the center
int16_t y = (height() - h) /2;
bmpFS.read((uint8_t *) output_buffer,sz);
if (!realtimeMode || realtimeOverride) strip.service();
pushImage(0, y, 135, h, (uint16_t *)output_buffer);
setSwapBytes(oldSwapBytes);
} }
uint16_t r, g, b, dimming = 255;
int16_t row, col;
//draw img that is shorter than 240pix into the center
w = 135;
h = sz / (w * 2);
x = 0;
y = (height() - h) /2;
uint8_t lineBuffer[w * 2];
if (!realtimeMode || realtimeOverride || (realtimeMode && useMainSegmentOnly)) strip.service();
// 0,0 coordinates are top left
for (row = 0; row < h; row++) {
bmpFS.read(lineBuffer, sizeof(lineBuffer));
uint8_t PixM, PixL;
// Colors are already in 16-bit R5, G6, B5 format
for (col = 0; col < w; col++)
{
if (dimming == 255 && !digitColor) { // not needed, copy directly
output_buffer[row][col] = (lineBuffer[col*2+1] << 8) | (lineBuffer[col*2]);
} else {
// 16 BPP pixel format: R5, G6, B5 ; bin: RRRR RGGG GGGB BBBB
PixM = lineBuffer[col*2+1];
PixL = lineBuffer[col*2];
// align to 8-bit value (MSB left aligned)
r = (PixM) & 0xF8;
g = ((PixM << 5) | (PixL >> 3)) & 0xFC;
b = (PixL << 3) & 0xF8;
r *= dimming; g *= dimming; b *= dimming;
r = r >> 8; g = g >> 8; b = b >> 8;
if (digitColor) { // grayscale pixel coloring
uint8_t l = (r > g) ? ((r > b) ? r:b) : ((g > b) ? g:b);
r = g = b = l;
r *= digitR; g *= digitG; b *= digitB;
r = r >> 8; g = g >> 8; b = b >> 8;
}
output_buffer[row][col] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
}
}
}
drawBuffer();
bmpFS.close(); bmpFS.close();
return(true); return true;
} }
bool drawBmp(const char *filename) { bool drawBmp(const char *filename) {
@ -87,78 +122,175 @@ private:
// Open requested file on SD card // Open requested file on SD card
bmpFS = WLED_FS.open(filename, "r"); bmpFS = WLED_FS.open(filename, "r");
if (!bmpFS) uint32_t seekOffset, headerSize, paletteSize = 0;
{ int16_t row;
Serial.print(F("File not found: ")); uint16_t r, g, b, dimming = 255, bitDepth;
Serial.println(filename);
return(false);
}
uint32_t seekOffset;
int16_t w, h, row;
uint8_t r, g, b;
uint16_t magic = read16(bmpFS); uint16_t magic = read16(bmpFS);
if (magic == 0xFFFF) { if (magic != ('B' | ('M' << 8))) { // File not found or not a BMP
Serial.println(F("BMP not found!")); Serial.println(F("BMP not found!"));
bmpFS.close(); bmpFS.close();
return(false); return false;
} }
if (magic != 0x4D42) { (void) read32(bmpFS); // filesize in bytes
Serial.print(F("File not a BMP. Magic: ")); (void) read32(bmpFS); // reserved
Serial.println(magic); seekOffset = read32(bmpFS); // start of bitmap
bmpFS.close(); headerSize = read32(bmpFS); // header size
return(false); w = read32(bmpFS); // width
} h = read32(bmpFS); // height
(void) read16(bmpFS); // color planes (must be 1)
bitDepth = read16(bmpFS);
read32(bmpFS); if (read32(bmpFS) != 0 || (bitDepth != 24 && bitDepth != 1 && bitDepth != 4 && bitDepth != 8)) {
read32(bmpFS);
seekOffset = read32(bmpFS);
read32(bmpFS);
w = read32(bmpFS);
h = read32(bmpFS);
if ((read16(bmpFS) != 1) || (read16(bmpFS) != 24) || (read32(bmpFS) != 0)) {
Serial.println(F("BMP format not recognized.")); Serial.println(F("BMP format not recognized."));
bmpFS.close(); bmpFS.close();
return(false); return false;
} }
//draw img that is shorter than 240pix into the center uint32_t palette[256];
int16_t y = (height() - h) /2; if (bitDepth <= 8) // 1,4,8 bit bitmap: read color palette
{
(void) read32(bmpFS); (void) read32(bmpFS); (void) read32(bmpFS); // size, w resolution, h resolution
paletteSize = read32(bmpFS);
if (paletteSize == 0) paletteSize = 1 << bitDepth; //if 0, size is 2^bitDepth
bmpFS.seek(14 + headerSize); // start of color palette
for (uint16_t i = 0; i < paletteSize; i++) {
palette[i] = read32(bmpFS);
}
}
// draw img that is shorter than 240pix into the center
x = (width() - w) /2;
y = (height() - h) /2;
bool oldSwapBytes = getSwapBytes();
setSwapBytes(true);
bmpFS.seek(seekOffset); bmpFS.seek(seekOffset);
uint16_t padding = (4 - ((w * 3) & 3)) & 3; uint32_t lineSize = ((bitDepth * w +31) >> 5) * 4;
uint8_t lineBuffer[w * 3 + padding]; uint8_t lineBuffer[lineSize];
uint8_t serviceStrip = (!realtimeMode || realtimeOverride) ? 7 : 0; uint8_t serviceStrip = (!realtimeMode || realtimeOverride || (realtimeMode && useMainSegmentOnly)) ? 7 : 0;
// row is decremented as the BMP image is drawn bottom up // row is decremented as the BMP image is drawn bottom up
for (row = h-1; row >= 0; row--) { for (row = h-1; row >= 0; row--) {
if ((row & 0b00000111) == serviceStrip) strip.service(); //still refresh backlight to mitigate stutter every few rows if ((row & 0b00000111) == serviceStrip) strip.service(); //still refresh backlight to mitigate stutter every few rows
bmpFS.read(lineBuffer, sizeof(lineBuffer)); bmpFS.read(lineBuffer, sizeof(lineBuffer));
uint8_t* bptr = lineBuffer; uint8_t* bptr = lineBuffer;
// Convert 24 to 16 bit colours while copying to output buffer. // Convert 24 to 16 bit colors while copying to output buffer.
for (uint16_t col = 0; col < w; col++) for (uint16_t col = 0; col < w; col++)
{ {
b = *bptr++; if (bitDepth == 24) {
g = *bptr++; b = *bptr++;
r = *bptr++; g = *bptr++;
output_buffer[row][col] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); r = *bptr++;
} else {
uint32_t c = 0;
if (bitDepth == 8) {
c = palette[*bptr++];
}
else if (bitDepth == 4) {
c = palette[(*bptr >> ((col & 0x01)?0:4)) & 0x0F];
if (col & 0x01) bptr++;
}
else { // bitDepth == 1
c = palette[(*bptr >> (7 - (col & 0x07))) & 0x01];
if ((col & 0x07) == 0x07) bptr++;
}
b = c; g = c >> 8; r = c >> 16;
}
if (dimming != 255) { // only dim when needed
r *= dimming; g *= dimming; b *= dimming;
r = r >> 8; g = g >> 8; b = b >> 8;
}
if (digitColor) { // grayscale pixel coloring
uint8_t l = (r > g) ? ((r > b) ? r:b) : ((g > b) ? g:b);
r = g = b = l;
r *= digitR; g *= digitG; b *= digitB;
r = r >> 8; g = g >> 8; b = b >> 8;
}
output_buffer[row][col] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xFF) >> 3);
} }
} }
pushImage(0, y, w, h, (uint16_t *)output_buffer); drawBuffer();
setSwapBytes(oldSwapBytes);
bmpFS.close(); bmpFS.close();
return(true); return true;
} }
bool drawClk(const char *filename) {
fs::File bmpFS;
// Open requested file on SD card
bmpFS = WLED_FS.open(filename, "r");
if (!bmpFS)
{
Serial.print("File not found: ");
Serial.println(filename);
return false;
}
uint16_t r, g, b, dimming = 255, magic;
int16_t row, col;
magic = read16(bmpFS);
if (magic != 0x4B43) { // look for "CK" header
Serial.print(F("File not a CLK. Magic: "));
Serial.println(magic);
bmpFS.close();
return false;
}
w = read16(bmpFS);
h = read16(bmpFS);
x = (width() - w) / 2;
y = (height() - h) / 2;
uint8_t lineBuffer[w * 2];
if (!realtimeMode || realtimeOverride || (realtimeMode && useMainSegmentOnly)) strip.service();
// 0,0 coordinates are top left
for (row = 0; row < h; row++) {
bmpFS.read(lineBuffer, sizeof(lineBuffer));
uint8_t PixM, PixL;
// Colors are already in 16-bit R5, G6, B5 format
for (col = 0; col < w; col++)
{
if (dimming == 255 && !digitColor) { // not needed, copy directly
output_buffer[row][col+x] = (lineBuffer[col*2+1] << 8) | (lineBuffer[col*2]);
} else {
// 16 BPP pixel format: R5, G6, B5 ; bin: RRRR RGGG GGGB BBBB
PixM = lineBuffer[col*2+1];
PixL = lineBuffer[col*2];
// align to 8-bit value (MSB left aligned)
r = (PixM) & 0xF8;
g = ((PixM << 5) | (PixL >> 3)) & 0xFC;
b = (PixL << 3) & 0xF8;
r *= dimming; g *= dimming; b *= dimming;
r = r >> 8; g = g >> 8; b = b >> 8;
if (digitColor) { // grayscale pixel coloring
uint8_t l = (r > g) ? ((r > b) ? r:b) : ((g > b) ? g:b);
r = g = b = l;
r *= digitR; g *= digitG; b *= digitB;
r = r >> 8; g = g >> 8; b = b >> 8;
}
output_buffer[row][col+x] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
}
}
}
drawBuffer();
bmpFS.close();
return true;
}
public: public:
TFTs() : TFT_eSPI(), chip_select() TFTs() : TFT_eSPI(), chip_select()
{ for (uint8_t digit=0; digit < NUM_DIGITS; digit++) digits[digit] = 0; } { for (uint8_t digit=0; digit < NUM_DIGITS; digit++) digits[digit] = 0; }
@ -168,6 +300,9 @@ public:
// A digit of 0xFF means blank the screen. // A digit of 0xFF means blank the screen.
const static uint8_t blanked = 255; const static uint8_t blanked = 255;
uint8_t tubeSegment = 1;
uint8_t digitOffset = 0;
void begin() { void begin() {
pinMode(TFT_ENABLE_PIN, OUTPUT); pinMode(TFT_ENABLE_PIN, OUTPUT);
digitalWrite(TFT_ENABLE_PIN, HIGH); //enable displays on boot digitalWrite(TFT_ENABLE_PIN, HIGH); //enable displays on boot
@ -182,34 +317,60 @@ public:
void showDigit(uint8_t digit) { void showDigit(uint8_t digit) {
chip_select.setDigit(digit); chip_select.setDigit(digit);
uint8_t digitToDraw = digits[digit];
if (digitToDraw < 10) digitToDraw += digitOffset;
if (digits[digit] == blanked) { if (digitToDraw == blanked) {
fillScreen(TFT_BLACK); fillScreen(TFT_BLACK); return;
} }
else {
// Filenames are no bigger than "255.bmp\0" // if last digit was the same, skip loading from FS to buffer
char file_name[10]; if (!digitColor && digitToDraw == bufferedDigit) drawBuffer();
sprintf(file_name, "/%d.bmp", digits[digit]); digitR = R(digitColor); digitG = G(digitColor); digitB = B(digitColor);
if (WLED_FS.exists(file_name)) {
drawBmp(file_name); // Filenames are no bigger than "254.bmp\0"
} else { char file_name[10];
sprintf(file_name, "/%d.bin", digits[digit]); // Fastest, raw RGB565
drawBin(file_name); sprintf(file_name, "/%d.bin", digitToDraw);
} if (WLED_FS.exists(file_name)) {
if (drawBin(file_name)) bufferedDigit = digitToDraw;
return;
} }
// Fast, raw RGB565, see https://github.com/aly-fly/EleksTubeHAX on how to create this clk format
sprintf(file_name, "/%d.clk", digitToDraw);
if (WLED_FS.exists(file_name)) {
if (drawClk(file_name)) bufferedDigit = digitToDraw;
return;
}
// Slow, regular RGB888 or 1,4,8 bit palette BMP
sprintf(file_name, "/%d.bmp", digitToDraw);
if (drawBmp(file_name)) bufferedDigit = digitToDraw;
return;
} }
void setDigit(uint8_t digit, uint8_t value, show_t show=yes) { void setDigit(uint8_t digit, uint8_t value, show_t show=yes) {
uint8_t old_value = digits[digit]; uint8_t old_value = digits[digit];
digits[digit] = value; digits[digit] = value;
// Color in grayscale bitmaps if Segment 1 exists
// TODO If secondary and tertiary are black, color all in primary,
// else color first three from Seg 1 color slots and last three from Seg 2 color slots
Segment& seg1 = strip.getSegment(tubeSegment);
if (seg1.isActive()) {
digitColor = strip.getPixelColor(seg1.start + digit);
dimming = seg1.opacity;
} else {
digitColor = 0;
dimming = 255;
}
if (show != no && (old_value != value || show == force)) { if (show != no && (old_value != value || show == force)) {
showDigit(digit); showDigit(digit);
} }
} }
uint8_t getDigit(uint8_t digit) { return digits[digit]; } uint8_t getDigit(uint8_t digit) {return digits[digit];}
void showAllDigits() { for (uint8_t digit=0; digit < NUM_DIGITS; digit++) showDigit(digit); } void showAllDigits() {for (uint8_t digit=0; digit < NUM_DIGITS; digit++) showDigit(digit);}
// Making chip_select public so we don't have to proxy all methods, and the caller can just use it directly. // Making chip_select public so we don't have to proxy all methods, and the caller can just use it directly.
ChipSelect chip_select; ChipSelect chip_select;

View File

@ -5,16 +5,17 @@ It enables running all WLED effects on the background SK6812 lighting, while dis
Code is largely based on https://github.com/SmittyHalibut/EleksTubeHAX by Mark Smith! Code is largely based on https://github.com/SmittyHalibut/EleksTubeHAX by Mark Smith!
Supported: Supported:
- Display with custom bitmaps or raw RGB565 images (.bin) from filesystem - Display with custom bitmaps (.bmp) or raw RGB565 images (.bin) from filesystem
- Background lighting - Background lighting
- Power button - All 4 hardware buttons
- RTC (with RTC usermod) - RTC (with RTC usermod)
- Standard WLED time features (NTP, DST, timezones) - Standard WLED time features (NTP, DST, timezones)
Not supported: Not supported:
- 3 navigation buttons, on-device setup - On-device setup with buttons (WiFi setup only)
Your images must be exactly 135 pixels wide and 1-240 pixels high. Your images must be 1-135 pixels wide and 1-240 pixels high.
BMP 1, 4, 8, and 24 bits per pixel formats are supported.
## Installation ## Installation
@ -25,7 +26,20 @@ Use LED pin 12, relay pin 27 and button pin 34.
## Use of RGB565 images ## Use of RGB565 images
Binary 16-bit per pixel RGB565 format `.bin` images are now supported. This has the benefit of only using 2/3rds of the file size a `.bmp` has. Binary 16-bit per pixel RGB565 format `.bin` and `.clk` images are now supported. This has the benefit of using only 2/3rds of the file space a 24 BPP `.bmp` occupies.
The drawback is that this format cannot be handled by common image programs and that an extra conversion step is needed. The drawback is this format cannot be handled by common image programs and an extra conversion step is needed.
You can use https://lvgl.io/tools/imageconverter to convert your .bmp to a .bin file (settings `True color` and `Binary RGB565`) You can use https://lvgl.io/tools/imageconverter to convert your .bmp to a .bin file (settings `True color` and `Binary RGB565`).
Thank you to @RedNax67 for adding .bin support. Thank you to @RedNax67 for adding .bin and .clk support.
For most clockface designs, using 4 or 8 BPP BMP format will reduce file size even more:
| Bits per pixel | File size in kB (for 135x240 img) | % of 24 BPP BMP | Max unique colors
| --- | --- | --- | --- |
24 | 98 | 100% | 16M (66K)
16 (.clk) | 64.8 | 66% | 66K
8 | 33.7 | 34% | 256
4 | 16.4 | 17% | 16
1 | 4.9 | 5% | 2
Comparison 1 vs. 4 vs. 8 vs. 24 BPP. With this clockface on the actual clock, 4 bit looks good, and 8 bit is almost indistinguishable from 24 bit.
![comparison](https://user-images.githubusercontent.com/21045690/156899667-5b55ed9f-6e03-4066-b2aa-1260e9570369.png)

View File

@ -6,6 +6,13 @@
class ElekstubeIPSUsermod : public Usermod { class ElekstubeIPSUsermod : public Usermod {
private: private:
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _tubeSeg[];
static const char _digitOffset[];
char cronixieDisplay[7] = "HHMMSS";
TFTs tfts; TFTs tfts;
void updateClockDisplay(TFTs::show_t show=TFTs::yes) { void updateClockDisplay(TFTs::show_t show=TFTs::yes) {
bool set[6] = {false}; bool set[6] = {false};
@ -21,6 +28,8 @@ class ElekstubeIPSUsermod : public Usermod {
set[i] = false; //display HHMMSS time set[i] = false; //display HHMMSS time
} }
} }
uint8_t hr = hour(localTime); uint8_t hr = hour(localTime);
uint8_t hrTens = hr/10; uint8_t hrTens = hr/10;
uint8_t mi = minute(localTime); uint8_t mi = minute(localTime);
@ -37,6 +46,10 @@ class ElekstubeIPSUsermod : public Usermod {
unsigned long lastTime = 0; unsigned long lastTime = 0;
public: public:
uint8_t lastBri;
uint32_t lastCols[6];
TFTs::show_t fshow=TFTs::yes;
void setup() { void setup() {
tfts.begin(); tfts.begin();
tfts.fillScreen(TFT_BLACK); tfts.fillScreen(TFT_BLACK);
@ -47,10 +60,90 @@ class ElekstubeIPSUsermod : public Usermod {
} }
void loop() { void loop() {
if (toki.isTick()) { if (!toki.isTick()) return;
updateLocalTime(); updateLocalTime();
updateClockDisplay();
Segment& seg1 = strip.getSegment(tfts.tubeSegment);
if (seg1.isActive()) {
bool update = false;
if (seg1.opacity != lastBri) update = true;
lastBri = seg1.opacity;
for (uint8_t i = 0; i < 6; i++) {
uint32_t c = strip.getPixelColor(seg1.start + i);
if (c != lastCols[i]) update = true;
lastCols[i] = c;
}
if (update) fshow=TFTs::force;
} else if (lastCols[0] != 0) { // Segment 1 deleted
fshow=TFTs::force;
lastCols[0] = 0;
} }
updateClockDisplay(fshow);
fshow=TFTs::yes;
}
/**
* addToConfig() (called from set.cpp) stores persistent properties to cfg.json
*/
void addToConfig(JsonObject &root) {
// we add JSON object: {"EleksTubeIPS": {"tubeSegment": 1, "digitOffset": 0}}
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
top[FPSTR(_tubeSeg)] = tfts.tubeSegment;
top[FPSTR(_digitOffset)] = tfts.digitOffset;
DEBUG_PRINTLN(F("EleksTube config saved."));
}
/**
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
*
* The function should return true if configuration was successfully loaded or false if there was no configuration.
*/
bool readFromConfig(JsonObject &root) {
// we look for JSON object: {"EleksTubeIPS": {"tubeSegment": 1, "digitOffset": 0}}
DEBUG_PRINT(FPSTR(_name));
JsonObject top = root[FPSTR(_name)];
if (top.isNull()) {
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
tfts.tubeSegment = top[FPSTR(_tubeSeg)] | tfts.tubeSegment;
uint8_t digitOffsetPrev = tfts.digitOffset;
tfts.digitOffset = top[FPSTR(_digitOffset)] | tfts.digitOffset;
if (tfts.digitOffset > 240) tfts.digitOffset = 240;
if (tfts.digitOffset != digitOffsetPrev) fshow=TFTs::force;
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return !top[FPSTR(_digitOffset)].isNull();
}
/*
* 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)
{
root["nx"] = cronixieDisplay;
root[FPSTR(_digitOffset)] = tfts.digitOffset;
}
/*
* 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 (root["nx"].is<const char*>()) {
strncpy(cronixieDisplay, root["nx"], 6);
}
uint8_t digitOffsetPrev = tfts.digitOffset;
tfts.digitOffset = root[FPSTR(_digitOffset)] | tfts.digitOffset;
if (tfts.digitOffset > 240) tfts.digitOffset = 240;
if (tfts.digitOffset != digitOffsetPrev) fshow=TFTs::force;
} }
uint16_t getId() uint16_t getId()
@ -58,3 +151,8 @@ class ElekstubeIPSUsermod : public Usermod {
return USERMOD_ID_ELEKSTUBE_IPS; return USERMOD_ID_ELEKSTUBE_IPS;
} }
}; };
// strings to reduce flash memory usage (used more than twice)
const char ElekstubeIPSUsermod::_name[] PROGMEM = "EleksTubeIPS";
const char ElekstubeIPSUsermod::_tubeSeg[] PROGMEM = "tubeSegment";
const char ElekstubeIPSUsermod::_digitOffset[] PROGMEM = "digitOffset";

View File

@ -10,7 +10,7 @@ For BME280 sensor use usermod_bme280.cpp. Copy to wled00 and rename to usermod.c
## Features ## Features
- SSD1306 128x32 and 128x64 I2C OLED display - SSD1306 128x32 and 128x64 I2C OLED display
- On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect) - On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect)
- Auto display shutoff for saving display lifetime - Auto display shutoff for extending display lifetime
- Dallas temperature sensor - Dallas temperature sensor
- Reporting temperature to MQTT broker - Reporting temperature to MQTT broker
@ -39,15 +39,15 @@ default_envs = esp07
... ...
lib_deps_external = lib_deps_external =
... ...
#For use SSD1306 OLED display uncomment following #To use the SSD1306 OLED display, uncomment following
U8g2@~2.27.3 U8g2@~2.27.3
#For Dallas sensor uncomment following 2 lines #For Dallas sensor, uncomment the following 2 lines
DallasTemperature@~3.8.0 DallasTemperature@~3.8.0
OneWire@~2.3.5 OneWire@~2.3.5
... ...
``` ```
For BME280 sensor uncomment `U8g2@~2.27.3`,`BME280@~3.0.0 under` `[common]` section in `platformio.ini`: For BME280 sensor, uncomment `U8g2@~2.27.3`,`BME280@~3.0.0 under` `[common]` section in `platformio.ini`:
```ini ```ini
# platformio.ini # platformio.ini
... ...
@ -60,7 +60,7 @@ default_envs = esp07
... ...
lib_deps_external = lib_deps_external =
... ...
#For use SSD1306 OLED display uncomment following #To use the SSD1306 OLED display, uncomment following
U8g2@~2.27.3 U8g2@~2.27.3
#For BME280 sensor uncomment following #For BME280 sensor uncomment following
BME280@~3.0.0 BME280@~3.0.0

View File

@ -1,3 +1,7 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/ #include <U8x8lib.h> // from https://github.com/olikraus/u8g2/
@ -100,9 +104,9 @@ void userLoop() {
needRedraw = true; needRedraw = true;
} else if (knownBrightness != bri) { } else if (knownBrightness != bri) {
needRedraw = true; needRedraw = true;
} else if (knownMode != strip.getMode()) { } else if (knownMode != strip.getMainSegment().mode) {
needRedraw = true; needRedraw = true;
} else if (knownPalette != strip.getSegment(0).palette) { } else if (knownPalette != strip.getMainSegment().palette) {
needRedraw = true; needRedraw = true;
} }
@ -126,8 +130,8 @@ void userLoop() {
#endif #endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri; knownBrightness = bri;
knownMode = strip.getMode(); knownMode = strip.getMainSegment().mode;
knownPalette = strip.getSegment(0).palette; knownPalette = strip.getMainSegment().palette;
u8x8.clear(); u8x8.clear();
u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.setFont(u8x8_font_chroma48medium8_r);
@ -148,58 +152,14 @@ void userLoop() {
// Third row with mode name // Third row with mode name
u8x8.setCursor(2, 2); u8x8.setCursor(2, 2);
uint8_t qComma = 0; char lineBuffer[17];
bool insideQuotes = false; extractModeName(knownMode, JSON_mode_names, lineBuffer, 16);
uint8_t printedChars = 0; u8x8.print(lineBuffer);
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
// Fourth row with palette name // Fourth row with palette name
u8x8.setCursor(2, 3); u8x8.setCursor(2, 3);
qComma = 0; extractModeName(knownPalette, JSON_palette_names, lineBuffer, 16);
insideQuotes = false; u8x8.print(lineBuffer);
printedChars = 0;
// Looking for palette name in JSON.
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownPalette))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
u8x8.setFont(u8x8_font_open_iconic_embedded_1x1); u8x8.setFont(u8x8_font_open_iconic_embedded_1x1);
u8x8.drawGlyph(0, 0, 80); // wifi icon u8x8.drawGlyph(0, 0, 80); // wifi icon

View File

@ -1,3 +1,7 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/ #include <U8x8lib.h> // from https://github.com/olikraus/u8g2/
@ -143,9 +147,9 @@ void userLoop() {
needRedraw = true; needRedraw = true;
} else if (knownBrightness != bri) { } else if (knownBrightness != bri) {
needRedraw = true; needRedraw = true;
} else if (knownMode != strip.getMode()) { } else if (knownMode != strip.getMainSegment().mode) {
needRedraw = true; needRedraw = true;
} else if (knownPalette != strip.getSegment(0).palette) { } else if (knownPalette != strip.getMainSegment().palette) {
needRedraw = true; needRedraw = true;
} }
@ -169,8 +173,8 @@ void userLoop() {
#endif #endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri; knownBrightness = bri;
knownMode = strip.getMode(); knownMode = strip.getMainSegment().mode;
knownPalette = strip.getSegment(0).palette; knownPalette = strip.getMainSegment().palette;
u8x8.clear(); u8x8.clear();
u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.setFont(u8x8_font_chroma48medium8_r);
@ -191,58 +195,14 @@ void userLoop() {
// Third row with mode name // Third row with mode name
u8x8.setCursor(2, 2); u8x8.setCursor(2, 2);
uint8_t qComma = 0; char lineBuffer[17];
bool insideQuotes = false; extractModeName(knownMode, JSON_mode_names, lineBuffer, 16);
uint8_t printedChars = 0; u8x8.print(lineBuffer);
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
// Fourth row with palette name // Fourth row with palette name
u8x8.setCursor(2, 3); u8x8.setCursor(2, 3);
qComma = 0; extractModeName(knownPalette, JSON_palette_names, lineBuffer, 16);
insideQuotes = false; u8x8.print(lineBuffer);
printedChars = 0;
// Looking for palette name in JSON.
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownPalette))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
u8x8.setFont(u8x8_font_open_iconic_embedded_1x1); u8x8.setFont(u8x8_font_open_iconic_embedded_1x1);
u8x8.drawGlyph(0, 0, 80); // wifi icon u8x8.drawGlyph(0, 0, 80); // wifi icon

View File

@ -2,15 +2,16 @@
**Attention: This usermod compiles only for ESP8266** **Attention: This usermod compiles only for ESP8266**
This usermod-v2 modification performs a ping request to the local IP address every 60 seconds. By this procedure the net services of WLED remains accessible in some problematic WLAN environments. This usermod-v2 modification performs a ping request to a local IP address every 60 seconds. This ensures WLED net services remain accessible in some problematic WLAN environments.
The modification works with static or DHCP IP address configuration. The modification works with static or DHCP IP address configuration.
_Story:_ _Story:_
Unfortunately, with all ESP projects where a web server or other network services are running, I have the problem that after some time the web server is no longer accessible. Now I found out that the connection is at least reestablished when a ping request is executed by the device. Unfortunately, with many ESP projects where a web server or other network services are running, after some time, the connecton to the web server is lost.
The connection can be reestablished with a ping request from the device.
With this modification, in the worst case, the network functions are not available for 60 seconds until the next ping request. With this modification, in the worst case, the network functions are not available until the next ping request. (60 seconds)
## Webinterface ## Webinterface

View File

@ -0,0 +1,17 @@
# Internal Temperature Usermod
This usermod adds the temperature readout to the Info tab and also publishes that over the topic `mcutemp` topic.
## Important
A shown temp of 53,33°C might indicate that the internal temp is not supported.
ESP8266 does not have a internal temp sensor
ESP32S2 seems to crash on reading the sensor -> disabled
## Installation
Add a build flag `-D USERMOD_INTERNAL_TEMPERATURE` to your `platformio.ini` (or `platformio_override.ini`).
## Authors
Soeren Willrodt [@lost-hope](https://github.com/lost-hope)
Dimitry Zhemkov [@dima-zhemkov](https://github.com/dima-zhemkov)

View File

@ -0,0 +1,117 @@
#pragma once
#include "wled.h"
class InternalTemperatureUsermod : public Usermod
{
private:
unsigned long loopInterval = 10000;
unsigned long lastTime = 0;
bool isEnabled = false;
float temperature = 0;
static const char _name[];
static const char _enabled[];
static const char _loopInterval[];
// any private methods should go here (non-inline methosd 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();
#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
#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;
}
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);
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";
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
}

View File

@ -2,8 +2,8 @@
## Purpose ## Purpose
The JSON IR remote allows users to customize IR remote behavior without writing custom code and compiling. The JSON IR remote enables users to customize IR remote behavior without writing custom code and compiling.
It also enables using any remote that is compatible with your IR receiver. Using the JSON IR remote, you can It also allows using any remote compatible with your IR receiver. Using the JSON IR remote, you can
map buttons from any remote to any HTTP request API or JSON API command. map buttons from any remote to any HTTP request API or JSON API command.
## Usage ## Usage

321
usermods/MY9291/MY92xx.h Normal file
View File

@ -0,0 +1,321 @@
/*
MY92XX LED Driver for Arduino
Based on the C driver by MaiKe Labs
Copyright (c) 2016 - 2026 MaiKe Labs
Copyright (C) 2017 - 2018 Xose Pérez for the Arduino compatible library
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _my92xx_h
#define _my92xx_h
#include <Arduino.h>
#ifdef DEBUG_MY92XX
#if ARDUINO_ARCH_ESP8266
#define DEBUG_MSG_MY92XX(...) DEBUG_MY92XX.printf( __VA_ARGS__ )
#elif ARDUINO_ARCH_AVR
#define DEBUG_MSG_MY92XX(...) { char buffer[80]; snprintf(buffer, sizeof(buffer), __VA_ARGS__ ); DEBUG_MY92XX.print(buffer); }
#endif
#else
#define DEBUG_MSG_MY92XX(...)
#endif
typedef enum my92xx_model_t {
MY92XX_MODEL_MY9291 = 0X00,
MY92XX_MODEL_MY9231 = 0X01,
} my92xx_model_t;
typedef enum my92xx_cmd_one_shot_t {
MY92XX_CMD_ONE_SHOT_DISABLE = 0X00,
MY92XX_CMD_ONE_SHOT_ENFORCE = 0X01,
} my92xx_cmd_one_shot_t;
typedef enum my92xx_cmd_reaction_t {
MY92XX_CMD_REACTION_FAST = 0X00,
MY92XX_CMD_REACTION_SLOW = 0X01,
} my92xx_cmd_reaction_t;
typedef enum my92xx_cmd_bit_width_t {
MY92XX_CMD_BIT_WIDTH_16 = 0X00,
MY92XX_CMD_BIT_WIDTH_14 = 0X01,
MY92XX_CMD_BIT_WIDTH_12 = 0X02,
MY92XX_CMD_BIT_WIDTH_8 = 0X03,
} my92xx_cmd_bit_width_t;
typedef enum my92xx_cmd_frequency_t {
MY92XX_CMD_FREQUENCY_DIVIDE_1 = 0X00,
MY92XX_CMD_FREQUENCY_DIVIDE_4 = 0X01,
MY92XX_CMD_FREQUENCY_DIVIDE_16 = 0X02,
MY92XX_CMD_FREQUENCY_DIVIDE_64 = 0X03,
} my92xx_cmd_frequency_t;
typedef enum my92xx_cmd_scatter_t {
MY92XX_CMD_SCATTER_APDM = 0X00,
MY92XX_CMD_SCATTER_PWM = 0X01,
} my92xx_cmd_scatter_t;
typedef struct {
my92xx_cmd_scatter_t scatter : 1;
my92xx_cmd_frequency_t frequency : 2;
my92xx_cmd_bit_width_t bit_width : 2;
my92xx_cmd_reaction_t reaction : 1;
my92xx_cmd_one_shot_t one_shot : 1;
unsigned char resv : 1;
} __attribute__((aligned(1), packed)) my92xx_cmd_t;
#define MY92XX_COMMAND_DEFAULT { \
.scatter = MY92XX_CMD_SCATTER_APDM, \
.frequency = MY92XX_CMD_FREQUENCY_DIVIDE_1, \
.bit_width = MY92XX_CMD_BIT_WIDTH_8, \
.reaction = MY92XX_CMD_REACTION_FAST, \
.one_shot = MY92XX_CMD_ONE_SHOT_DISABLE, \
.resv = 0 \
}
class my92xx {
public:
my92xx(my92xx_model_t model, unsigned char chips, unsigned char di, unsigned char dcki, my92xx_cmd_t command);
unsigned char getChannels();
void setChannel(unsigned char channel, unsigned int value);
unsigned int getChannel(unsigned char channel);
void setState(bool state);
bool getState();
void update();
private:
void _di_pulse(unsigned int times);
void _dcki_pulse(unsigned int times);
void _set_cmd(my92xx_cmd_t command);
void _send();
void _write(unsigned int data, unsigned char bit_length);
my92xx_cmd_t _command;
my92xx_model_t _model = MY92XX_MODEL_MY9291;
unsigned char _chips = 1;
unsigned char _channels;
uint16_t* _value;
bool _state = false;
unsigned char _pin_di;
unsigned char _pin_dcki;
};
#if ARDUINO_ARCH_ESP8266
extern "C" {
void os_delay_us(unsigned int);
}
#elif ARDUINO_ARCH_AVR
#define os_delay_us delayMicroseconds
#endif
void my92xx::_di_pulse(unsigned int times) {
for (unsigned int i = 0; i < times; i++) {
digitalWrite(_pin_di, HIGH);
digitalWrite(_pin_di, LOW);
}
}
void my92xx::_dcki_pulse(unsigned int times) {
for (unsigned int i = 0; i < times; i++) {
digitalWrite(_pin_dcki, HIGH);
digitalWrite(_pin_dcki, LOW);
}
}
void my92xx::_write(unsigned int data, unsigned char bit_length) {
unsigned int mask = (0x01 << (bit_length - 1));
for (unsigned int i = 0; i < bit_length / 2; i++) {
digitalWrite(_pin_dcki, LOW);
digitalWrite(_pin_di, (data & mask) ? HIGH : LOW);
digitalWrite(_pin_dcki, HIGH);
data = data << 1;
digitalWrite(_pin_di, (data & mask) ? HIGH : LOW);
digitalWrite(_pin_dcki, LOW);
digitalWrite(_pin_di, LOW);
data = data << 1;
}
}
void my92xx::_set_cmd(my92xx_cmd_t command) {
// ets_intr_lock();
// TStop > 12us.
os_delay_us(12);
// Send 12 DI pulse, after 6 pulse's falling edge store duty data, and 12
// pulse's rising edge convert to command mode.
_di_pulse(12);
// Delay >12us, begin send CMD data
os_delay_us(12);
// Send CMD data
unsigned char command_data = *(unsigned char*)(&command);
for (unsigned char i = 0; i < _chips; i++) {
_write(command_data, 8);
}
// TStart > 12us. Delay 12 us.
os_delay_us(12);
// Send 16 DI pulseat 14 pulse's falling edge store CMD data, and
// at 16 pulse's falling edge convert to duty mode.
_di_pulse(16);
// TStop > 12us.
os_delay_us(12);
// ets_intr_unlock();
}
void my92xx::_send() {
#ifdef DEBUG_MY92XX
DEBUG_MSG_MY92XX("[MY92XX] Refresh: %s (", _state ? "ON" : "OFF");
for (unsigned char channel = 0; channel < _channels; channel++) {
DEBUG_MSG_MY92XX(" %d", _value[channel]);
}
DEBUG_MSG_MY92XX(" )\n");
#endif
unsigned char bit_length = 8;
switch (_command.bit_width) {
case MY92XX_CMD_BIT_WIDTH_16:
bit_length = 16;
break;
case MY92XX_CMD_BIT_WIDTH_14:
bit_length = 14;
break;
case MY92XX_CMD_BIT_WIDTH_12:
bit_length = 12;
break;
case MY92XX_CMD_BIT_WIDTH_8:
bit_length = 8;
break;
default:
bit_length = 8;
break;
}
// ets_intr_lock();
// TStop > 12us.
os_delay_us(12);
// Send color data
for (unsigned char channel = 0; channel < _channels; channel++) {
_write(_state ? _value[channel] : 0, bit_length);
}
// TStart > 12us. Ready for send DI pulse.
os_delay_us(12);
// Send 8 DI pulse. After 8 pulse falling edge, store old data.
_di_pulse(8);
// TStop > 12us.
os_delay_us(12);
// ets_intr_unlock();
}
// -----------------------------------------------------------------------------
unsigned char my92xx::getChannels() {
return _channels;
}
void my92xx::setChannel(unsigned char channel, unsigned int value) {
if (channel < _channels) {
_value[channel] = value;
}
}
unsigned int my92xx::getChannel(unsigned char channel) {
if (channel < _channels) {
return _value[channel];
}
return 0;
}
bool my92xx::getState() {
return _state;
}
void my92xx::setState(bool state) {
_state = state;
}
void my92xx::update() {
_send();
}
// -----------------------------------------------------------------------------
my92xx::my92xx(my92xx_model_t model, unsigned char chips, unsigned char di, unsigned char dcki, my92xx_cmd_t command) : _command(command) {
_model = model;
_chips = chips;
_pin_di = di;
_pin_dcki = dcki;
// Init channels
if (_model == MY92XX_MODEL_MY9291) {
_channels = 4 * _chips;
}
else if (_model == MY92XX_MODEL_MY9231) {
_channels = 3 * _chips;
}
_value = new uint16_t[_channels];
for (unsigned char i = 0; i < _channels; i++) {
_value[i] = 0;
}
// Init GPIO
pinMode(_pin_di, OUTPUT);
pinMode(_pin_dcki, OUTPUT);
digitalWrite(_pin_di, LOW);
digitalWrite(_pin_dcki, LOW);
// Clear all duty register
_dcki_pulse(32 * _chips);
// Send init command
_set_cmd(command);
DEBUG_MSG_MY92XX("[MY92XX] Initialized\n");
}
#endif

View File

@ -0,0 +1,45 @@
#pragma once
#include "wled.h"
#include "MY92xx.h"
#define MY92XX_MODEL MY92XX_MODEL_MY9291
#define MY92XX_CHIPS 1
#define MY92XX_DI_PIN 13
#define MY92XX_DCKI_PIN 15
#define MY92XX_RED 0
#define MY92XX_GREEN 1
#define MY92XX_BLUE 2
#define MY92XX_WHITE 3
class MY9291Usermod : public Usermod {
private:
my92xx _my92xx = my92xx(MY92XX_MODEL, MY92XX_CHIPS, MY92XX_DI_PIN, MY92XX_DCKI_PIN, MY92XX_COMMAND_DEFAULT);
public:
void setup() {
_my92xx.setState(true);
}
void connected() {
}
void loop() {
uint32_t c = strip.getPixelColor(0);
int w = ((c >> 24) & 0xff) * bri / 255.0;
int r = ((c >> 16) & 0xff) * bri / 255.0;
int g = ((c >> 8) & 0xff) * bri / 255.0;
int b = (c & 0xff) * bri / 255.0;
_my92xx.setChannel(MY92XX_RED, r);
_my92xx.setChannel(MY92XX_GREEN, g);
_my92xx.setChannel(MY92XX_BLUE, b);
_my92xx.setChannel(MY92XX_WHITE, w);
_my92xx.update();
}
uint16_t getId() {
return USERMOD_ID_MY9291;
}
};

View File

@ -1,9 +0,0 @@
# PIR sensor with MQTT
This simple usermod allows attaching a PIR sensor like the AM312 and publish the readings over MQTT. A message is sent when motion is detected as well as when motion has stopped.
This usermod has only been tested with the AM312 sensor though should work for any other PIR sensor. Note that this does not control the LED strip directly, it only publishes MQTT readings for use with other integrations like Home Assistant.
## Installation
Copy and replace the file `usermod.cpp` in wled00 directory.

View File

@ -1,55 +0,0 @@
#include "wled.h"
/*
* This v1 usermod file allows you to add own functionality to WLED more easily
* See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality
* EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h)
* If you just need 8 bytes, use 2551-2559 (you do not need to increase EEPSIZE)
*
* Consider the v2 usermod API if you need a more advanced feature set!
*/
//Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t)
// PIR sensor pin
const int MOTION_PIN = 16;
// MQTT topic for sensor values
const char MQTT_TOPIC[] = "/motion";
int prevState = LOW;
//gets called once at boot. Do all initialization that doesn't depend on network here
void userSetup()
{
pinMode(MOTION_PIN, INPUT);
}
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here
void userConnected()
{
}
void publishMqtt(String state)
{
//Check if MQTT Connected, otherwise it will crash the 8266
if (mqtt != nullptr){
char subuf[38];
strcpy(subuf, mqttDeviceTopic);
strcat(subuf, MQTT_TOPIC);
mqtt->publish(subuf, 0, true, state.c_str());
}
}
//loop. You can use "if (WLED_CONNECTED)" to check for successful connection
void userLoop()
{
if (digitalRead(MOTION_PIN) == HIGH && prevState == LOW) { // Motion detected
publishMqtt("ON");
prevState = HIGH;
}
if (digitalRead(MOTION_PIN) == LOW && prevState == HIGH) { // Motion stopped
publishMqtt("OFF");
prevState = LOW;
}
}

View File

@ -61,7 +61,7 @@ class PIRsensorSwitch : public Usermod {
private: private:
// PIR sensor pin // PIR sensor pin
const uint8_t PIRsensorPin = 13; // D7 on D1 mini const uint8_t PIRsensorPin = 13; // D7 on D1 mini
// notification mode for colorUpdated() // notification mode for stateUpdated()
const byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // CALL_MODE_DIRECT_CHANGE const byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // CALL_MODE_DIRECT_CHANGE
// 1 min delay before switch off after the sensor state goes LOW // 1 min delay before switch off after the sensor state goes LOW
uint32_t m_switchOffDelay = 60000; uint32_t m_switchOffDelay = 60000;
@ -127,7 +127,7 @@ class PIRsensorSwitch : public Usermod {
if (bri != briHighlight) { if (bri != briHighlight) {
bri = briHighlight; // set current highlight brightness to last set highlight brightness bri = briHighlight; // set current highlight brightness to last set highlight brightness
} }
colorUpdated(NotifyUpdateMode); stateUpdated(NotifyUpdateMode);
highlightActive = true; // flag highlight is on highlightActive = true; // flag highlight is on
} }
else { // **pir timer has elapsed** else { // **pir timer has elapsed**
@ -157,7 +157,7 @@ class PIRsensorSwitch : public Usermod {
} }
applyMacro(macroLongPress); // apply standby lighting without brightness applyMacro(macroLongPress); // apply standby lighting without brightness
} }
colorUpdated(NotifyUpdateMode); stateUpdated(NotifyUpdateMode);
highlightActive = false; // flag highlight is off highlightActive = false; // flag highlight is off
} }
} }

View File

@ -7,68 +7,35 @@ _Story:_
I use the PIR Sensor to automatically turn on the WLED analog clock in my home office room when I am there. I use the PIR Sensor to automatically turn on the WLED analog clock in my home office room when I am there.
The LED strip is switched [using a relay](https://github.com/Aircoookie/WLED/wiki/Control-a-relay-with-WLED) to keep the power consumption low when it is switched off. The LED strip is switched [using a relay](https://github.com/Aircoookie/WLED/wiki/Control-a-relay-with-WLED) to keep the power consumption low when it is switched off.
## Webinterface ## Web interface
The info page in the web interface shows the remaining time of the off timer. The info page in the web interface shows the remaining time of the off timer. Usermod can also be temporarily disbled/enabled from the info page by clicking PIR button.
## Sensor connection ## Sensor connection
My setup uses an HC-SR501 sensor, a HC-SR505 should also work. My setup uses an HC-SR501 or HC-SR602 sensor, an HC-SR505 should also work.
The usermod uses GPIO13 (D1 mini pin D7) by default for the sensor signal but can be changed in the Usermod settings page. The usermod uses GPIO13 (D1 mini pin D7) by default for the sensor signal, but can be changed in the Usermod settings page.
[This example page](http://www.esp8266learning.com/wemos-mini-pir-sensor-example.php) describes how to connect the sensor. [This example page](http://www.esp8266learning.com/wemos-mini-pir-sensor-example.php) describes how to connect the sensor.
Use the potentiometers on the sensor to set the time-delay to the minimum and the sensitivity to about half, or slightly above. Use the potentiometers on the sensor to set the time delay to the minimum and the sensitivity to about half, or slightly above.
You can also use usermod's off timer instead of sensor's. In such case rotate the potentiometer to its shortest time possible (or use SR602 which lacks such potentiometer).
## Usermod installation ## Usermod installation
1. Copy the file `usermod_PIR_sensor_switch.h` to the `wled00` directory. **NOTE:** Usermod has been included in master branch of WLED so it can be compiled in directly just by defining `-D USERMOD_PIRSWITCH` and optionaly `-D PIR_SENSOR_PIN=16` to override default pin. You can also change the default off time by adding `-D PIR_SENSOR_OFF_SEC=30`.
2. Register the usermod by adding `#include "usermod_PIR_sensor_switch.h"` in the top and `registerUsermod(new PIRsensorSwitch());` in the bottom of `usermods_list.cpp`.
Example **usermods_list.cpp**: ## API to enable/disable the PIR sensor from outside. For example from another usermod:
```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_PIR_sensor_switch.h"
void registerUsermods()
{
/*
* Add your usermod class name here
* || || ||
* \/ \/ \/
*/
//usermods.add(new MyExampleUsermod());
//usermods.add(new UsermodTemperature());
//usermods.add(new UsermodRenameMe());
usermods.add(new PIRsensorSwitch());
}
```
## API to enable/disable the PIR sensor from outside. For example from another usermod.
To query or change the PIR sensor state the methods `bool PIRsensorEnabled()` and `void EnablePIRsensor(bool enable)` are available. To query or change the PIR sensor state the methods `bool PIRsensorEnabled()` and `void EnablePIRsensor(bool enable)` are available.
When the PIR sensor state changes an MQTT message is broadcasted with topic `wled/deviceMAC/motion` and message `on` or `off`. When the PIR sensor state changes an MQTT message is broadcasted with topic `wled/deviceMAC/motion` and message `on` or `off`.
Usermod can also be configured to just send MQTT message and not change WLED state using settings page as well as responding to motion only during nighttime (assuming NTP and lattitude/longitude are set to determine sunrise/sunset times). Usermod can also be configured to send just the MQTT message but not change WLED state using settings page as well as responding to motion only at night
(assuming NTP and lattitude/longitude are set to determine sunrise/sunset times).
### There are two options to get access to the usermod instance: ### There are two options to get access to the usermod instance:
1. Include `usermod_PIR_sensor_switch.h` **before** you include the other usermod in `usermods_list.cpp' 1. Include `usermod_PIR_sensor_switch.h` **before** you include other usermods in `usermods_list.cpp'
or or
@ -95,8 +62,32 @@ class MyUsermod : public Usermod {
}; };
``` ```
Have fun - @gegu ### Configuration options
Usermod can be configured via the Usermods settings page.
* `PIRenabled` - enable/disable usermod
* `pin` - dynamically change GPIO pin where PIR sensor is attached to ESP
* `PIRoffSec` - number of seconds after PIR sensor deactivates when usermod triggers Off preset (or turns WLED off)
* `on-preset` - preset triggered when PIR activates (if this is 0 it will just turn WLED on)
* `off-preset` - preset triggered when PIR deactivates (if this is 0 it will just turn WLED off)
* `nighttime-only` - enable triggering only between sunset and sunrise (you will need to set up _NTP_, _Lat_ & _Lon_ in Time & Macro settings)
* `mqtt-only` - send only MQTT messages, do not interact with WLED
* `off-only` - only trigger presets or turn WLED on/off if WLED is not already on (displaying effect)
* `notifications` - enable or disable sending notifications to other WLED instances using Sync button
Have fun - @gegu & @blazoncek
## Change log ## Change log
2021-04 2021-04
* Adaptation for runtime configuration. * Adaptation for runtime configuration.
2021-11
* Added information about dynamic configuration options
* Added option to temporary enable/disble usermod from WLED UI (Info dialog)
2022-11
* Added compile time option for off timer.
* Added Home Assistant autodiscovery MQTT broadcast.
* Updated info on compiling.

View File

@ -11,77 +11,66 @@
#endif #endif
#endif #endif
#ifndef PIR_SENSOR_OFF_SEC
#define PIR_SENSOR_OFF_SEC 600
#endif
/* /*
* This usermod handles PIR sensor states. * This usermod handles PIR sensor states.
* The strip will be switched on and the off timer will be resetted when the sensor goes HIGH. * The strip will be switched on and the off timer will be resetted when the sensor goes HIGH.
* When the sensor state goes LOW, the off timer is started and when it expires, the strip is switched off. * When the sensor state goes LOW, the off timer is started and when it expires, the strip is switched off.
* * Maintained by: @blazoncek
* *
* Usermods allow you to add own functionality to WLED more easily * 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/Aircoookie/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. * 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. * Multiple v2 usermods can be added to one compilation easily.
*
* Creating a usermod:
* This file serves as an example. If you want to create a usermod, it is recommended to use usermod_v2_empty.h from the usermods folder as a template.
* Please remember to rename the class and file to a descriptive name.
* You may also use multiple .h and .cpp files.
*
* Using a usermod:
* 1. Copy the usermod into the sketch folder (same folder as wled00.ino)
* 2. Register the usermod by adding #include "usermod_filename.h" in the top and registerUsermod(new MyUsermodClass()) in the bottom of usermods_list.cpp
*/ */
class PIRsensorSwitch : public Usermod class PIRsensorSwitch : public Usermod
{ {
public: public:
/** // constructor
* constructor
*/
PIRsensorSwitch() {} PIRsensorSwitch() {}
/** // destructor
* desctructor
*/
~PIRsensorSwitch() {} ~PIRsensorSwitch() {}
/** //Enable/Disable the PIR sensor
* Enable/Disable the PIR sensor inline void EnablePIRsensor(bool en) { enabled = en; }
*/
void EnablePIRsensor(bool en) { enabled = en; } // Get PIR sensor enabled/disabled state
/** inline bool PIRsensorEnabled() { return enabled; }
* Get PIR sensor enabled/disabled state
*/
bool PIRsensorEnabled() { return enabled; }
private: private:
// PIR sensor pin
int8_t PIRsensorPin = PIR_SENSOR_PIN;
// notification mode for colorUpdated()
const byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // CALL_MODE_DIRECT_CHANGE
// delay before switch off after the sensor state goes LOW
uint32_t m_switchOffDelay = 600000; // 10min
// off timer start time
uint32_t m_offTimerStart = 0;
// current PIR sensor pin state
byte sensorPinState = LOW;
// PIR sensor enabled
bool enabled = true;
// status of initialisation
bool initDone = false;
// on and off presets
uint8_t m_onPreset = 0;
uint8_t m_offPreset = 0;
// flag to indicate that PIR sensor should activate WLED during nighttime only
bool m_nightTimeOnly = false;
// flag to send MQTT message only (assuming it is enabled)
bool m_mqttOnly = false;
// flag to enable triggering only if WLED is initially off (LEDs are not on, preventing running effect being overwritten by PIR)
bool m_offOnly = false;
bool PIRtriggered = false;
byte prevPreset = 0;
byte prevPlaylist = 0;
volatile unsigned long offTimerStart = 0; // off timer start time
volatile bool PIRtriggered = false; // did PIR trigger?
byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // notification mode for stateUpdated(): CALL_MODE_NO_NOTIFY or CALL_MODE_DIRECT_CHANGE
byte sensorPinState = LOW; // current PIR sensor pin state
bool initDone = false; // status of initialization
unsigned long lastLoop = 0; unsigned long lastLoop = 0;
// configurable parameters
bool enabled = true; // PIR sensor enabled
int8_t PIRsensorPin = PIR_SENSOR_PIN; // PIR sensor pin
uint32_t m_switchOffDelay = PIR_SENSOR_OFF_SEC*1000; // delay before switch off after the sensor state goes LOW (10min)
uint8_t m_onPreset = 0; // on preset
uint8_t m_offPreset = 0; // off preset
bool m_nightTimeOnly = false; // flag to indicate that PIR sensor should activate WLED during nighttime only
bool m_mqttOnly = false; // flag to send MQTT message only (assuming it is enabled)
// flag to enable triggering only if WLED is initially off (LEDs are not on, preventing running effect being overwritten by PIR)
bool m_offOnly = false;
bool m_offMode = offMode;
bool m_override = false;
// Home Assistant
bool HomeAssistantDiscovery = false; // is HA discovery turned on
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
static const char _name[]; static const char _name[];
static const char _switchOffDelay[]; static const char _switchOffDelay[];
@ -91,104 +80,35 @@ private:
static const char _nightTime[]; static const char _nightTime[];
static const char _mqttOnly[]; static const char _mqttOnly[];
static const char _offOnly[]; static const char _offOnly[];
static const char _haDiscovery[];
static const char _notify[];
static const char _override[];
/** /**
* check if it is daytime * check if it is daytime
* if sunrise/sunset is not defined (no NTP or lat/lon) default to nighttime * if sunrise/sunset is not defined (no NTP or lat/lon) default to nighttime
*/ */
bool isDayTime() { static bool isDayTime();
bool isDayTime = false;
updateLocalTime();
uint8_t hr = hour(localTime);
uint8_t mi = minute(localTime);
if (sunrise && sunset) {
if (hour(sunrise)<hr && hour(sunset)>hr) {
isDayTime = true;
} else {
if (hour(sunrise)==hr && minute(sunrise)<mi) {
isDayTime = true;
}
if (hour(sunset)==hr && minute(sunset)>mi) {
isDayTime = true;
}
}
}
return isDayTime;
}
/** /**
* switch strip on/off * switch strip on/off
*/ */
void switchStrip(bool switchOn) void switchStrip(bool switchOn);
{ void publishMqtt(const char* state);
if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return;
PIRtriggered = switchOn;
if (switchOn && m_onPreset) {
applyPreset(m_onPreset);
} else if (!switchOn && m_offPreset) {
applyPreset(m_offPreset);
} else if (switchOn && bri == 0) {
bri = briLast;
colorUpdated(NotifyUpdateMode);
} else if (!switchOn && bri != 0) {
briLast = bri;
bri = 0;
colorUpdated(NotifyUpdateMode);
}
}
void publishMqtt(const char* state) // Create an MQTT Binary Sensor for Home Assistant Discovery purposes, this includes a pointer to the topic that is published to in the Loop.
{ void publishHomeAssistantAutodiscovery();
//Check if MQTT Connected, otherwise it will crash the 8266
if (WLED_MQTT_CONNECTED){
char subuf[64];
strcpy(subuf, mqttDeviceTopic);
strcat_P(subuf, PSTR("/motion"));
mqtt->publish(subuf, 0, false, state);
}
}
/** /**
* Read and update PIR sensor state. * Read and update PIR sensor state.
* Initilize/reset switch off timer * Initilize/reset switch off timer
*/ */
bool updatePIRsensorState() bool updatePIRsensorState();
{
bool pinState = digitalRead(PIRsensorPin);
if (pinState != sensorPinState) {
sensorPinState = pinState; // change previous state
if (sensorPinState == HIGH) {
m_offTimerStart = 0;
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()))) switchStrip(true);
publishMqtt("on");
} else /*if (bri != 0)*/ {
// start switch off timer
m_offTimerStart = millis();
}
return true;
}
return false;
}
/** /**
* switch off the strip if the delay has elapsed * switch off the strip if the delay has elapsed
*/ */
bool handleOffTimer() bool handleOffTimer();
{
if (m_offTimerStart > 0 && millis() - m_offTimerStart > m_switchOffDelay)
{
if (enabled == true)
{
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()))) switchStrip(false);
publishMqtt("off");
}
m_offTimerStart = 0;
return true;
}
return false;
}
public: public:
//Functions called by WLED //Functions called by WLED
@ -197,133 +117,57 @@ public:
* setup() is called once at boot. WiFi is not yet connected at this point. * setup() is called once at boot. WiFi is not yet connected at this point.
* You can use it to initialize variables, sensors or similar. * You can use it to initialize variables, sensors or similar.
*/ */
void setup() void setup();
{
if (enabled) {
// pin retrieved from cfg.json (readFromConfig()) prior to running setup()
if (PIRsensorPin >= 0 && pinManager.allocatePin(PIRsensorPin, false, PinOwner::UM_PIR)) {
// PIR Sensor mode INPUT_PULLUP
pinMode(PIRsensorPin, INPUT_PULLUP);
sensorPinState = digitalRead(PIRsensorPin);
} else {
if (PIRsensorPin >= 0) {
DEBUG_PRINTLN(F("PIRSensorSwitch pin allocation failed."));
}
PIRsensorPin = -1; // allocation failed
enabled = false;
}
}
initDone = true;
}
/** /**
* connected() is called every time the WiFi is (re)connected * connected() is called every time the WiFi is (re)connected
* Use it to initialize network interfaces * Use it to initialize network interfaces
*/ */
void connected() //void connected();
{
} /**
* onMqttConnect() is called when MQTT connection is established
*/
void onMqttConnect(bool sessionPresent);
/** /**
* loop() is called continuously. Here you can check for events, read sensors, etc. * loop() is called continuously. Here you can check for events, read sensors, etc.
*/ */
void loop() void loop();
{
// only check sensors 4x/s
if (!enabled || millis() - lastLoop < 250 || strip.isUpdating()) return;
lastLoop = millis();
if (!updatePIRsensorState()) {
handleOffTimer();
}
}
/** /**
* addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API. * addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API.
* *
* Add PIR sensor state and switch off timer duration to jsoninfo * Add PIR sensor state and switch off timer duration to jsoninfo
*/ */
void addToJsonInfo(JsonObject &root) void addToJsonInfo(JsonObject &root);
{
JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u");
if (enabled) /**
{ * onStateChanged() is used to detect WLED state change
// off timer */
String uiDomString = F("PIR <i class=\"icons\">&#xe325;</i>"); void onStateChange(uint8_t mode);
JsonArray infoArr = user.createNestedArray(uiDomString); // timer value
if (m_offTimerStart > 0)
{
uiDomString = "";
unsigned int offSeconds = (m_switchOffDelay - (millis() - m_offTimerStart)) / 1000;
if (offSeconds >= 3600)
{
uiDomString += (offSeconds / 3600);
uiDomString += F("h ");
offSeconds %= 3600;
}
if (offSeconds >= 60)
{
uiDomString += (offSeconds / 60);
offSeconds %= 60;
}
else if (uiDomString.length() > 0)
{
uiDomString += 0;
}
if (uiDomString.length() > 0)
{
uiDomString += F("min ");
}
uiDomString += (offSeconds);
infoArr.add(uiDomString + F("s"));
} else {
infoArr.add(sensorPinState ? F("sensor on") : F("inactive"));
}
} else {
String uiDomString = F("PIR sensor");
JsonArray infoArr = user.createNestedArray(uiDomString);
infoArr.add(F("disabled"));
}
}
/** /**
* addToJsonState() can be used to add custom entries to the /json/state part of the JSON API (state object). * 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 * Values in the state object may be modified by connected clients
*/ */
/* //void addToJsonState(JsonObject &root);
void addToJsonState(JsonObject &root)
{
}
*/
/** /**
* readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object). * 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 * Values in the state object may be modified by connected clients
*/ */
/* void readFromJsonState(JsonObject &root);
void readFromJsonState(JsonObject &root)
{
}
*/
/** /**
* provide the changeable values * provide the changeable values
*/ */
void addToConfig(JsonObject &root) void addToConfig(JsonObject &root);
{
JsonObject top = root.createNestedObject(FPSTR(_name)); /**
top[FPSTR(_enabled)] = enabled; * provide UI information and allow extending UI options
top[FPSTR(_switchOffDelay)] = m_switchOffDelay / 1000; */
top["pin"] = PIRsensorPin; void appendConfigData();
top[FPSTR(_onPreset)] = m_onPreset;
top[FPSTR(_offPreset)] = m_offPreset;
top[FPSTR(_nightTime)] = m_nightTimeOnly;
top[FPSTR(_mqttOnly)] = m_mqttOnly;
top[FPSTR(_offOnly)] = m_offOnly;
DEBUG_PRINTLN(F("PIR config saved."));
}
/** /**
* restore the changeable values * restore the changeable values
@ -331,71 +175,13 @@ public:
* *
* The function should return true if configuration was successfully loaded or false if there was no configuration. * The function should return true if configuration was successfully loaded or false if there was no configuration.
*/ */
bool readFromConfig(JsonObject &root) bool readFromConfig(JsonObject &root);
{
bool oldEnabled = enabled;
int8_t oldPin = PIRsensorPin;
JsonObject top = root[FPSTR(_name)];
if (top.isNull()) {
DEBUG_PRINT(FPSTR(_name));
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
PIRsensorPin = top["pin"] | PIRsensorPin;
enabled = top[FPSTR(_enabled)] | enabled;
m_switchOffDelay = (top[FPSTR(_switchOffDelay)] | m_switchOffDelay/1000) * 1000;
m_onPreset = top[FPSTR(_onPreset)] | m_onPreset;
m_onPreset = max(0,min(250,(int)m_onPreset));
m_offPreset = top[FPSTR(_offPreset)] | m_offPreset;
m_offPreset = max(0,min(250,(int)m_offPreset));
m_nightTimeOnly = top[FPSTR(_nightTime)] | m_nightTimeOnly;
m_mqttOnly = top[FPSTR(_mqttOnly)] | m_mqttOnly;
m_offOnly = top[FPSTR(_offOnly)] | m_offOnly;
DEBUG_PRINT(FPSTR(_name));
if (!initDone) {
// reading config prior to setup()
DEBUG_PRINTLN(F(" config loaded."));
} else {
if (oldPin != PIRsensorPin || oldEnabled != enabled) {
// check if pin is OK
if (oldPin != PIRsensorPin && oldPin >= 0) {
// if we are changing pin in settings page
// deallocate old pin
pinManager.deallocatePin(oldPin, PinOwner::UM_PIR);
if (pinManager.allocatePin(PIRsensorPin, false, PinOwner::UM_PIR)) {
pinMode(PIRsensorPin, INPUT_PULLUP);
} else {
// allocation failed
PIRsensorPin = -1;
enabled = false;
}
}
if (enabled) {
sensorPinState = digitalRead(PIRsensorPin);
}
}
DEBUG_PRINTLN(F(" config (re)loaded."));
}
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return !top[FPSTR(_offOnly)].isNull();
}
/** /**
* getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!). * 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. * This could be used in the future for the system to determine whether your usermod is installed.
*/ */
uint16_t getId() uint16_t getId() { return USERMOD_ID_PIRSWITCH; }
{
return USERMOD_ID_PIRSWITCH;
}
}; };
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
@ -407,3 +193,361 @@ const char PIRsensorSwitch::_offPreset[] PROGMEM = "off-preset";
const char PIRsensorSwitch::_nightTime[] PROGMEM = "nighttime-only"; const char PIRsensorSwitch::_nightTime[] PROGMEM = "nighttime-only";
const char PIRsensorSwitch::_mqttOnly[] PROGMEM = "mqtt-only"; const char PIRsensorSwitch::_mqttOnly[] PROGMEM = "mqtt-only";
const char PIRsensorSwitch::_offOnly[] PROGMEM = "off-only"; const char PIRsensorSwitch::_offOnly[] PROGMEM = "off-only";
const char PIRsensorSwitch::_haDiscovery[] PROGMEM = "HA-discovery";
const char PIRsensorSwitch::_notify[] PROGMEM = "notifications";
const char PIRsensorSwitch::_override[] PROGMEM = "override";
bool PIRsensorSwitch::isDayTime() {
updateLocalTime();
uint8_t hr = hour(localTime);
uint8_t mi = minute(localTime);
if (sunrise && sunset) {
if (hour(sunrise)<hr && hour(sunset)>hr) {
return true;
} else {
if (hour(sunrise)==hr && minute(sunrise)<mi) {
return true;
}
if (hour(sunset)==hr && minute(sunset)>mi) {
return true;
}
}
}
return false;
}
void PIRsensorSwitch::switchStrip(bool switchOn)
{
if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return; //if lights on and off only, do nothing
if (PIRtriggered && switchOn) return; //if already on and triggered before, do nothing
PIRtriggered = switchOn;
DEBUG_PRINT(F("PIR: strip=")); DEBUG_PRINTLN(switchOn?"on":"off");
if (switchOn) {
if (m_onPreset) {
if (currentPlaylist>0 && !offMode) {
prevPlaylist = currentPlaylist;
unloadPlaylist();
} else if (currentPreset>0 && !offMode) {
prevPreset = currentPreset;
} else {
saveTemporaryPreset();
prevPlaylist = 0;
prevPreset = 255;
}
applyPreset(m_onPreset, NotifyUpdateMode);
return;
}
// preset not assigned
if (bri == 0) {
bri = briLast;
stateUpdated(NotifyUpdateMode);
}
} else {
if (m_offPreset) {
applyPreset(m_offPreset, NotifyUpdateMode);
return;
} else if (prevPlaylist) {
if (currentPreset==m_onPreset || currentPlaylist==m_onPreset) applyPreset(prevPlaylist, NotifyUpdateMode);
prevPlaylist = 0;
return;
} else if (prevPreset) {
if (prevPreset<255) { if (currentPreset==m_onPreset || currentPlaylist==m_onPreset) applyPreset(prevPreset, NotifyUpdateMode); }
else { if (currentPreset==m_onPreset || currentPlaylist==m_onPreset) applyTemporaryPreset(); }
prevPreset = 0;
return;
}
// preset not assigned
if (bri != 0) {
briLast = bri;
bri = 0;
stateUpdated(NotifyUpdateMode);
}
}
}
void PIRsensorSwitch::publishMqtt(const char* state)
{
#ifndef WLED_DISABLE_MQTT
//Check if MQTT Connected, otherwise it will crash the 8266
if (WLED_MQTT_CONNECTED) {
char buf[64];
sprintf_P(buf, PSTR("%s/motion"), mqttDeviceTopic); //max length: 33 + 7 = 40
mqtt->publish(buf, 0, false, state);
}
#endif
}
void PIRsensorSwitch::publishHomeAssistantAutodiscovery()
{
#ifndef WLED_DISABLE_MQTT
if (WLED_MQTT_CONNECTED) {
StaticJsonDocument<600> doc;
char uid[24], json_str[1024], buf[128];
sprintf_P(buf, PSTR("%s Motion"), serverDescription); //max length: 33 + 7 = 40
doc[F("name")] = buf;
sprintf_P(buf, PSTR("%s/motion"), mqttDeviceTopic); //max length: 33 + 7 = 40
doc[F("stat_t")] = buf;
doc[F("pl_on")] = "on";
doc[F("pl_off")] = "off";
sprintf_P(uid, PSTR("%s_motion"), escapedMac.c_str());
doc[F("uniq_id")] = uid;
doc[F("dev_cla")] = F("motion");
doc[F("exp_aft")] = 1800;
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")] = "WLED";
device[F("mdl")] = F("FOSS");
device[F("sw")] = versionString;
sprintf_P(buf, PSTR("homeassistant/binary_sensor/%s/config"), 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); // do we really need to retain?
}
#endif
}
bool PIRsensorSwitch::updatePIRsensorState()
{
bool pinState = digitalRead(PIRsensorPin);
if (pinState != sensorPinState) {
sensorPinState = pinState; // change previous state
if (sensorPinState == HIGH) {
offTimerStart = 0;
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()))) switchStrip(true);
else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
publishMqtt("on");
} else {
// start switch off timer
offTimerStart = millis();
if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
}
return true;
}
return false;
}
bool PIRsensorSwitch::handleOffTimer()
{
if (offTimerStart > 0 && millis() - offTimerStart > m_switchOffDelay) {
offTimerStart = 0;
if (enabled == true) {
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()) || PIRtriggered)) switchStrip(false);
else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
publishMqtt("off");
}
return true;
}
return false;
}
//Functions called by WLED
void PIRsensorSwitch::setup()
{
if (enabled) {
// pin retrieved from cfg.json (readFromConfig()) prior to running setup()
if (PIRsensorPin >= 0 && pinManager.allocatePin(PIRsensorPin, false, PinOwner::UM_PIR)) {
// PIR Sensor mode INPUT_PULLUP
pinMode(PIRsensorPin, INPUT_PULLUP);
sensorPinState = digitalRead(PIRsensorPin);
} else {
if (PIRsensorPin >= 0) {
DEBUG_PRINTLN(F("PIRSensorSwitch pin allocation failed."));
}
PIRsensorPin = -1; // allocation failed
enabled = false;
}
}
initDone = true;
}
void PIRsensorSwitch::onMqttConnect(bool sessionPresent)
{
if (HomeAssistantDiscovery) {
publishHomeAssistantAutodiscovery();
}
}
void PIRsensorSwitch::loop()
{
// only check sensors 4x/s
if (!enabled || millis() - lastLoop < 250 || strip.isUpdating()) return;
lastLoop = millis();
if (!updatePIRsensorState()) {
handleOffTimer();
}
}
void PIRsensorSwitch::addToJsonInfo(JsonObject &root)
{
JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u");
JsonArray infoArr = user.createNestedArray(FPSTR(_name));
String uiDomString;
if (enabled) {
if (offTimerStart > 0)
{
uiDomString = "";
unsigned int offSeconds = (m_switchOffDelay - (millis() - offTimerStart)) / 1000;
if (offSeconds >= 3600)
{
uiDomString += (offSeconds / 3600);
uiDomString += F("h ");
offSeconds %= 3600;
}
if (offSeconds >= 60)
{
uiDomString += (offSeconds / 60);
offSeconds %= 60;
}
else if (uiDomString.length() > 0)
{
uiDomString += 0;
}
if (uiDomString.length() > 0)
{
uiDomString += F("min ");
}
uiDomString += (offSeconds);
infoArr.add(uiDomString + F("s"));
} else {
infoArr.add(sensorPinState ? F("sensor on") : F("inactive"));
}
} else {
infoArr.add(F("disabled"));
}
uiDomString = F(" <button class=\"btn btn-xs\" onclick=\"requestJson({");
uiDomString += FPSTR(_name);
uiDomString += F(":{");
uiDomString += FPSTR(_enabled);
if (enabled) {
uiDomString += F(":false}});\">");
uiDomString += F("<i class=\"icons on\">&#xe325;</i>");
} else {
uiDomString += F(":true}});\">");
uiDomString += F("<i class=\"icons off\">&#xe08f;</i>");
}
uiDomString += F("</button>");
infoArr.add(uiDomString);
JsonObject sensor = root[F("sensor")];
if (sensor.isNull()) sensor = root.createNestedObject(F("sensor"));
sensor[F("motion")] = sensorPinState || offTimerStart>0 ? true : false;
}
void PIRsensorSwitch::onStateChange(uint8_t mode) {
if (!initDone) return;
DEBUG_PRINT(F("PIR: offTimerStart=")); DEBUG_PRINTLN(offTimerStart);
if (m_override && PIRtriggered && offTimerStart) { // debounce
// checking PIRtriggered and offTimerStart will prevent cancellation upon On trigger
DEBUG_PRINTLN(F("PIR: Canceled."));
offTimerStart = 0;
PIRtriggered = false;
}
}
void PIRsensorSwitch::readFromJsonState(JsonObject &root)
{
if (!initDone) return; // prevent crash on boot applyPreset()
JsonObject usermod = root[FPSTR(_name)];
if (!usermod.isNull()) {
if (usermod[FPSTR(_enabled)].is<bool>()) {
enabled = usermod[FPSTR(_enabled)].as<bool>();
}
}
}
void PIRsensorSwitch::addToConfig(JsonObject &root)
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[FPSTR(_enabled)] = enabled;
top[FPSTR(_switchOffDelay)] = m_switchOffDelay / 1000;
top["pin"] = PIRsensorPin;
top[FPSTR(_onPreset)] = m_onPreset;
top[FPSTR(_offPreset)] = m_offPreset;
top[FPSTR(_nightTime)] = m_nightTimeOnly;
top[FPSTR(_mqttOnly)] = m_mqttOnly;
top[FPSTR(_offOnly)] = m_offOnly;
top[FPSTR(_override)] = m_override;
top[FPSTR(_haDiscovery)] = HomeAssistantDiscovery;
top[FPSTR(_notify)] = (NotifyUpdateMode != CALL_MODE_NO_NOTIFY);
DEBUG_PRINTLN(F("PIR config saved."));
}
void PIRsensorSwitch::appendConfigData()
{
oappend(SET_F("addInfo('PIRsensorSwitch:HA-discovery',1,'HA=Home Assistant');")); // 0 is field type, 1 is actual field
oappend(SET_F("addInfo('PIRsensorSwitch:notifications',1,'Periodic WS updates');")); // 0 is field type, 1 is actual field
oappend(SET_F("addInfo('PIRsensorSwitch:override',1,'Cancel timer on change');")); // 0 is field type, 1 is actual field
}
bool PIRsensorSwitch::readFromConfig(JsonObject &root)
{
bool oldEnabled = enabled;
int8_t oldPin = PIRsensorPin;
DEBUG_PRINT(FPSTR(_name));
JsonObject top = root[FPSTR(_name)];
if (top.isNull()) {
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
PIRsensorPin = top["pin"] | PIRsensorPin;
enabled = top[FPSTR(_enabled)] | enabled;
m_switchOffDelay = (top[FPSTR(_switchOffDelay)] | m_switchOffDelay/1000) * 1000;
m_onPreset = top[FPSTR(_onPreset)] | m_onPreset;
m_onPreset = max(0,min(250,(int)m_onPreset));
m_offPreset = top[FPSTR(_offPreset)] | m_offPreset;
m_offPreset = max(0,min(250,(int)m_offPreset));
m_nightTimeOnly = top[FPSTR(_nightTime)] | m_nightTimeOnly;
m_mqttOnly = top[FPSTR(_mqttOnly)] | m_mqttOnly;
m_offOnly = top[FPSTR(_offOnly)] | m_offOnly;
m_override = top[FPSTR(_override)] | m_override;
HomeAssistantDiscovery = top[FPSTR(_haDiscovery)] | HomeAssistantDiscovery;
NotifyUpdateMode = top[FPSTR(_notify)] ? CALL_MODE_DIRECT_CHANGE : CALL_MODE_NO_NOTIFY;
if (!initDone) {
// reading config prior to setup()
DEBUG_PRINTLN(F(" config loaded."));
} else {
if (oldPin != PIRsensorPin || oldEnabled != enabled) {
// check if pin is OK
if (oldPin != PIRsensorPin && oldPin >= 0) {
// if we are changing pin in settings page
// deallocate old pin
pinManager.deallocatePin(oldPin, PinOwner::UM_PIR);
if (pinManager.allocatePin(PIRsensorPin, false, PinOwner::UM_PIR)) {
pinMode(PIRsensorPin, INPUT_PULLUP);
} else {
// allocation failed
PIRsensorPin = -1;
enabled = false;
}
}
if (enabled) {
sensorPinState = digitalRead(PIRsensorPin);
}
}
DEBUG_PRINTLN(F(" config (re)loaded."));
}
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return !top[FPSTR(_override)].isNull();
}

View File

@ -2,12 +2,12 @@
v2 Usermod to to control PWM fan with RPM feedback and temperature control v2 Usermod to to control PWM fan with RPM feedback and temperature control
This usermod requires Dallas Temperature usermod to obtain temperature information. If this is not available the fan will always run at 100% speed. This usermod requires the Dallas Temperature usermod to obtain temperature information. If it's not available, the fan will run at 100% speed.
If the fan does not have _tacho_ (RPM) output you can set the _tacho-pin_ to -1 to not use that feature. If the fan does not have _tachometer_ (RPM) output you can set the _tachometer-pin_ to -1 to disable that feature.
You can also set the thershold temperature at which fan runs at lowest speed. If the actual temperature measured will be 3°C greater than threshold temperature the fan will run at 100%. You can also set the thershold temperature at which fan runs at lowest speed. If the measured temperature is 3°C greater than the threshold temperature, the fan will run at 100%.
If the _tacho_ is supported the current speed (in RPM) will be repored in WLED Info page. If the _tachometer_ is supported, the current speed (in RPM) will be displayed on the WLED Info page.
## Installation ## Installation
@ -19,8 +19,8 @@ You will also need `-D USERMOD_DALLASTEMPERATURE`.
All of the parameters are configured during run-time using Usermods settings page. All of the parameters are configured during run-time using Usermods settings page.
This includes: This includes:
* PWM output pin * PWM output pin (can be configured at compile time `-D PWM_PIN=xx`)
* tacho input pin * tachometer input pin (can be configured at compile time `-D TACHO_PIN=xx`)
* sampling frequency in seconds * sampling frequency in seconds
* threshold temperature in degees C * threshold temperature in degees C
@ -30,7 +30,16 @@ _NOTE:_ You may also need to tweak Dallas Temperature usermod sampling frequency
No special requirements. No special requirements.
## Control PWM fan speed using JSON API
e.g. you can use `{"PWM-fan":{"speed":30,"lock":true}}` to lock fan speed to 30 percent of maximum. (replace 30 with an arbitrary value between 0 and 100)
If you include `speed` property you can set fan speed as a percentage (%) of maximum speed.
If you include `lock` property you can lock (_true_) or unlock (_false_) the fan speed.
If the fan speed is unlocked, it will revert to temperature controlled speed on the next update cycle. Once fan speed is locked it will remain so until it is unlocked by the next API call.
## Change Log ## Change Log
2021-10 2021-10
* First public release * First public release
2022-05
* Added JSON API call to allow changing of speed

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#ifndef USERMOD_DALLASTEMPERATURE #if !defined(USERMOD_DALLASTEMPERATURE) && !defined(USERMOD_SHT)
#error The "PWM fan" usermod requires "Dallas Temeprature" usermod to function properly. #error The "PWM fan" usermod requires "Dallas Temeprature" or "SHT" usermod to function properly.
#endif #endif
#include "wled.h" #include "wled.h"
@ -10,6 +10,13 @@
// https://github.com/KlausMu/esp32-fan-controller/tree/main/src // https://github.com/KlausMu/esp32-fan-controller/tree/main/src
// adapted for WLED usermod by @blazoncek // adapted for WLED usermod by @blazoncek
#ifndef TACHO_PIN
#define TACHO_PIN -1
#endif
#ifndef PWM_PIN
#define PWM_PIN -1
#endif
// tacho counter // tacho counter
static volatile unsigned long counter_rpm = 0; static volatile unsigned long counter_rpm = 0;
@ -31,18 +38,22 @@ class PWMFanUsermod : public Usermod {
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
uint8_t pwmChannel = 255; uint8_t pwmChannel = 255;
#endif #endif
bool lockFan = false;
#ifdef USERMOD_DALLASTEMPERATURE #ifdef USERMOD_DALLASTEMPERATURE
UsermodTemperature* tempUM; UsermodTemperature* tempUM;
#elif defined(USERMOD_SHT)
ShtUsermod* tempUM;
#endif #endif
// configurable parameters // configurable parameters
int8_t tachoPin = -1; int8_t tachoPin = TACHO_PIN;
int8_t pwmPin = -1; int8_t pwmPin = PWM_PIN;
uint8_t tachoUpdateSec = 30; uint8_t tachoUpdateSec = 30;
float targetTemperature = 25.0; float targetTemperature = 35.0;
uint8_t minPWMValuePct = 50; uint8_t minPWMValuePct = 0;
uint8_t numberOfInterrupsInOneSingleRotation = 2; // Number of interrupts ESP32 sees on tacho signal on a single fan rotation. All the fans I've seen trigger two interrups. uint8_t numberOfInterrupsInOneSingleRotation = 2; // Number of interrupts ESP32 sees on tacho signal on a single fan rotation. All the fans I've seen trigger two interrups.
uint8_t pwmValuePct = 0;
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
static const char _name[]; static const char _name[];
@ -53,6 +64,8 @@ class PWMFanUsermod : public Usermod {
static const char _tachoUpdateSec[]; static const char _tachoUpdateSec[];
static const char _minPWMValuePct[]; static const char _minPWMValuePct[];
static const char _IRQperRotation[]; static const char _IRQperRotation[];
static const char _speed[];
static const char _lock[];
void initTacho(void) { void initTacho(void) {
if (tachoPin < 0 || !pinManager.allocatePin(tachoPin, false, PinOwner::UM_Unspecified)){ if (tachoPin < 0 || !pinManager.allocatePin(tachoPin, false, PinOwner::UM_Unspecified)){
@ -73,6 +86,8 @@ class PWMFanUsermod : public Usermod {
} }
void updateTacho(void) { void updateTacho(void) {
// store milliseconds when tacho was measured the last time
msLastTachoMeasurement = millis();
if (tachoPin < 0) return; if (tachoPin < 0) return;
// start of tacho measurement // start of tacho measurement
@ -83,8 +98,6 @@ class PWMFanUsermod : public Usermod {
last_rpm /= tachoUpdateSec; last_rpm /= tachoUpdateSec;
// reset counter // reset counter
counter_rpm = 0; counter_rpm = 0;
// store milliseconds when tacho was measured the last time
msLastTachoMeasurement = millis();
// attach interrupt again // attach interrupt again
attachInterrupt(digitalPinToInterrupt(tachoPin), rpm_fan, FALLING); attachInterrupt(digitalPinToInterrupt(tachoPin), rpm_fan, FALLING);
} }
@ -92,6 +105,7 @@ class PWMFanUsermod : public Usermod {
// https://randomnerdtutorials.com/esp32-pwm-arduino-ide/ // https://randomnerdtutorials.com/esp32-pwm-arduino-ide/
void initPWMfan(void) { void initPWMfan(void) {
if (pwmPin < 0 || !pinManager.allocatePin(pwmPin, true, PinOwner::UM_Unspecified)) { if (pwmPin < 0 || !pinManager.allocatePin(pwmPin, true, PinOwner::UM_Unspecified)) {
enabled = false;
pwmPin = -1; pwmPin = -1;
return; return;
} }
@ -123,7 +137,7 @@ class PWMFanUsermod : public Usermod {
} }
void updateFanSpeed(uint8_t pwmValue){ void updateFanSpeed(uint8_t pwmValue){
if (pwmPin < 0) return; if (!enabled || pwmPin < 0) return;
#ifdef ESP8266 #ifdef ESP8266
analogWrite(pwmPin, pwmValue); analogWrite(pwmPin, pwmValue);
@ -133,7 +147,7 @@ class PWMFanUsermod : public Usermod {
} }
float getActualTemperature(void) { float getActualTemperature(void) {
#ifdef USERMOD_DALLASTEMPERATURE #if defined(USERMOD_DALLASTEMPERATURE) || defined(USERMOD_SHT)
if (tempUM != nullptr) if (tempUM != nullptr)
return tempUM->getTemperatureC(); return tempUM->getTemperatureC();
#endif #endif
@ -148,7 +162,7 @@ class PWMFanUsermod : public Usermod {
int pwmStep = ((100 - minPWMValuePct) * newPWMvalue) / (7*100); int pwmStep = ((100 - minPWMValuePct) * newPWMvalue) / (7*100);
int pwmMinimumValue = (minPWMValuePct * newPWMvalue) / 100; int pwmMinimumValue = (minPWMValuePct * newPWMvalue) / 100;
if ((temp == NAN) || (temp <= 0.0)) { if ((temp == NAN) || (temp <= -100.0)) {
DEBUG_PRINTLN(F("WARNING: no temperature value available. Cannot do temperature control. Will set PWM fan to 255.")); DEBUG_PRINTLN(F("WARNING: no temperature value available. Cannot do temperature control. Will set PWM fan to 255."));
} else if (difftemp <= 0.0) { } else if (difftemp <= 0.0) {
// Temperature is below target temperature. Run fan at minimum speed. // Temperature is below target temperature. Run fan at minimum speed.
@ -177,6 +191,8 @@ class PWMFanUsermod : public Usermod {
#ifdef USERMOD_DALLASTEMPERATURE #ifdef USERMOD_DALLASTEMPERATURE
// This Usermod requires Temperature usermod // This Usermod requires Temperature usermod
tempUM = (UsermodTemperature*) usermods.lookup(USERMOD_ID_TEMPERATURE); tempUM = (UsermodTemperature*) usermods.lookup(USERMOD_ID_TEMPERATURE);
#elif defined(USERMOD_SHT)
tempUM = (ShtUsermod*) usermods.lookup(USERMOD_ID_SHT);
#endif #endif
initTacho(); initTacho();
initPWMfan(); initPWMfan();
@ -198,7 +214,7 @@ class PWMFanUsermod : public Usermod {
if ((now - msLastTachoMeasurement) < (tachoUpdateSec * 1000)) return; if ((now - msLastTachoMeasurement) < (tachoUpdateSec * 1000)) return;
updateTacho(); updateTacho();
setFanPWMbasedOnTemperature(); if (!lockFan) setFanPWMbasedOnTemperature();
} }
/* /*
@ -207,12 +223,41 @@ class PWMFanUsermod : public Usermod {
* Below it is shown how this could be used for e.g. a light sensor * Below it is shown how this could be used for e.g. a light sensor
*/ */
void addToJsonInfo(JsonObject& root) { void addToJsonInfo(JsonObject& root) {
if (tachoPin < 0) return;
JsonObject user = root["u"]; JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u"); if (user.isNull()) user = root.createNestedObject("u");
JsonArray data = user.createNestedArray(FPSTR(_name));
data.add(last_rpm); JsonArray infoArr = user.createNestedArray(FPSTR(_name));
data.add(F("rpm")); String uiDomString = F("<button class=\"btn btn-xs\" onclick=\"requestJson({'");
uiDomString += FPSTR(_name);
uiDomString += F("':{'");
uiDomString += FPSTR(_enabled);
uiDomString += F("':");
uiDomString += enabled ? "false" : "true";
uiDomString += F("}});\"><i class=\"icons ");
uiDomString += enabled ? "on" : "off";
uiDomString += F("\">&#xe08f;</i></button>");
infoArr.add(uiDomString);
if (enabled) {
JsonArray infoArr = user.createNestedArray(F("Manual"));
String uiDomString = F("<div class=\"slider\"><div class=\"sliderwrap il\"><input class=\"noslide\" onchange=\"requestJson({'");
uiDomString += FPSTR(_name);
uiDomString += F("':{'");
uiDomString += FPSTR(_speed);
uiDomString += F("':parseInt(this.value)}});\" oninput=\"updateTrail(this);\" max=100 min=0 type=\"range\" value=");
uiDomString += pwmValuePct;
uiDomString += F(" /><div class=\"sliderdisplay\"></div></div></div>"); //<output class=\"sliderbubble\"></output>
infoArr.add(uiDomString);
JsonArray data = user.createNestedArray(F("Speed"));
if (tachoPin >= 0) {
data.add(last_rpm);
data.add(F("rpm"));
} else {
if (lockFan) data.add(F("locked"));
else data.add(F("auto"));
}
}
} }
/* /*
@ -226,9 +271,24 @@ class PWMFanUsermod : public Usermod {
* readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object). * 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 * Values in the state object may be modified by connected clients
*/ */
//void readFromJsonState(JsonObject& root) { void readFromJsonState(JsonObject& root) {
// if (!initDone) return; // prevent crash on boot applyPreset() if (!initDone) return; // prevent crash on boot applyPreset()
//} JsonObject usermod = root[FPSTR(_name)];
if (!usermod.isNull()) {
if (usermod[FPSTR(_enabled)].is<bool>()) {
enabled = usermod[FPSTR(_enabled)].as<bool>();
if (!enabled) updateFanSpeed(0);
}
if (enabled && !usermod[FPSTR(_speed)].isNull() && usermod[FPSTR(_speed)].is<int>()) {
pwmValuePct = usermod[FPSTR(_speed)].as<int>();
updateFanSpeed((constrain(pwmValuePct,0,100) * 255) / 100);
if (pwmValuePct) lockFan = true;
}
if (enabled && !usermod[FPSTR(_lock)].isNull() && usermod[FPSTR(_lock)].is<bool>()) {
lockFan = usermod[FPSTR(_lock)].as<bool>();
}
}
}
/* /*
* addToConfig() can be used to add custom persistent settings to the cfg.json file in the "um" (usermod) object. * addToConfig() can be used to add custom persistent settings to the cfg.json file in the "um" (usermod) object.
@ -330,3 +390,5 @@ const char PWMFanUsermod::_temperature[] PROGMEM = "target-temp-C";
const char PWMFanUsermod::_tachoUpdateSec[] PROGMEM = "tacho-update-s"; const char PWMFanUsermod::_tachoUpdateSec[] PROGMEM = "tacho-update-s";
const char PWMFanUsermod::_minPWMValuePct[] PROGMEM = "min-PWM-percent"; const char PWMFanUsermod::_minPWMValuePct[] PROGMEM = "min-PWM-percent";
const char PWMFanUsermod::_IRQperRotation[] PROGMEM = "IRQs-per-rotation"; const char PWMFanUsermod::_IRQperRotation[] PROGMEM = "IRQs-per-rotation";
const char PWMFanUsermod::_speed[] PROGMEM = "speed";
const char PWMFanUsermod::_lock[] PROGMEM = "lock";

View File

@ -1,34 +0,0 @@
# QuinLED Dig Uno board
These files allow WLED 0.9.1 to report the temp sensor on the Quinled board to MQTT. I use it to report the board temp to Home Assistant via MQTT, so it will send notifications if something happens and the board start to heat up.
This code uses Aircookie's WLED software. It has a premade file for user modifications. I use it to publish the temperature from the dallas temperature sensor on the Quinled board. The entries for the top of the WLED00 file, initializes the required libraries, and variables for the sensor. The .ino file waits for 60 seconds, and checks to see if the MQTT server is connected (thanks Aircoookie). It then poles the sensor, and published it using the MQTT service already running, using the main topic programmed in the WLED UI.
Installation of file: Copy and replace file in wled00 directory
## Project link
* [QuinLED-Dig-Uno](https://quinled.info/2018/09/15/quinled-dig-uno/) - Project link
### Platformio requirements
Uncomment `DallasTemperature@~3.8.0`,`OneWire@~2.3.5 under` `[common]` section in `platformio.ini`:
```ini
# platformio.ini
...
[platformio]
...
; default_envs = esp07
default_envs = d1_mini
...
[common]
...
lib_deps_external =
...
#For use SSD1306 OLED display uncomment following
U8g2@~2.27.3
#For Dallas sensor uncomment following 2 lines
DallasTemperature@~3.8.0
OneWire@~2.3.5
...
```

View File

@ -1,54 +0,0 @@
#include <Arduino.h>
#include "wled.h"
//Intiating code for QuinLED Dig-Uno temp sensor
//Uncomment Celsius if that is your prefered temperature scale
#include <DallasTemperature.h> //Dallastemperature sensor
#ifdef ARDUINO_ARCH_ESP32 //ESP32 boards
OneWire oneWire(18);
#else //ESP8266 boards
OneWire oneWire(14);
#endif
DallasTemperature sensor(&oneWire);
long temptimer = millis();
long lastMeasure = 0;
#define Celsius // Show temperature mesaurement in Celcius otherwise is in Fahrenheit
void userSetup()
{
// Start the DS18B20 sensor
sensor.begin();
}
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here
void userConnected()
{
}
void userLoop()
{
temptimer = millis();
// Timer to publishe new temperature every 60 seconds
if (temptimer - lastMeasure > 60000) {
lastMeasure = temptimer;
//Check if MQTT Connected, otherwise it will crash the 8266
if (mqtt != nullptr){
sensor.requestTemperatures();
//Gets prefered temperature scale based on selection in definitions section
#ifdef Celsius
float board_temperature = sensor.getTempCByIndex(0);
#else
float board_temperature = sensors.getTempFByIndex(0);
#endif
//Create character string populated with user defined device topic from the UI, and the read temperature. Then publish to MQTT server.
char subuf[38];
strcpy(subuf, mqttDeviceTopic);
strcat(subuf, "/temperature");
mqtt->publish(subuf, 0, true, String(board_temperature).c_str());
return;}
return;}
return;
}

View File

@ -1,6 +1,6 @@
# DS1307/DS3231 Real time clock # DS1307/DS3231 Real time clock
Gets the time from I2C RTC module on boot. This allows clocks to operate e.g. if temporarily no WiFi is available. Gets the time from I2C RTC module on boot. This allows clock operation if WiFi is not available.
The stored time is updated each time NTP is synced. The stored time is updated each time NTP is synced.
## Installation ## Installation

View File

@ -12,6 +12,8 @@ class RTCUsermod : public Usermod {
public: public:
void setup() { void setup() {
if (i2c_scl<0 || i2c_sda<0) { disabled = true; return; }
RTC.begin();
time_t rtcTime = RTC.get(); time_t rtcTime = RTC.get();
if (rtcTime) { if (rtcTime) {
toki.setTime(rtcTime,TOKI_NO_MS_ACCURACY,TOKI_TS_RTC); toki.setTime(rtcTime,TOKI_NO_MS_ACCURACY,TOKI_TS_RTC);
@ -22,12 +24,26 @@ class RTCUsermod : public Usermod {
} }
void loop() { void loop() {
if (!disabled && toki.isTick()) { if (disabled || strip.isUpdating()) return;
if (toki.isTick()) {
time_t t = toki.second(); time_t t = toki.second();
if (t != RTC.get()) RTC.set(t); //set RTC to NTP/UI-provided value if (t != RTC.get()) RTC.set(t); //set RTC to NTP/UI-provided value
} }
} }
/*
* 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)
* I highly recommend checking out the basics of ArduinoJson serialization and deserialization in order to use custom settings!
*/
// void addToConfig(JsonObject& root)
// {
// JsonObject top = root.createNestedObject("RTC");
// JsonArray pins = top.createNestedArray("pin");
// pins.add(i2c_scl);
// pins.add(i2c_sda);
// }
uint16_t getId() uint16_t getId()
{ {
return USERMOD_ID_RTC; return USERMOD_ID_RTC;

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head><meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta charset="utf-8">
<title>Blinds</title>
<script>
strA = "";
function send()
{
nocache = "&nocache=" + Math.random() * 1000000;
var request = new XMLHttpRequest();
// send HTTP request
request.open("GET", "win/" + strA +nocache, true);
request.send(null);
strA = "";
}
function up()
{
strA = "&U0=2";
send();
}
function down()
{
strA = "&U0=1";
send();
}
function OpenSettings()
{
window.open("/settings", "_self");
}
</script>
<style>
body {
text-align: center;
background: linear-gradient(45deg,#0ca,#0ac);
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
}
html {
height: 100%;
}
svg {
width: 30vw;
padding: 2vh;
}
.tool_box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
<style id="holderjs-style" type="text/css"></style></head>
<body class=" __plain_text_READY__">
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="icon-box-add" viewBox="0 0 32 32">
<path d="M26 2h-20l-6 6v21c0 0.552 0.448 1 1 1h30c0.552 0 1-0.448 1-1v-21l-6-6zM16 26l-10-8h6v-6h8v6h6l-10 8zM4.828 6l2-2h18.343l2 2h-22.343z"></path>
</symbol>
<symbol id="icon-box-remove" viewBox="0 0 32 32">
<path d="M26 2h-20l-6 6v21c0 0.552 0.448 1 1 1h30c0.552 0 1-0.448 1-1v-21l-6-6zM20 20v6h-8v-6h-6l10-8 10 8h-6zM4.828 6l2-2h18.343l2 2h-22.343z"></path>
</symbol>
<symbol id="icon-cog" viewBox="0 0 32 32">
<path d="M29.181 19.070c-1.679-2.908-0.669-6.634 2.255-8.328l-3.145-5.447c-0.898 0.527-1.943 0.829-3.058 0.829-3.361 0-6.085-2.742-6.085-6.125h-6.289c0.008 1.044-0.252 2.103-0.811 3.070-1.679 2.908-5.411 3.897-8.339 2.211l-3.144 5.447c0.905 0.515 1.689 1.268 2.246 2.234 1.676 2.903 0.672 6.623-2.241 8.319l3.145 5.447c0.895-0.522 1.935-0.82 3.044-0.82 3.35 0 6.067 2.725 6.084 6.092h6.289c-0.003-1.034 0.259-2.080 0.811-3.038 1.676-2.903 5.399-3.894 8.325-2.219l3.145-5.447c-0.899-0.515-1.678-1.266-2.232-2.226zM16 22.479c-3.578 0-6.479-2.901-6.479-6.479s2.901-6.479 6.479-6.479c3.578 0 6.479 2.901 6.479 6.479s-2.901 6.479-6.479 6.479z"></path>
</symbol>
</defs>
</svg>
<div id="tbB" class="tool_box">
<svg id="upb" onclick="up()"><use xlink:href="#icon-box-remove"></use></svg>
<svg id="dnb" onclick="down()"><use xlink:href="#icon-box-add"></use></svg>
<svg id="stb" onclick="OpenSettings()"><use xlink:href="#icon-cog"></use></svg>
</div>
</body>
</html>

View File

@ -0,0 +1 @@
{"0":{},"2":{"n":"▲","win":"U0=2"},"1":{"n":"▼","win":"U0=1"}}

View File

@ -0,0 +1,8 @@
# RelayBlinds usermod
This simple usermod toggles two relay pins momentarily (defaults to 500ms) when `userVar0` is set.
e.g. can be used to "push" the buttons of a window blinds motor controller.
v1 usermod. Please replace usermod.cpp in the `wled00` directory with the one in this file.
You may upload `index.htm` to `[WLED-IP]/edit` to replace the default lighting UI with a simple Up/Down button one.
A simple `presets.json` file is available. This makes the relay actions controllable via two presets to facilitate control e.g. the default UI or Alexa.

View File

@ -0,0 +1,83 @@
#include "wled.h"
//Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t)
//gets called once at boot. Do all initialization that doesn't depend on network here
void userSetup()
{
}
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here
void userConnected()
{
}
/*
* Physical IO
*/
#define PIN_UP_RELAY 4
#define PIN_DN_RELAY 5
#define PIN_ON_TIME 500
bool upActive = false, upActiveBefore = false, downActive = false, downActiveBefore = false;
unsigned long upStartTime = 0, downStartTime = 0;
void handleRelay()
{
//up and down relays
if (userVar0) {
upActive = true;
if (userVar0 == 1) {
upActive = false;
downActive = true;
}
userVar0 = 0;
}
if (upActive)
{
if(!upActiveBefore)
{
pinMode(PIN_UP_RELAY, OUTPUT);
digitalWrite(PIN_UP_RELAY, LOW);
upActiveBefore = true;
upStartTime = millis();
DEBUG_PRINTLN("UPA");
}
if (millis()- upStartTime > PIN_ON_TIME)
{
upActive = false;
DEBUG_PRINTLN("UPN");
}
} else if (upActiveBefore)
{
pinMode(PIN_UP_RELAY, INPUT);
upActiveBefore = false;
}
if (downActive)
{
if(!downActiveBefore)
{
pinMode(PIN_DN_RELAY, OUTPUT);
digitalWrite(PIN_DN_RELAY, LOW);
downActiveBefore = true;
downStartTime = millis();
}
if (millis()- downStartTime > PIN_ON_TIME)
{
downActive = false;
}
} else if (downActiveBefore)
{
pinMode(PIN_DN_RELAY, INPUT);
downActiveBefore = false;
}
}
//loop. You can use "if (WLED_CONNECTED)" to check for successful connection
void userLoop()
{
handleRelay();
}

View File

@ -1,7 +1,7 @@
# SN_Photoresistor usermod # SN_Photoresistor usermod
This usermod will read from an attached photoresistor sensor like the KY-018 sensor. This usermod will read from an attached photoresistor sensor like the KY-018.
The luminance is displayed both in the Info section of the web UI as well as published to the `/luminance` MQTT topic if enabled. The luminance is displayed in both the Info section of the web UI as well as published to the `/luminance` MQTT topic, if enabled.
## Installation ## Installation
@ -9,15 +9,15 @@ Copy the example `platformio_override.ini` to the root directory. This file sho
### Define Your Options ### Define Your Options
* `USERMOD_SN_PHOTORESISTOR` - define this to have this user mod included wled00\usermods_list.cpp * `USERMOD_SN_PHOTORESISTOR` - Enables this user mod. wled00\usermods_list.cpp
* `USERMOD_SN_PHOTORESISTOR_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60 seconds * `USERMOD_SN_PHOTORESISTOR_MEASUREMENT_INTERVAL` - Number of milliseconds between measurements. Defaults to 60000 ms
* `USERMOD_SN_PHOTORESISTOR_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 20 seconds * `USERMOD_SN_PHOTORESISTOR_FIRST_MEASUREMENT_AT` - Number of milliseconds after boot to take first measurement. Defaults to 20000 ms
* `USERMOD_SN_PHOTORESISTOR_REFERENCE_VOLTAGE` - the voltage supplied to the sensor, defaults to 5v * `USERMOD_SN_PHOTORESISTOR_REFERENCE_VOLTAGE` - Voltage supplied to the sensor. Defaults to 5v
* `USERMOD_SN_PHOTORESISTOR_ADC_PRECISION` - the ADC precision is the number of distinguishable ADC inputs, defaults to 1024.0 (10 bits) * `USERMOD_SN_PHOTORESISTOR_ADC_PRECISION` - ADC precision. Defaults to 10 bits
* `USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE` - the resistor size, defaults to 10000.0 (10K hms) * `USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE` - Resistor size, defaults to 10000.0 (10K Ohms)
* `USERMOD_SN_PHOTORESISTOR_OFFSET_VALUE` - the offset value to report on, defaults to 25 * `USERMOD_SN_PHOTORESISTOR_OFFSET_VALUE` - Offset value to report on. Defaults to 25
All parameters can be configured at runtime using Usermods settings page. All parameters can be configured at runtime via the Usermods settings page.
## Project link ## Project link

View File

@ -22,12 +22,12 @@
// 10 bits // 10 bits
#ifndef USERMOD_SN_PHOTORESISTOR_ADC_PRECISION #ifndef USERMOD_SN_PHOTORESISTOR_ADC_PRECISION
#define USERMOD_SN_PHOTORESISTOR_ADC_PRECISION 1024.0 #define USERMOD_SN_PHOTORESISTOR_ADC_PRECISION 1024.0f
#endif #endif
// resistor size 10K hms // resistor size 10K hms
#ifndef USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE #ifndef USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE
#define USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE 10000.0 #define USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE 10000.0f
#endif #endif
// only report if differance grater than offset value // only report if differance grater than offset value
@ -109,6 +109,7 @@ public:
{ {
lastLDRValue = currentLDRValue; lastLDRValue = currentLDRValue;
#ifndef WLED_DISABLE_MQTT
if (WLED_MQTT_CONNECTED) if (WLED_MQTT_CONNECTED)
{ {
char subuf[45]; char subuf[45];
@ -121,6 +122,12 @@ public:
DEBUG_PRINTLN("Missing MQTT connection. Not publishing data"); DEBUG_PRINTLN("Missing MQTT connection. Not publishing data");
} }
} }
#endif
}
uint16_t getLastLDRValue()
{
return lastLDRValue;
} }
void addToJsonInfo(JsonObject &root) void addToJsonInfo(JsonObject &root)

View File

@ -1,18 +1,21 @@
# ST7789 TFT IPS Color display 240x240pxwith ESP32 boards # Using the ST7789 TFT IPS 240x240 pixel color display with ESP32 boards
This usermod allow to use 240x240 display to display following: This usermod enables display of the following:
* Current date and time;
* Network SSID; * Network SSID;
* IP address; * IP address;
* WiFi signal strength;
* Brightness; * Brightness;
* Chosen effect; * Selected effect;
* Chosen palette; * Selected palette;
* Effect speed and intensity;
* Estimated current in mA; * Estimated current in mA;
## Hardware ## Hardware
*** ***
![Hardware](images/ST7789_guide.jpg) ![Hardware](images/ST7789_Guide.jpg)
## Library used ## Library used
@ -38,35 +41,37 @@ lib_deps =
... ...
``` ```
Also, while in the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: In the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows:
Add lines to section: Add the following lines to section:
```ini ```ini
default_envs = esp32dev default_envs = esp32dev
build_flags = ${common.build_flags_esp32} build_flags = ${common.build_flags_esp32}
-D USERMOD_ST7789_DISPLAY -D USERMOD_ST7789_DISPLAY
-DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1
-DTFT_WIDTH=240
-DTFT_HEIGHT=240
-DCGRAM_OFFSET=1
-DTFT_MOSI=21
-DTFT_SCLK=22
-DTFT_DC=27
-DTFT_RST=26
-DTFT_BL=14
-DLOAD_GLCD=1
;optional for WROVER
;-DCONFIG_SPIRAM_SUPPORT=1
``` ```
Save the `platformio.ini` file. Once this is saved, the required library files should be automatically downloaded for modifications in a later step. Save the `platformio.ini` file. Once saved, the required library files should be automatically downloaded for modifications in a later step.
### TFT_eSPI Library Adjustments ### TFT_eSPI Library Adjustments
We need to modify a file in the `TFT_eSPI` library. If you followed the directions to modify and save the `platformio.ini` file above, the `User_Setup_Select.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI` folder. If you are not using PlatformIO, you need to modify a file in the `TFT_eSPI` library. If you followed the directions to modify and save the `platformio.ini` file above, the `Setup24_ST7789.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI/User_Setups/` folder.
Modify the `User_Setup_Select.h` file as follows: Edit `Setup_ST7789.h` file and uncomment and change GPIO pin numbers in lines containing `TFT_MOSI`, `TFT_SCLK`, `TFT_RST`, `TFT_DC`.
* Comment out the following line (which is the 'default' setup file): Modify the `User_Setup_Select.h` by uncommenting the line containing `#include <User_Setups/Setup24_ST7789.h>` and commenting out the line containing `#include <User_Setup.h>`.
```ini If your display uses the backlight enable pin, add this definition: #define TFT_BL with backlight enable GPIO number.
//#include <User_Setup.h> // Default setup is root library folder
```
* Add following line:
```ini
#include <User_Setups/Setup_ST7789_Display.h> // Setup file for ESP32 ST7789V SPI bus TFT
```
* Copy file `"Setup_ST7789_Display.h"` from usermod folder to `/.pio/libdeps/esp32dev/TFT_eSPI/User_Setups`

View File

@ -7,33 +7,49 @@
#include <TFT_eSPI.h> #include <TFT_eSPI.h>
#include <SPI.h> #include <SPI.h>
#define USERMOD_ST7789_DISPLAY 97 #ifndef USER_SETUP_LOADED
#ifndef ST7789_DRIVER
#ifndef TFT_DISPOFF #error Please define ST7789_DRIVER
#define TFT_DISPOFF 0x28 #endif
#ifndef TFT_WIDTH
#error Please define TFT_WIDTH
#endif
#ifndef TFT_HEIGHT
#error Please define TFT_HEIGHT
#endif
#ifndef TFT_DC
#error Please define TFT_DC
#endif
#ifndef TFT_RST
#error Please define TFT_RST
#endif
#ifndef LOAD_GLCD
#error Please define LOAD_GLCD
#endif
#endif
#ifndef TFT_BL
#define TFT_BL -1
#endif #endif
#ifndef TFT_SLPIN #define USERMOD_ID_ST7789_DISPLAY 97
#define TFT_SLPIN 0x10
#endif
#define TFT_MOSI 21 TFT_eSPI tft = TFT_eSPI(TFT_WIDTH, TFT_HEIGHT); // Invoke custom library
#define TFT_SCLK 22
#define TFT_DC 18
#define TFT_RST 5
#define TFT_BL 26 // Display backlight control pin
TFT_eSPI tft = TFT_eSPI(240, 240); // Invoke custom library // Extra char (+1) for null
#define LINE_BUFFER_SIZE 20
// How often we are redrawing screen // How often we are redrawing screen
#define USER_LOOP_REFRESH_RATE_MS 1000 #define USER_LOOP_REFRESH_RATE_MS 1000
extern int getSignalQuality(int rssi);
//class name. Use something descriptive and leave the ": public Usermod" part :) //class name. Use something descriptive and leave the ": public Usermod" part :)
class St7789DisplayUsermod : public Usermod { class St7789DisplayUsermod : public Usermod {
private: private:
//Private class members. You can declare variables and functions only accessible to your usermod here //Private class members. You can declare variables and functions only accessible to your usermod here
unsigned long lastTime = 0; unsigned long lastTime = 0;
bool enabled = true;
bool displayTurnedOff = false; bool displayTurnedOff = false;
long lastRedraw = 0; long lastRedraw = 0;
@ -45,9 +61,70 @@ class St7789DisplayUsermod : public Usermod {
uint8_t knownBrightness = 0; uint8_t knownBrightness = 0;
uint8_t knownMode = 0; uint8_t knownMode = 0;
uint8_t knownPalette = 0; uint8_t knownPalette = 0;
uint8_t tftcharwidth = 19; // Number of chars that fit on screen with text size set to 2 uint8_t knownEffectSpeed = 0;
uint8_t knownEffectIntensity = 0;
uint8_t knownMinute = 99;
uint8_t knownHour = 99;
const uint8_t tftcharwidth = 19; // Number of chars that fit on screen with text size set to 2
long lastUpdate = 0; long lastUpdate = 0;
void center(String &line, uint8_t width) {
int len = line.length();
if (len<width) for (byte i=(width-len)/2; i>0; i--) line = ' ' + line;
for (byte i=line.length(); i<width; i++) line += ' ';
}
/**
* Display the current date and time in large characters
* on the middle rows. Based 24 or 12 hour depending on
* the useAMPM configuration.
*/
void showTime() {
if (!ntpEnabled) return;
char lineBuffer[LINE_BUFFER_SIZE];
updateLocalTime();
byte minuteCurrent = minute(localTime);
byte hourCurrent = hour(localTime);
//byte secondCurrent = second(localTime);
knownMinute = minuteCurrent;
knownHour = hourCurrent;
byte currentMonth = month(localTime);
sprintf_P(lineBuffer, PSTR("%s %2d "), monthShortStr(currentMonth), day(localTime));
tft.setTextColor(TFT_SILVER);
tft.setCursor(84, 0);
tft.setTextSize(2);
tft.print(lineBuffer);
byte showHour = hourCurrent;
boolean isAM = false;
if (useAMPM) {
if (showHour == 0) {
showHour = 12;
isAM = true;
} else if (showHour > 12) {
showHour -= 12;
isAM = false;
} else {
isAM = true;
}
}
sprintf_P(lineBuffer, PSTR("%2d:%02d"), (useAMPM ? showHour : hourCurrent), minuteCurrent);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(4);
tft.setCursor(60, 24);
tft.print(lineBuffer);
tft.setTextSize(2);
tft.setCursor(186, 24);
//sprintf_P(lineBuffer, PSTR("%02d"), secondCurrent);
if (useAMPM) tft.print(isAM ? "AM" : "PM");
//else tft.print(lineBuffer);
}
public: public:
//Functions called by WLED //Functions called by WLED
@ -57,6 +134,15 @@ class St7789DisplayUsermod : public Usermod {
*/ */
void setup() void setup()
{ {
PinManagerPinType spiPins[] = { { spi_mosi, true }, { spi_miso, false}, { spi_sclk, true } };
if (!pinManager.allocateMultiplePins(spiPins, 3, PinOwner::HW_SPI)) { enabled = false; return; }
PinManagerPinType displayPins[] = { { TFT_CS, true}, { TFT_DC, true}, { TFT_RST, true }, { TFT_BL, true } };
if (!pinManager.allocateMultiplePins(displayPins, sizeof(displayPins)/sizeof(PinManagerPinType), PinOwner::UM_FourLineDisplay)) {
pinManager.deallocateMultiplePins(spiPins, 3, PinOwner::HW_SPI);
enabled = false;
return;
}
tft.init(); tft.init();
tft.setRotation(0); //Rotation here is set up for the text to be readable with the port on the left. Use 1 to flip. tft.setRotation(0); //Rotation here is set up for the text to be readable with the port on the left. Use 1 to flip.
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
@ -65,10 +151,10 @@ class St7789DisplayUsermod : public Usermod {
tft.setTextDatum(MC_DATUM); tft.setTextDatum(MC_DATUM);
tft.setTextSize(2); tft.setTextSize(2);
tft.print("Loading..."); tft.print("Loading...");
if (TFT_BL > 0) if (TFT_BL >= 0)
{ // TFT_BL has been set in the TFT_eSPI library {
pinMode(TFT_BL, OUTPUT); // Set backlight pin to output mode pinMode(TFT_BL, OUTPUT); // Set backlight pin to output mode
digitalWrite(TFT_BL, HIGH); // Turn backlight on. digitalWrite(TFT_BL, HIGH); // Turn backlight on.
} }
} }
@ -91,192 +177,153 @@ class St7789DisplayUsermod : public Usermod {
* Instead, use a timer check as shown here. * Instead, use a timer check as shown here.
*/ */
void loop() { void loop() {
// Check if we time interval for redrawing passes. char buff[LINE_BUFFER_SIZE];
if (millis() - lastUpdate < USER_LOOP_REFRESH_RATE_MS)
// Check if we time interval for redrawing passes.
if (millis() - lastUpdate < USER_LOOP_REFRESH_RATE_MS)
{ {
return; return;
} }
lastUpdate = millis(); lastUpdate = millis();
// Turn off display after 5 minutes with no change. // Turn off display after 5 minutes with no change.
if(!displayTurnedOff && millis() - lastRedraw > 5*60*1000) if (!displayTurnedOff && millis() - lastRedraw > 5*60*1000)
{ {
digitalWrite(TFT_BL, LOW); // Turn backlight off. if (TFT_BL >= 0) digitalWrite(TFT_BL, LOW); // Turn backlight off.
displayTurnedOff = true; displayTurnedOff = true;
} }
// Check if values which are shown on display changed from the last time. // Check if values which are shown on display changed from the last time.
if (((apActive) ? String(apSSID) : WiFi.SSID()) != knownSsid) if ((((apActive) ? String(apSSID) : WiFi.SSID()) != knownSsid) ||
{ (knownIp != (apActive ? IPAddress(4, 3, 2, 1) : Network.localIP())) ||
needRedraw = true; (knownBrightness != bri) ||
} (knownEffectSpeed != strip.getMainSegment().speed) ||
else if (knownIp != (apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP())) (knownEffectIntensity != strip.getMainSegment().intensity) ||
{ (knownMode != strip.getMainSegment().mode) ||
needRedraw = true; (knownPalette != strip.getMainSegment().palette))
}
else if (knownBrightness != bri)
{
needRedraw = true;
}
else if (knownMode != strip.getMode())
{
needRedraw = true;
}
else if (knownPalette != strip.getSegment(0).palette)
{
needRedraw = true;
}
if (!needRedraw)
{
return;
}
needRedraw = false;
if (displayTurnedOff)
{
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); // Turn backlight on.
displayTurnedOff = false;
}
lastRedraw = millis();
// Update last known values.
#if defined(ESP8266)
knownSsid = apActive ? WiFi.softAPSSID() : WiFi.SSID();
#else
knownSsid = WiFi.SSID();
#endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri;
knownMode = strip.getMode();
knownPalette = strip.getSegment(0).palette;
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
// First row with Wifi name
tft.setTextColor(TFT_SILVER);
tft.setCursor(3, 40);
tft.print(knownSsid.substring(0, tftcharwidth > 1 ? tftcharwidth - 1 : 0));
// Print `~` char to indicate that SSID is longer, than our dicplay
if (knownSsid.length() > tftcharwidth)
tft.print("~");
// Second row with AP IP and Password or IP
tft.setTextColor(TFT_GREEN);
tft.setTextSize(2);
tft.setCursor(3, 64);
// Print AP IP and password in AP mode or knownIP if AP not active.
if (apActive)
{
tft.setTextColor(TFT_YELLOW);
tft.print("AP IP: ");
tft.print(knownIp);
tft.setCursor(3,86);
tft.setTextColor(TFT_YELLOW);
tft.print("AP Pass:");
tft.print(apPass);
}
else
{
tft.setTextColor(TFT_GREEN);
tft.print("IP: ");
tft.print(knownIp);
tft.setCursor(3,86);
//tft.print("Signal Strength: ");
//tft.print(i.wifi.signal);
tft.setTextColor(TFT_WHITE);
tft.print("Bri: ");
tft.print(((float(bri)/255)*100),0);
tft.print("%");
}
// Third row with mode name
tft.setCursor(3, 108);
uint8_t qComma = 0;
bool insideQuotes = false;
uint8_t printedChars = 0;
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++)
{
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol)
{ {
case '"': needRedraw = true;
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
tft.setTextColor(TFT_MAGENTA);
tft.print(singleJsonSymbol);
printedChars++;
} }
if ((qComma > knownMode) || (printedChars > tftcharwidth - 1))
break; if (!needRedraw)
}
// Fourth row with palette name
tft.setTextColor(TFT_YELLOW);
tft.setCursor(3, 130);
qComma = 0;
insideQuotes = false;
printedChars = 0;
// Looking for palette name in JSON.
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++)
{
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i);
switch (singleJsonSymbol)
{ {
case '"': return;
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownPalette))
break;
tft.print(singleJsonSymbol);
printedChars++;
} }
// The following is modified from the code from the u8g2/u8g8 based code (knownPalette was knownMode) needRedraw = false;
if ((qComma > knownPalette) || (printedChars > tftcharwidth - 1))
break; if (displayTurnedOff)
} {
// Fifth row with estimated mA usage digitalWrite(TFT_BL, HIGH); // Turn backlight on.
tft.setTextColor(TFT_SILVER); displayTurnedOff = false;
tft.setCursor(3, 152); }
// Print estimated milliamp usage (must specify the LED type in LED prefs for this to be a reasonable estimate). lastRedraw = millis();
tft.print("Current: ");
tft.print(strip.currentMilliamps); // Update last known values.
tft.print("mA"); #if defined(ESP8266)
knownSsid = apActive ? WiFi.softAPSSID() : WiFi.SSID();
#else
knownSsid = WiFi.SSID();
#endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri;
knownMode = strip.getMainSegment().mode;
knownPalette = strip.getMainSegment().palette;
knownEffectSpeed = strip.getMainSegment().speed;
knownEffectIntensity = strip.getMainSegment().intensity;
tft.fillScreen(TFT_BLACK);
showTime();
tft.setTextSize(2);
// Wifi name
tft.setTextColor(TFT_GREEN);
tft.setCursor(0, 60);
String line = knownSsid.substring(0, tftcharwidth-1);
// Print `~` char to indicate that SSID is longer, than our display
if (knownSsid.length() > tftcharwidth) line = line.substring(0, tftcharwidth-1) + '~';
center(line, tftcharwidth);
tft.print(line.c_str());
// Print AP IP and password in AP mode or knownIP if AP not active.
if (apActive)
{
tft.setCursor(0, 84);
tft.print("AP IP: ");
tft.print(knownIp);
tft.setCursor(0,108);
tft.print("AP Pass:");
tft.print(apPass);
}
else
{
tft.setCursor(0, 84);
line = knownIp.toString();
center(line, tftcharwidth);
tft.print(line.c_str());
// percent brightness
tft.setCursor(0, 120);
tft.setTextColor(TFT_WHITE);
tft.print("Bri: ");
tft.print((((int)bri*100)/255));
tft.print("%");
// signal quality
tft.setCursor(124,120);
tft.print("Sig: ");
if (getSignalQuality(WiFi.RSSI()) < 10) {
tft.setTextColor(TFT_RED);
} else if (getSignalQuality(WiFi.RSSI()) < 25) {
tft.setTextColor(TFT_ORANGE);
} else {
tft.setTextColor(TFT_GREEN);
}
tft.print(getSignalQuality(WiFi.RSSI()));
tft.setTextColor(TFT_WHITE);
tft.print("%");
}
// mode name
tft.setTextColor(TFT_CYAN);
tft.setCursor(0, 144);
char lineBuffer[tftcharwidth+1];
extractModeName(knownMode, JSON_mode_names, lineBuffer, tftcharwidth);
tft.print(lineBuffer);
// palette name
tft.setTextColor(TFT_YELLOW);
tft.setCursor(0, 168);
extractModeName(knownPalette, JSON_palette_names, lineBuffer, tftcharwidth);
tft.print(lineBuffer);
tft.setCursor(0, 192);
tft.setTextColor(TFT_SILVER);
sprintf_P(buff, PSTR("FX Spd:%3d Int:%3d"), effectSpeed, effectIntensity);
tft.print(buff);
// Fifth row with estimated mA usage
tft.setTextColor(TFT_SILVER);
tft.setCursor(0, 216);
// Print estimated milliamp usage (must specify the LED type in LED prefs for this to be a reasonable estimate).
tft.print("Current: ");
tft.setTextColor(TFT_ORANGE);
tft.print(strip.currentMilliamps);
tft.print("mA");
} }
/* /*
* addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API. * 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. * 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 * Below it is shown how this could be used for e.g. a light sensor
*/ */
/*
void addToJsonInfo(JsonObject& root) void addToJsonInfo(JsonObject& root)
{ {
int reading = 20;
//this code adds "u":{"Light":[20," lux"]} to the info object
JsonObject user = root["u"]; JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u"); if (user.isNull()) user = root.createNestedObject("u");
JsonArray lightArr = user.createNestedArray("Light"); //name JsonArray lightArr = user.createNestedArray("ST7789"); //name
lightArr.add(reading); //value lightArr.add(enabled?F("installed"):F("disabled")); //unit
lightArr.add(" lux"); //unit
} }
*/
/* /*
@ -295,7 +342,7 @@ class St7789DisplayUsermod : public Usermod {
*/ */
void readFromJsonState(JsonObject& root) void readFromJsonState(JsonObject& root)
{ {
userVar0 = root["user0"] | userVar0; //if "user0" key exists in JSON, update, else keep old value //userVar0 = root["user0"] | userVar0; //if "user0" key exists in JSON, update, else keep old value
//if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!")); //if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!"));
} }
@ -316,11 +363,23 @@ class St7789DisplayUsermod : public Usermod {
*/ */
void addToConfig(JsonObject& root) void addToConfig(JsonObject& root)
{ {
JsonObject top = root.createNestedObject("exampleUsermod"); JsonObject top = root.createNestedObject("ST7789");
top["great"] = userVar0; //save this var persistently whenever settings are saved JsonArray pins = top.createNestedArray("pin");
pins.add(TFT_CS);
pins.add(TFT_DC);
pins.add(TFT_RST);
pins.add(TFT_BL);
//top["great"] = userVar0; //save this var persistently whenever settings are saved
} }
void appendConfigData() {
oappend(SET_F("addInfo('ST7789:pin[]',0,'','SPI CS');"));
oappend(SET_F("addInfo('ST7789:pin[]',1,'','SPI DC');"));
oappend(SET_F("addInfo('ST7789:pin[]',2,'','SPI RST');"));
oappend(SET_F("addInfo('ST7789:pin[]',2,'','SPI BL');"));
}
/* /*
* readFromConfig() can be used to read back the custom settings you added with addToConfig(). * readFromConfig() can be used to read back the custom settings you added with addToConfig().
* This is called by WLED when settings are loaded (currently this only happens once immediately after boot) * This is called by WLED when settings are loaded (currently this only happens once immediately after boot)
@ -329,10 +388,11 @@ class St7789DisplayUsermod : public Usermod {
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup. * but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :) * If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
*/ */
void readFromConfig(JsonObject& root) bool readFromConfig(JsonObject& root)
{ {
JsonObject top = root["top"]; //JsonObject top = root["top"];
userVar0 = top["great"] | 42; //The value right of the pipe "|" is the default value in case your setting was not present in cfg.json (e.g. first boot) //userVar0 = top["great"] | 42; //The value right of the pipe "|" is the default value in case your setting was not present in cfg.json (e.g. first boot)
return true;
} }
@ -342,7 +402,7 @@ class St7789DisplayUsermod : public Usermod {
*/ */
uint16_t getId() uint16_t getId()
{ {
return USERMOD_ST7789_DISPLAY; return USERMOD_ID_ST7789_DISPLAY;
} }
//More methods can be added in the future, this example will then be extended. //More methods can be added in the future, this example will then be extended.

View File

@ -1,39 +0,0 @@
// Setup for the ESP32 board with 1.5" 240x240 display
// See SetupX_Template.h for all options available
#define ST7789_DRIVER
#define TFT_SDA_READ // Display has a bidirectionsl SDA pin
#define TFT_WIDTH 240
#define TFT_HEIGHT 240
#define CGRAM_OFFSET // Library will add offsets required
//#define TFT_MISO -1
#define TFT_MOSI 21
#define TFT_SCLK 22
//#define TFT_CS 5
#define TFT_DC 18
#define TFT_RST 5
#define TFT_BL 26 // Display backlight control pin
#define TFT_BACKLIGHT_ON HIGH // HIGH or LOW are options
#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
#define LOAD_FONT8
#define LOAD_GFXFF
//#define SMOOTH_FONT
//#define SPI_FREQUENCY 27000000
#define SPI_FREQUENCY 40000000 // Maximum for ILI9341
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V

View File

@ -0,0 +1,69 @@
# Si7021 to MQTT (with Home Assistant Auto Discovery) usermod
This usermod implements support for [Si7021 I²C temperature and humidity sensors](https://www.silabs.com/documents/public/data-sheets/Si7021-A20.pdf).
As of this writing, the sensor data will *not* be shown on the WLED UI, but it _is_ published via MQTT to WLED's "built-in" MQTT device topic.
```
temperature: $mqttDeviceTopic/si7021_temperature
humidity: $mqttDeviceTopic/si7021_humidity
```
The following sensors can also be published:
```
heat_index: $mqttDeviceTopic/si7021_heat_index
dew_point: $mqttDeviceTopic/si7021_dew_point
absolute_humidity: $mqttDeviceTopic/si7021_absolute_humidity
```
Sensor data will be updated/sent every 60 seconds.
This usermod also supports Home Assistant Auto Discovery.
## Settings via Usermod Setup
- `enabled`: Enables this usermod
- `Send Dew Point, Abs. Humidity and Heat Index`: Enables additional sensors
- `Home Assistant MQTT Auto-Discovery`: Enables Home Assistant Auto Discovery
# Installation
## Hardware
Attach the Si7021 sensor to the I²C interface.
Default PINs ESP32:
```
SCL_PIN = 22;
SDA_PIN = 21;
```
Default PINs ESP8266:
```
SCL_PIN = 5;
SDA_PIN = 4;
```
## Software
Add to `build_flags` in platformio.ini:
```
-D USERMOD_SI7021_MQTT_HA
```
Add to `lib_deps` in platformio.ini:
```
adafruit/Adafruit Si7021 Library @ 1.4.0
BME280@~3.0.0
```
# Credits
- Aircoookie for making WLED
- Other usermod creators for example code (`sensors_to_mqtt` and `multi_relay` especially)
- You, for reading this

View File

@ -0,0 +1,231 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
// this is remixed from usermod_v2_SensorsToMqtt.h (sensors_to_mqtt usermod)
// and usermod_multi_relay.h (multi_relay usermod)
#include "wled.h"
#include <Adafruit_Si7021.h>
#include <EnvironmentCalculations.h> // EnvironmentCalculations::HeatIndex(), ::DewPoint(), ::AbsoluteHumidity()
Adafruit_Si7021 si7021;
class Si7021_MQTT_HA : public Usermod
{
private:
bool sensorInitialized = false;
bool mqttInitialized = false;
float sensorTemperature = 0;
float sensorHumidity = 0;
float sensorHeatIndex = 0;
float sensorDewPoint = 0;
float sensorAbsoluteHumidity= 0;
String mqttTemperatureTopic = "";
String mqttHumidityTopic = "";
String mqttHeatIndexTopic = "";
String mqttDewPointTopic = "";
String mqttAbsoluteHumidityTopic = "";
unsigned long nextMeasure = 0;
bool enabled = false;
bool haAutoDiscovery = true;
bool sendAdditionalSensors = true;
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _enabled[];
static const char _sendAdditionalSensors[];
static const char _haAutoDiscovery[];
void _initializeSensor()
{
sensorInitialized = si7021.begin();
Serial.printf("Si7021_MQTT_HA: sensorInitialized = %d\n", sensorInitialized);
}
void _initializeMqtt()
{
mqttTemperatureTopic = String(mqttDeviceTopic) + "/si7021_temperature";
mqttHumidityTopic = String(mqttDeviceTopic) + "/si7021_humidity";
mqttHeatIndexTopic = String(mqttDeviceTopic) + "/si7021_heat_index";
mqttDewPointTopic = String(mqttDeviceTopic) + "/si7021_dew_point";
mqttAbsoluteHumidityTopic = String(mqttDeviceTopic) + "/si7021_absolute_humidity";
// Update and publish sensor data
_updateSensorData();
_publishSensorData();
if (haAutoDiscovery) {
_publishHAMqttSensor("temperature", "Temperature", mqttTemperatureTopic, "temperature", "°C");
_publishHAMqttSensor("humidity", "Humidity", mqttHumidityTopic, "humidity", "%");
if (sendAdditionalSensors) {
_publishHAMqttSensor("heat_index", "Heat Index", mqttHeatIndexTopic, "temperature", "°C");
_publishHAMqttSensor("dew_point", "Dew Point", mqttDewPointTopic, "", "°C");
_publishHAMqttSensor("absolute_humidity", "Absolute Humidity", mqttAbsoluteHumidityTopic, "", "g/m³");
}
}
mqttInitialized = true;
}
void _publishHAMqttSensor(
const String &name,
const String &friendly_name,
const String &state_topic,
const String &deviceClass,
const String &unitOfMeasurement)
{
if (WLED_MQTT_CONNECTED) {
String topic = String("homeassistant/sensor/") + mqttClientID + "/" + name + "/config";
StaticJsonDocument<300> doc;
doc["name"] = String(serverDescription) + " " + friendly_name;
doc["state_topic"] = state_topic;
doc["unique_id"] = String(mqttClientID) + name;
if (unitOfMeasurement != "")
doc["unit_of_measurement"] = unitOfMeasurement;
if (deviceClass != "")
doc["device_class"] = deviceClass;
doc["expire_after"] = 1800;
JsonObject device = doc.createNestedObject("device"); // attach the sensor to the same device
device["name"] = String(serverDescription);
device["model"] = "WLED";
device["manufacturer"] = "Aircoookie";
device["identifiers"] = String("wled-") + String(serverDescription);
device["sw_version"] = VERSION;
String payload;
serializeJson(doc, payload);
mqtt->publish(topic.c_str(), 0, true, payload.c_str());
}
}
void _updateSensorData()
{
sensorTemperature = si7021.readTemperature();
sensorHumidity = si7021.readHumidity();
// Serial.print("Si7021_MQTT_HA: Temperature: ");
// Serial.print(sensorTemperature, 2);
// Serial.print("\tHumidity: ");
// Serial.print(sensorHumidity, 2);
if (sendAdditionalSensors) {
EnvironmentCalculations::TempUnit envTempUnit(EnvironmentCalculations::TempUnit_Celsius);
sensorHeatIndex = EnvironmentCalculations::HeatIndex(sensorTemperature, sensorHumidity, envTempUnit);
sensorDewPoint = EnvironmentCalculations::DewPoint(sensorTemperature, sensorHumidity, envTempUnit);
sensorAbsoluteHumidity = EnvironmentCalculations::AbsoluteHumidity(sensorTemperature, sensorHumidity, envTempUnit);
// Serial.print("\tHeat Index: ");
// Serial.print(sensorHeatIndex, 2);
// Serial.print("\tDew Point: ");
// Serial.print(sensorDewPoint, 2);
// Serial.print("\tAbsolute Humidity: ");
// Serial.println(sensorAbsoluteHumidity, 2);
}
// else
// Serial.println("");
}
void _publishSensorData()
{
if (WLED_MQTT_CONNECTED) {
mqtt->publish(mqttTemperatureTopic.c_str(), 0, false, String(sensorTemperature).c_str());
mqtt->publish(mqttHumidityTopic.c_str(), 0, false, String(sensorHumidity).c_str());
if (sendAdditionalSensors) {
mqtt->publish(mqttHeatIndexTopic.c_str(), 0, false, String(sensorHeatIndex).c_str());
mqtt->publish(mqttDewPointTopic.c_str(), 0, false, String(sensorDewPoint).c_str());
mqtt->publish(mqttAbsoluteHumidityTopic.c_str(), 0, false, String(sensorAbsoluteHumidity).c_str());
}
}
}
public:
void addToConfig(JsonObject& root)
{
JsonObject top = root.createNestedObject(FPSTR(_name));
top[FPSTR(_enabled)] = enabled;
top[FPSTR(_sendAdditionalSensors)] = sendAdditionalSensors;
top[FPSTR(_haAutoDiscovery)] = haAutoDiscovery;
}
bool readFromConfig(JsonObject& root)
{
JsonObject top = root[FPSTR(_name)];
bool configComplete = !top.isNull();
configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled);
configComplete &= getJsonValue(top[FPSTR(_sendAdditionalSensors)], sendAdditionalSensors);
configComplete &= getJsonValue(top[FPSTR(_haAutoDiscovery)], haAutoDiscovery);
return configComplete;
}
void onMqttConnect(bool sessionPresent) {
if (mqttDeviceTopic[0] != 0)
_initializeMqtt();
}
void setup()
{
if (enabled) {
Serial.println("Si7021_MQTT_HA: Starting!");
Serial.println("Si7021_MQTT_HA: Initializing sensors.. ");
_initializeSensor();
}
}
// gets called every time WiFi is (re-)connected.
void connected()
{
nextMeasure = millis() + 5000; // Schedule next measure in 5 seconds
}
void loop()
{
yield();
if (!enabled || strip.isUpdating()) return; // !sensorFound ||
unsigned long tempTimer = millis();
if (tempTimer > nextMeasure) {
nextMeasure = tempTimer + 60000; // Schedule next measure in 60 seconds
if (!sensorInitialized) {
Serial.println("Si7021_MQTT_HA: Error! Sensors not initialized in loop()!");
_initializeSensor();
return; // lets try again next loop
}
if (WLED_MQTT_CONNECTED) {
if (!mqttInitialized)
_initializeMqtt();
// Update and publish sensor data
_updateSensorData();
_publishSensorData();
}
else {
Serial.println("Si7021_MQTT_HA: Missing MQTT connection. Not publishing data");
mqttInitialized = false;
}
}
}
uint16_t getId()
{
return USERMOD_ID_SI7021_MQTT_HA;
}
};
// strings to reduce flash memory usage (used more than twice)
const char Si7021_MQTT_HA::_name[] PROGMEM = "Si7021 MQTT (Home Assistant)";
const char Si7021_MQTT_HA::_enabled[] PROGMEM = "enabled";
const char Si7021_MQTT_HA::_sendAdditionalSensors[] PROGMEM = "Send Dew Point, Abs. Humidity and Heat Index";
const char Si7021_MQTT_HA::_haAutoDiscovery[] PROGMEM = "Home Assistant MQTT Auto-Discovery";

View File

@ -1,19 +1,19 @@
# TTGO T-Display ESP32 with 240x135 TFT via SPI with TFT_eSPI # TTGO T-Display ESP32 with 240x135 TFT via SPI with TFT_eSPI
This usermod allows use of the TTGO T-Display ESP32 module with integrated 240x135 display This usermod enables use of the TTGO 240x135 T-Display ESP32 module
for controlling WLED and showing the following information: for controlling WLED and showing the following information:
* Current SSID * Current SSID
* IP address if obtained * IP address, if obtained
* If connected to a network, current brightness % is shown * If connected to a network, current brightness percentage is shown
* in AP mode AP IP and password are shown * In AP mode, AP, IP and password are shown
* Current effect * Current effect
* Current palette * Current palette
* Estimated current in mA is shown (NOTE: for this to be a reasonable value, the correct LED type must be specified in the LED Prefs section) * Estimated current in mA (NOTE: for this to be a reasonable value, the correct LED type must be specified in the LED Prefs section)
Button pin is mapped to the onboard button next to the side actuated reset button of the TTGO T-Display board. Button pin is mapped to the onboard button adjacent to the reset button of the TTGO T-Display board.
I have designed a 3D printed case around this board and an ["ElectroCookie"](https://amzn.to/2WCNeeA) project board, a [level shifter](https://amzn.to/3hbKu18), a [buck regulator](https://amzn.to/3mLMy0W), and a DC [power jack](https://amzn.to/3phj9NZ). I use 12V WS2815 LED strips for my projects, and power them with 12V power supplies, so the regulator drops the voltage to the 5V level I need to power the ESP module and the level shifter. If there is any interest in this case, which elevates the board and display on some custom extended headers to make place the screen at the top of the enclosure (with accessible buttons), let me know, and I could post the STL files. It is a bit tricky to get the height correct, so I also designed a one-time use 3D printed solder fixture to set the board in the right location and at the correct height for the housing. (It is one-time use because it has to be cut off after soldering to be able to remove it). I didn't think the effort to make it in multiple pieces was worthwhile. I have designed a 3D printed case around this board and an ["ElectroCookie"](https://amzn.to/2WCNeeA) project board, a [level shifter](https://amzn.to/3hbKu18), a [buck regulator](https://amzn.to/3mLMy0W), and a DC [power jack](https://amzn.to/3phj9NZ). I use 12V WS2815 LED strips for my projects, and power them with 12V power supplies. The regulator supplies 5V for the ESP module and the level shifter. If there is any interest in this case which elevates the board and display on custom extended standoffs to place the screen at the top of the enclosure (with accessible buttons), let me know, and I will post the STL files. It is a bit tricky to get the height correct, so I also designed a one-time use 3D printed solder fixture to set the board in the right location and at the correct height for the housing. (It is one-time use because it has to be cut off after soldering to be able to remove it). I didn't think the effort to make it in multiple pieces was worthwhile.
Usermod based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED repo. Based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED repo.
## Hardware ## Hardware
![Hardware](assets/ttgo_hardware1.png) ![Hardware](assets/ttgo_hardware1.png)
@ -30,8 +30,8 @@ Usermod based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED rep
Functionality checked with: Functionality checked with:
* TTGO T-Display * TTGO T-Display
* PlatformIO * PlatformIO
* Group of 4 individual Neopixels from Adafruit, and a several full strings of 12v WS2815 LEDs. * Group of 4 individual Neopixels from Adafruit and several full strings of 12v WS2815 LEDs.
* The hardware design shown above should be limited to shorter strings. For larger strings, I use a different setup with a dedicated 12v power supply and power them directly off the supply (in addition to dropping the 12v supply down to 5v with a buck regulator for the ESP module and level shifter). * The hardware design shown above should be limited to shorter strings. For larger strings, I use a different setup with a dedicated 12v power supply and power them directly from said supply (in addition to dropping the 12v to 5v with a buck regulator for the ESP module and level shifter).
## Setup Needed: ## Setup Needed:
* As with all usermods, copy the usermod.cpp file from the TTGO-T-Display usermod folder to the wled00 folder (replacing the default usermod.cpp file). * As with all usermods, copy the usermod.cpp file from the TTGO-T-Display usermod folder to the wled00 folder (replacing the default usermod.cpp file).
@ -51,24 +51,24 @@ lib_deps =
... ...
``` ```
Also, while in the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: In the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows:
Comment out the line described below: Comment out the line described below:
```ini ```ini
# Travis CI binaries (comment this out when building for single board) # Release binaries
; default_envs = travis_esp8266, esp01, esp01_1m_ota, travis_esp32 ; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s2_saola, esp32c3
``` ```
and UNCOMMENT the following line in the 'Single binaries' section: and uncomment the following line in the 'Single binaries' section:
```ini ```ini
default_envs = esp32dev default_envs = esp32dev
``` ```
Save the `platformio.ini` file. Once this is saved, the required library files should be automatically downloaded for modifications in a later step. Save the `platformio.ini` file. Once saved, the required library files should be automatically downloaded for modifications in a later step.
### Platformio_overrides.ini (added) ### Platformio_overrides.ini (added)
Copy the `platformio_overrides.ini` file which is contained in the `usermods/TTGO-T-Display/` folder into the root of your project folder. This file contains an override that remaps the button pin of WLED to use the on-board button to the right of the USB-C connector (when viewed with the port oriented downward - see hardware photo). Copy the `platformio_overrides.ini` file which is contained in the `usermods/TTGO-T-Display/` folder into the root of your project folder. This file contains an override that remaps the button pin of WLED to use the on-board button to the right of the USB-C connector (when viewed with the port oriented downward - see hardware photo).
### TFT_eSPI Library Adjustments (board selection) ### TFT_eSPI Library Adjustments (board selection)
We need to modify a file in the `TFT_eSPI` library to select the correct board. If you followed the directions to modify and save the `platformio.ini` file above, the `User_Setup_Select.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI_ID1559` folder. You need to modify a file in the `TFT_eSPI` library to select the correct board. If you followed the directions to modify and save the `platformio.ini` file above, the `User_Setup_Select.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI_ID1559` folder.
Modify the `User_Setup_Select.h` file as follows: Modify the `User_Setup_Select.h` file as follows:
* Comment out the following line (which is the 'default' setup file): * Comment out the following line (which is the 'default' setup file):
@ -80,12 +80,12 @@ Modify the `User_Setup_Select.h` file as follows:
#include <User_Setups/Setup25_TTGO_T_Display.h> // Setup file for ESP32 and TTGO T-Display ST7789V SPI bus TFT #include <User_Setups/Setup25_TTGO_T_Display.h> // Setup file for ESP32 and TTGO T-Display ST7789V SPI bus TFT
``` ```
Run the build and it should complete correctly. If you see a failure like this: Build the file. If you see a failure like this:
```ini ```ini
xtensa-esp32-elf-g++: error: wled00\wled00.ino.cpp: No such file or directory xtensa-esp32-elf-g++: error: wled00\wled00.ino.cpp: No such file or directory
xtensa-esp32-elf-g++: fatal error: no input files xtensa-esp32-elf-g++: fatal error: no input files
``` ```
Just try building again - I find that sometimes this happens on the first build attempt and subsequent attempts will build correctly. try building again. Sometimes this happens on the first build attempt and subsequent attempts build correctly.
## Arduino IDE ## Arduino IDE
- UNTESTED - UNTESTED

View File

@ -110,9 +110,9 @@ void userLoop() {
needRedraw = true; needRedraw = true;
} else if (knownBrightness != bri) { } else if (knownBrightness != bri) {
needRedraw = true; needRedraw = true;
} else if (knownMode != strip.getMode()) { } else if (knownMode != strip.getMainSegment().mode) {
needRedraw = true; needRedraw = true;
} else if (knownPalette != strip.getSegment(0).palette) { } else if (knownPalette != strip.getMainSegment().palette) {
needRedraw = true; needRedraw = true;
} }
@ -136,8 +136,8 @@ void userLoop() {
#endif #endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri; knownBrightness = bri;
knownMode = strip.getMode(); knownMode = strip.getMainSegment().mode;
knownPalette = strip.getSegment(0).palette; knownPalette = strip.getMainSegment().palette;
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextSize(2); tft.setTextSize(2);
@ -177,58 +177,15 @@ void userLoop() {
// Third row with mode name // Third row with mode name
tft.setCursor(1, 68); tft.setCursor(1, 68);
uint8_t qComma = 0; char lineBuffer[tftcharwidth+1];
bool insideQuotes = false; extractModeName(knownMode, JSON_mode_names, lineBuffer, tftcharwidth);
uint8_t printedChars = 0; tft.print(lineBuffer);
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
tft.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > tftcharwidth - 1))
break;
}
// Fourth row with palette name // Fourth row with palette name
tft.setCursor(1, 90); tft.setCursor(1, 90);
qComma = 0; extractModeName(knownPalette, JSON_palette_names, lineBuffer, tftcharwidth);
insideQuotes = false; tft.print(lineBuffer);
printedChars = 0;
// Looking for palette name in JSON.
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownPalette))
break;
tft.print(singleJsonSymbol);
printedChars++;
}
// The following is modified from the code from the u8g2/u8g8 based code (knownPalette was knownMode)
if ((qComma > knownPalette) || (printedChars > tftcharwidth - 1))
break;
}
// Fifth row with estimated mA usage // Fifth row with estimated mA usage
tft.setCursor(1, 112); tft.setCursor(1, 112);
// Print estimated milliamp usage (must specify the LED type in LED prefs for this to be a reasonable estimate). // Print estimated milliamp usage (must specify the LED type in LED prefs for this to be a reasonable estimate).

View File

@ -1,13 +1,12 @@
; Options ; Options
; ------- ; -------
; USERMOD_DALLASTEMPERATURE - define this to have this user mod included wled00\usermods_list.cpp ; USERMOD_DALLASTEMPERATURE - define this to have this user mod included wled00\usermods_list.cpp
; USERMOD_DALLASTEMPERATURE_CELSIUS - define this to report temperatures in degrees celsius, otherwise fahrenheit will be reported
; USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds ; USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds
; USERMOD_DALLASTEMPERATURE_FIRST_MEASUREMENT_AT - the number of milliseconds after boot to take first measurement, defaults to 20 seconds
; ;
[env:d1_mini_usermod_dallas_temperature_C] [env:d1_mini_usermod_dallas_temperature_C]
extends = env:d1_mini extends = env:d1_mini
build_flags = ${common.build_flags_esp8266} -D USERMOD_DALLASTEMPERATURE -D USERMOD_DALLASTEMPERATURE_CELSIUS build_flags = ${common.build_flags_esp8266} -D USERMOD_DALLASTEMPERATURE
lib_deps = ${env.lib_deps} lib_deps = ${env.lib_deps}
milesburton/DallasTemperature@^3.9.0 paulstoffregen/OneWire@~2.3.7
OneWire@~2.3.5 # you may want to use following with ESP32
; https://github.com/blazoncek/OneWire.git # fixes Sensor error on ESP32

View File

@ -1,22 +1,24 @@
# Temperature usermod # Temperature usermod
Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` by srg74 and 400killer! Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` usermod by srg74 and 400killer!
This usermod will read from an attached DS18B20 temperature sensor (as available on the QuinLED Dig-Uno) Reads an attached DS18B20 temperature sensor (as available on the QuinLED Dig-Uno)
The temperature is displayed both in the Info section of the web UI as well as published to the `/temperature` MQTT topic if enabled. Temperature is displayed in both the Info section of the web UI as well as published to the `/temperature` MQTT topic, if enabled.
This usermod may be expanded with support for different sensor types in the future. May be expanded with support for different sensor types in the future.
If temperature sensor is not detected during boot, this usermod will be disabled. If temperature sensor is not detected during boot, this usermod will be disabled.
Maintained by @blazoncek
## Installation ## Installation
Copy the example `platformio_override.ini` to the root directory. This file should be placed in the same directory as `platformio.ini`. Copy the example `platformio_override.ini` to the root directory. This file should be placed in the same directory as `platformio.ini`.
### Define Your Options ### Define Your Options
* `USERMOD_DALLASTEMPERATURE` - define this to have this user mod included wled00\usermods_list.cpp * `USERMOD_DALLASTEMPERATURE` - enables this user mod wled00/usermods_list.cpp
* `USERMOD_DALLASTEMPERATURE_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 20 seconds * `USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL` - number of milliseconds between measurements, defaults to 60000 ms (60s)
All parameters can be configured at runtime using Usermods settings page, including pin, selection to display temerature in degrees Celsius or Farenheit mand measurement interval. All parameters can be configured at runtime via the Usermods settings page, including pin, temperature in degrees Celsius or Farenheit and measurement interval.
## Project link ## Project link
@ -27,7 +29,6 @@ All parameters can be configured at runtime using Usermods settings page, includ
If you are using `platformio_override.ini`, you should be able to refresh the task list and see your custom task, for example `env:d1_mini_usermod_dallas_temperature_C`. If you are using `platformio_override.ini`, you should be able to refresh the task list and see your custom task, for example `env:d1_mini_usermod_dallas_temperature_C`.
If you are not using `platformio_override.ini`, you might have to uncomment `OneWire@~2.3.5 under` `[common]` section in `platformio.ini`: If you are not using `platformio_override.ini`, you might have to uncomment `OneWire@~2.3.5 under` `[common]` section in `platformio.ini`:
```ini ```ini
@ -43,16 +44,20 @@ default_envs = d1_mini
lib_deps = lib_deps =
... ...
#For Dallas sensor uncomment following line #For Dallas sensor uncomment following line
OneWire@~2.3.5 OneWire@~2.3.7
... # ... or you may want to use following with ESP32
; https://github.com/blazoncek/OneWire.git # fixes Sensor error on ESP32...
``` ```
## Change Log ## Change Log
2020-09-12 2020-09-12
* Changed to use async, non-blocking implementation * Changed to use async non-blocking implementation
* Do not report low temperatures that indicate an error to mqtt * Do not report erroneous low temperatures to MQTT
* Disable plugin if temperature sensor not detected * Disable plugin if temperature sensor not detected
* Report the number of seconds until the first read in the info screen instead of sensor error * Report the number of seconds until the first read in the info screen instead of sensor error
2021-04 2021-04
* Adaptation for runtime configuration. * Adaptation for runtime configuration.
2023-05
* Rewrite to conform to newer recommendations.
* Recommended @blazoncek fork of OneWire for ESP32 to avoid Sensor error

View File

@ -29,6 +29,7 @@ class UsermodTemperature : public Usermod {
bool degC = true; bool degC = true;
// using parasite power on the sensor // using parasite power on the sensor
bool parasite = false; bool parasite = false;
int8_t parasitePin = -1;
// how often do we read from sensor? // how often do we read from sensor?
unsigned long readingInterval = USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL; unsigned long readingInterval = USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL;
// set last reading as "40 sec before boot", so first reading is taken after 20 sec // set last reading as "40 sec before boot", so first reading is taken after 20 sec
@ -37,267 +38,395 @@ class UsermodTemperature : public Usermod {
// used to determine when we can read the sensors temperature // used to determine when we can read the sensors temperature
// we have to wait at least 93.75 ms after requestTemperatures() is called // we have to wait at least 93.75 ms after requestTemperatures() is called
unsigned long lastTemperaturesRequest; unsigned long lastTemperaturesRequest;
float temperature = -100; // default to -100, DS18B20 only goes down to -50C float temperature;
// indicates requestTemperatures has been called but the sensor measurement is not complete // indicates requestTemperatures has been called but the sensor measurement is not complete
bool waitingForConversion = false; bool waitingForConversion = false;
// flag set at startup if DS18B20 sensor not found, avoids trying to keep getting // flag set at startup if DS18B20 sensor not found, avoids trying to keep getting
// temperature if flashed to a board without a sensor attached // temperature if flashed to a board without a sensor attached
bool sensorFound = false; byte sensorFound;
bool enabled = true; bool enabled = true;
bool HApublished = false;
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
static const char _name[]; static const char _name[];
static const char _enabled[]; static const char _enabled[];
static const char _readInterval[]; static const char _readInterval[];
static const char _parasite[]; static const char _parasite[];
static const char _parasitePin[];
//Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013 //Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013
float readDallas() { float readDallas();
byte i; void requestTemperatures();
byte data[2]; void readTemperature();
int16_t result; // raw data from sensor bool findSensor();
if (!oneWire->reset()) return -127.0f; // send reset command and fail fast #ifndef WLED_DISABLE_MQTT
oneWire->skip(); // skip ROM void publishHomeAssistantAutodiscovery();
oneWire->write(0xBE); // read (temperature) from EEPROM #endif
for (i=0; i < 2; i++) data[i] = oneWire->read(); // first 2 bytes contain temperature
for (i=2; i < 8; i++) oneWire->read(); // read unused bytes
result = (data[1]<<4) | (data[0]>>4); // we only need whole part, we will add fraction when returning
if (data[1]&0x80) result |= 0xFF00; // fix negative value
oneWire->reset();
oneWire->skip(); // skip ROM
oneWire->write(0x44,parasite); // request new temperature reading (without parasite power)
return (float)result + ((data[0]&0x0008) ? 0.5f : 0.0f);
}
void requestTemperatures() {
readDallas();
lastTemperaturesRequest = millis();
waitingForConversion = true;
DEBUG_PRINTLN(F("Requested temperature."));
}
void readTemperature() {
temperature = readDallas();
lastMeasurement = millis();
waitingForConversion = false;
//DEBUG_PRINTF("Read temperature %2.1f.\n", temperature); // does not work properly on 8266
DEBUG_PRINT(F("Read temperature "));
DEBUG_PRINTLN(temperature);
}
bool findSensor() {
DEBUG_PRINTLN(F("Searching for sensor..."));
uint8_t deviceAddress[8] = {0,0,0,0,0,0,0,0};
// find out if we have DS18xxx sensor attached
oneWire->reset_search();
delay(10);
while (oneWire->search(deviceAddress)) {
DEBUG_PRINTLN(F("Found something..."));
if (oneWire->crc8(deviceAddress, 7) == deviceAddress[7]) {
switch (deviceAddress[0]) {
case 0x10: // DS18S20
case 0x22: // DS18B20
case 0x28: // DS1822
case 0x3B: // DS1825
case 0x42: // DS28EA00
DEBUG_PRINTLN(F("Sensor found."));
return true;
}
}
}
return false;
}
public: public:
void setup() {
int retries = 10;
if (enabled) {
// config says we are enabled
DEBUG_PRINTLN(F("Allocating temperature pin..."));
// pin retrieved from cfg.json (readFromConfig()) prior to running setup()
if (temperaturePin >= 0 && pinManager.allocatePin(temperaturePin, true, PinOwner::UM_Temperature)) {
oneWire = new OneWire(temperaturePin);
if (!oneWire->reset()) {
sensorFound = false; // resetting 1-Wire bus yielded an error
} else {
while ((sensorFound=findSensor()) && retries--) {
delay(25); // try to find sensor
}
}
} else {
if (temperaturePin >= 0) {
DEBUG_PRINTLN(F("Temperature pin allocation failed."));
}
temperaturePin = -1; // allocation failed
sensorFound = false;
}
}
lastMeasurement = millis() - readingInterval + 10000;
initDone = true;
}
void loop() {
if (!enabled || strip.isUpdating()) return;
unsigned long now = millis();
// check to see if we are due for taking a measurement
// lastMeasurement will not be updated until the conversion
// is complete the the reading is finished
if (now - lastMeasurement < readingInterval) return;
// we are due for a measurement, if we are not already waiting
// for a conversion to complete, then make a new request for temps
if (!waitingForConversion) {
requestTemperatures();
return;
}
// we were waiting for a conversion to complete, have we waited log enough?
if (now - lastTemperaturesRequest >= 100 /* 93.75ms per the datasheet but can be up to 750ms */) {
readTemperature();
if (WLED_MQTT_CONNECTED) {
char subuf[64];
strcpy(subuf, mqttDeviceTopic);
if (-100 <= temperature) {
// dont publish super low temperature as the graph will get messed up
// the DallasTemperature library returns -127C or -196.6F when problem
// reading the sensor
strcat_P(subuf, PSTR("/temperature"));
mqtt->publish(subuf, 0, false, String(temperature).c_str());
strcat_P(subuf, PSTR("_f"));
mqtt->publish(subuf, 0, false, String((float)temperature * 1.8f + 32).c_str());
} else {
// publish something else to indicate status?
}
}
}
}
/* /*
* API calls te enable data exchange between WLED modules * API calls te enable data exchange between WLED modules
*/ */
inline float getTemperatureC() { inline float getTemperatureC() { return temperature; }
return (float)temperature; inline float getTemperatureF() { return temperature * 1.8f + 32.0f; }
float getTemperature();
const char *getTemperatureUnit();
uint16_t getId() { return USERMOD_ID_TEMPERATURE; }
void setup();
void loop();
//void connected();
#ifndef WLED_DISABLE_MQTT
void onMqttConnect(bool sessionPresent);
#endif
//void onUpdateBegin(bool init);
//bool handleButton(uint8_t b);
//void handleOverlayDraw();
void addToJsonInfo(JsonObject& root);
//void addToJsonState(JsonObject &root);
//void readFromJsonState(JsonObject &root);
void addToConfig(JsonObject &root);
bool readFromConfig(JsonObject &root);
void appendConfigData();
};
//Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013
float UsermodTemperature::readDallas() {
byte data[9];
int16_t result; // raw data from sensor
float retVal = -127.0f;
if (oneWire->reset()) { // if reset() fails there are no OneWire devices
oneWire->skip(); // skip ROM
oneWire->write(0xBE); // read (temperature) from EEPROM
oneWire->read_bytes(data, 9); // first 2 bytes contain temperature
#ifdef WLED_DEBUG
if (OneWire::crc8(data,8) != data[8]) {
DEBUG_PRINTLN(F("CRC error reading temperature."));
for (byte i=0; i < 9; i++) DEBUG_PRINTF("0x%02X ", data[i]);
DEBUG_PRINT(F(" => "));
DEBUG_PRINTF("0x%02X\n", OneWire::crc8(data,8));
} }
inline float getTemperatureF() { #endif
return (float)temperature * 1.8f + 32; switch(sensorFound) {
case 0x10: // DS18S20 has 9-bit precision
result = (data[1] << 8) | data[0];
retVal = float(result) * 0.5f;
break;
case 0x22: // DS18B20
case 0x28: // DS1822
case 0x3B: // DS1825
case 0x42: // DS28EA00
result = (data[1]<<4) | (data[0]>>4); // we only need whole part, we will add fraction when returning
if (data[1] & 0x80) result |= 0xF000; // fix negative value
retVal = float(result) + ((data[0] & 0x08) ? 0.5f : 0.0f);
break;
} }
}
for (byte i=1; i<9; i++) data[0] &= data[i];
return data[0]==0xFF ? -127.0f : retVal;
}
/* void UsermodTemperature::requestTemperatures() {
* addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API. DEBUG_PRINTLN(F("Requesting temperature."));
* Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI. oneWire->reset();
* Below it is shown how this could be used for e.g. a light sensor oneWire->skip(); // skip ROM
*/ oneWire->write(0x44,parasite); // request new temperature reading
void addToJsonInfo(JsonObject& root) { if (parasite && parasitePin >=0 ) digitalWrite(parasitePin, HIGH); // has to happen within 10us (open MOSFET)
// dont add temperature to info if we are disabled lastTemperaturesRequest = millis();
if (!enabled) return; waitingForConversion = true;
}
JsonObject user = root["u"]; void UsermodTemperature::readTemperature() {
if (user.isNull()) user = root.createNestedObject("u"); if (parasite && parasitePin >=0 ) digitalWrite(parasitePin, LOW); // deactivate power (close MOSFET)
temperature = readDallas();
lastMeasurement = millis();
waitingForConversion = false;
//DEBUG_PRINTF("Read temperature %2.1f.\n", temperature); // does not work properly on 8266
DEBUG_PRINT(F("Read temperature "));
DEBUG_PRINTLN(temperature);
}
JsonArray temp = user.createNestedArray(FPSTR(_name)); bool UsermodTemperature::findSensor() {
//temp.add(F("Loaded.")); DEBUG_PRINTLN(F("Searching for sensor..."));
uint8_t deviceAddress[8] = {0,0,0,0,0,0,0,0};
if (temperature <= -100.0 || (!sensorFound && temperature == -1.0)) { // find out if we have DS18xxx sensor attached
temp.add(0); oneWire->reset_search();
temp.add(F(" Sensor Error!")); delay(10);
return; while (oneWire->search(deviceAddress)) {
DEBUG_PRINTLN(F("Found something..."));
if (oneWire->crc8(deviceAddress, 7) == deviceAddress[7]) {
switch (deviceAddress[0]) {
case 0x10: // DS18S20
case 0x22: // DS18B20
case 0x28: // DS1822
case 0x3B: // DS1825
case 0x42: // DS28EA00
DEBUG_PRINTLN(F("Sensor found."));
sensorFound = deviceAddress[0];
DEBUG_PRINTF("0x%02X\n", sensorFound);
return true;
} }
temp.add(degC ? temperature : (float)temperature * 1.8f + 32);
if (degC) temp.add(F("°C"));
else temp.add(F("°F"));
} }
}
DEBUG_PRINTLN(F("Sensor NOT found."));
return false;
}
/** #ifndef WLED_DISABLE_MQTT
* addToJsonState() can be used to add custom entries to the /json/state part of the JSON API (state object). void UsermodTemperature::publishHomeAssistantAutodiscovery() {
* Values in the state object may be modified by connected clients if (!WLED_MQTT_CONNECTED) return;
*/
//void addToJsonState(JsonObject &root)
//{
//}
/** char json_str[1024], buf[128];
* readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object). size_t payload_size;
* Values in the state object may be modified by connected clients StaticJsonDocument<1024> json;
* Read "<usermodname>_<usermodparam>" from json state and and change settings (i.e. GPIO pin) used.
*/
//void readFromJsonState(JsonObject &root) {
// if (!initDone) return; // prevent crash on boot applyPreset()
//}
/** sprintf_P(buf, PSTR("%s Temperature"), serverDescription);
* addToConfig() (called from set.cpp) stores persistent properties to cfg.json json[F("name")] = buf;
*/ strcpy(buf, mqttDeviceTopic);
void addToConfig(JsonObject &root) { strcat_P(buf, PSTR("/temperature"));
// we add JSON object: {"Temperature": {"pin": 0, "degC": true}} json[F("state_topic")] = buf;
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname json[F("device_class")] = F("temperature");
top[FPSTR(_enabled)] = enabled; json[F("unique_id")] = escapedMac.c_str();
top["pin"] = temperaturePin; // usermodparam json[F("unit_of_measurement")] = F("°C");
top["degC"] = degC; // usermodparam payload_size = serializeJson(json, json_str);
top[FPSTR(_readInterval)] = readingInterval / 1000;
top[FPSTR(_parasite)] = parasite;
DEBUG_PRINTLN(F("Temperature config saved."));
}
/** sprintf_P(buf, PSTR("homeassistant/sensor/%s/config"), escapedMac.c_str());
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json mqtt->publish(buf, 0, true, json_str, payload_size);
* HApublished = true;
* The function should return true if configuration was successfully loaded or false if there was no configuration. }
*/ #endif
bool readFromConfig(JsonObject &root) {
// we look for JSON object: {"Temperature": {"pin": 0, "degC": true}}
int8_t newTemperaturePin = temperaturePin;
JsonObject top = root[FPSTR(_name)]; void UsermodTemperature::setup() {
if (top.isNull()) { int retries = 10;
DEBUG_PRINT(FPSTR(_name)); sensorFound = 0;
DEBUG_PRINTLN(F(": No config found. (Using defaults.)")); temperature = -127.0f; // default to -127, DS18B20 only goes down to -50C
return false; if (enabled) {
} // config says we are enabled
DEBUG_PRINTLN(F("Allocating temperature pin..."));
enabled = top[FPSTR(_enabled)] | enabled; // pin retrieved from cfg.json (readFromConfig()) prior to running setup()
newTemperaturePin = top["pin"] | newTemperaturePin; if (temperaturePin >= 0 && pinManager.allocatePin(temperaturePin, true, PinOwner::UM_Temperature)) {
// newTemperaturePin = min(33,max(-1,(int)newTemperaturePin)); // bounds check oneWire = new OneWire(temperaturePin);
degC = top["degC"] | degC; if (oneWire->reset()) {
readingInterval = top[FPSTR(_readInterval)] | readingInterval/1000; while (!findSensor() && retries--) {
readingInterval = min(120,max(10,(int)readingInterval)) * 1000; // convert to ms delay(25); // try to find sensor
parasite = top[FPSTR(_parasite)] | parasite;
DEBUG_PRINT(FPSTR(_name));
if (!initDone) {
// first run: reading from cfg.json
temperaturePin = newTemperaturePin;
DEBUG_PRINTLN(F(" config loaded."));
} else {
DEBUG_PRINTLN(F(" config (re)loaded."));
// changing paramters from settings page
if (newTemperaturePin != temperaturePin) {
DEBUG_PRINTLN(F("Re-init temperature."));
// deallocate pin and release memory
delete oneWire;
pinManager.deallocatePin(temperaturePin, PinOwner::UM_Temperature);
temperaturePin = newTemperaturePin;
// initialise
setup();
} }
} }
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features if (parasite && pinManager.allocatePin(parasitePin, true, PinOwner::UM_Temperature)) {
return !top[FPSTR(_parasite)].isNull(); pinMode(parasitePin, OUTPUT);
digitalWrite(parasitePin, LOW); // deactivate power (close MOSFET)
} else {
parasitePin = -1;
}
} else {
if (temperaturePin >= 0) {
DEBUG_PRINTLN(F("Temperature pin allocation failed."));
}
temperaturePin = -1; // allocation failed
} }
}
lastMeasurement = millis() - readingInterval + 10000;
initDone = true;
}
uint16_t getId() void UsermodTemperature::loop() {
{ if (!enabled || !sensorFound || strip.isUpdating()) return;
return USERMOD_ID_TEMPERATURE;
static uint8_t errorCount = 0;
unsigned long now = millis();
// check to see if we are due for taking a measurement
// lastMeasurement will not be updated until the conversion
// is complete the the reading is finished
if (now - lastMeasurement < readingInterval) return;
// we are due for a measurement, if we are not already waiting
// for a conversion to complete, then make a new request for temps
if (!waitingForConversion) {
requestTemperatures();
return;
}
// we were waiting for a conversion to complete, have we waited log enough?
if (now - lastTemperaturesRequest >= 750 /* 93.75ms per the datasheet but can be up to 750ms */) {
readTemperature();
if (getTemperatureC() < -100.0f) {
if (++errorCount > 10) sensorFound = 0;
lastMeasurement = now - readingInterval + 300; // force new measurement in 300ms
return;
} }
}; errorCount = 0;
#ifndef WLED_DISABLE_MQTT
if (WLED_MQTT_CONNECTED) {
char subuf[64];
strcpy(subuf, mqttDeviceTopic);
if (temperature > -100.0f) {
// dont publish super low temperature as the graph will get messed up
// the DallasTemperature library returns -127C or -196.6F when problem
// reading the sensor
strcat_P(subuf, PSTR("/temperature"));
mqtt->publish(subuf, 0, false, String(getTemperatureC()).c_str());
strcat_P(subuf, PSTR("_f"));
mqtt->publish(subuf, 0, false, String(getTemperatureF()).c_str());
} else {
// publish something else to indicate status?
}
}
#endif
}
}
/**
* connected() is called every time the WiFi is (re)connected
* Use it to initialize network interfaces
*/
//void UsermodTemperature::connected() {}
#ifndef WLED_DISABLE_MQTT
/**
* subscribe to MQTT topic if needed
*/
void UsermodTemperature::onMqttConnect(bool sessionPresent) {
//(re)subscribe to required topics
//char subuf[64];
if (mqttDeviceTopic[0] != 0) {
publishHomeAssistantAutodiscovery();
}
}
#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
*/
void UsermodTemperature::addToJsonInfo(JsonObject& root) {
// dont add temperature to info if we are disabled
if (!enabled) return;
JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u");
JsonArray temp = user.createNestedArray(FPSTR(_name));
if (temperature <= -100.0f) {
temp.add(0);
temp.add(F(" Sensor Error!"));
return;
}
temp.add(getTemperature());
temp.add(getTemperatureUnit());
JsonObject sensor = root[F("sensor")];
if (sensor.isNull()) sensor = root.createNestedObject(F("sensor"));
temp = sensor.createNestedArray(F("temperature"));
temp.add(getTemperature());
temp.add(getTemperatureUnit());
}
/**
* 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 UsermodTemperature::addToJsonState(JsonObject &root)
//{
//}
/**
* 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
* Read "<usermodname>_<usermodparam>" from json state and and change settings (i.e. GPIO pin) used.
*/
//void UsermodTemperature::readFromJsonState(JsonObject &root) {
// if (!initDone) return; // prevent crash on boot applyPreset()
//}
/**
* addToConfig() (called from set.cpp) stores persistent properties to cfg.json
*/
void UsermodTemperature::addToConfig(JsonObject &root) {
// we add JSON object: {"Temperature": {"pin": 0, "degC": true}}
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
top[FPSTR(_enabled)] = enabled;
top["pin"] = temperaturePin; // usermodparam
top["degC"] = degC; // usermodparam
top[FPSTR(_readInterval)] = readingInterval / 1000;
top[FPSTR(_parasite)] = parasite;
top[FPSTR(_parasitePin)] = parasitePin;
DEBUG_PRINTLN(F("Temperature config saved."));
}
/**
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
*
* The function should return true if configuration was successfully loaded or false if there was no configuration.
*/
bool UsermodTemperature::readFromConfig(JsonObject &root) {
// we look for JSON object: {"Temperature": {"pin": 0, "degC": true}}
int8_t newTemperaturePin = temperaturePin;
DEBUG_PRINT(FPSTR(_name));
JsonObject top = root[FPSTR(_name)];
if (top.isNull()) {
DEBUG_PRINTLN(F(": No config found. (Using defaults.)"));
return false;
}
enabled = top[FPSTR(_enabled)] | enabled;
newTemperaturePin = top["pin"] | newTemperaturePin;
degC = top["degC"] | degC;
readingInterval = top[FPSTR(_readInterval)] | readingInterval/1000;
readingInterval = min(120,max(10,(int)readingInterval)) * 1000; // convert to ms
parasite = top[FPSTR(_parasite)] | parasite;
parasitePin = top[FPSTR(_parasitePin)] | parasitePin;
if (!initDone) {
// first run: reading from cfg.json
temperaturePin = newTemperaturePin;
DEBUG_PRINTLN(F(" config loaded."));
} else {
DEBUG_PRINTLN(F(" config (re)loaded."));
// changing paramters from settings page
if (newTemperaturePin != temperaturePin) {
DEBUG_PRINTLN(F("Re-init temperature."));
// deallocate pin and release memory
delete oneWire;
pinManager.deallocatePin(temperaturePin, PinOwner::UM_Temperature);
temperaturePin = newTemperaturePin;
pinManager.deallocatePin(parasitePin, PinOwner::UM_Temperature);
// initialise
setup();
}
}
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return !top[FPSTR(_parasitePin)].isNull();
}
void UsermodTemperature::appendConfigData() {
oappend(SET_F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F(":")); oappend(String(FPSTR(_parasite)).c_str());
oappend(SET_F("',1,'<i>(if no Vcc connected)</i>');")); // 0 is field type, 1 is actual field
oappend(SET_F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F(":")); oappend(String(FPSTR(_parasitePin)).c_str());
oappend(SET_F("',1,'<i>(for external MOSFET)</i>');")); // 0 is field type, 1 is actual field
}
float UsermodTemperature::getTemperature() {
return degC ? getTemperatureC() : getTemperatureF();
}
const char *UsermodTemperature::getTemperatureUnit() {
return degC ? "°C" : "°F";
}
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
const char UsermodTemperature::_name[] PROGMEM = "Temperature"; const char UsermodTemperature::_name[] PROGMEM = "Temperature";
const char UsermodTemperature::_enabled[] PROGMEM = "enabled"; const char UsermodTemperature::_enabled[] PROGMEM = "enabled";
const char UsermodTemperature::_readInterval[] PROGMEM = "read-interval-s"; const char UsermodTemperature::_readInterval[] PROGMEM = "read-interval-s";
const char UsermodTemperature::_parasite[] PROGMEM = "parasite-pwr"; const char UsermodTemperature::_parasite[] PROGMEM = "parasite-pwr";
const char UsermodTemperature::_parasitePin[] PROGMEM = "parasite-pwr-pin";

View File

@ -1,31 +0,0 @@
#include "wled.h"
/*
* Register your v2 usermods here!
*/
/*
* Add/uncomment your usermod filename here (and once more below)
* || || ||
* \/ \/ \/
*/
//#include "usermod_v2_example.h"
#ifdef USERMOD_DALLASTEMPERATURE
#include "../usermods/Temperature/usermod_temperature.h"
#endif
//#include "usermod_v2_empty.h"
void registerUsermods()
{
/*
* Add your usermod class name here
* || || ||
* \/ \/ \/
*/
//usermods.add(new MyExampleUsermod());
#ifdef USERMOD_DALLASTEMPERATURE
usermods.add(new UsermodTemperature());
#endif
//usermods.add(new UsermodRenameMe());
}

View File

@ -1,15 +0,0 @@
WLED v2 UserMod for running macros at sunrise and sunset.
At the time of this text, this user mod requires code to be changed to set certain variables:
1. To reflect the user's graphical location (latitude/longitude) used for calculating apparent sunrise/sunset
2. To specify which macros will be run at sunrise and/or sunset. (defaults to 15 at sunrise and 16 at sunset)
3. To optionally provide an offset from sunrise/sunset, in minutes (max of +/- 2 hours), when the macro will be run.
In addition, WLED must be configured to get time from NTP (and the time must be retrieved via NTP.)
Please open the UserMod_SunRiseAndSet.h file for instructions on what needs to be changed, where to copy files, etc.
If this usermod proves useful enough, the code might eventually be updated to allow prompting for the required information
via the web interface and to store settings in EEPROM instead of hard-coding in the .h file.
This usermod has only been tested on the esp32dev platform, but there's no reason it wouldn't work on other platforms.

View File

@ -1,166 +0,0 @@
#pragma once
#include "wled.h"
#include <Dusk2Dawn.h>
/*
*
* REQUIREMENTS:
* The Dusk2Dawn library must be installed. This can be found at https://github.com/dmkishi/Dusk2Dawn. The 1.0.1 version of this library found via
* Arduino or platformio library managers is buggy and won't compile. The latest version from github should be used.
*
* NTP must be enabled and functional. It simply makes no sense to have events on sunrise/sunset when an accurate time isn't available.
*
* The user's geographical latitude and longitude must be configured (in decimal, not degrees/minutes/etc) using m_fLatitude and m_fLongitude
*
* if desired, an offset of up to +/- 2 hours can be specified for each of sunrise/sunset using m_sunriseOffset and m_sunsetOffset (defaults to 0)
*
* The specific macro to run at sunrise and/or sunset can be changed using m_sunriseMacro and m_sunsetMacro. (defaults to 15 and 16)
*
* From the Dusk2Dawn library:
* HINT: An easy way to find the longitude and latitude for any location is
* to find the spot in Google Maps, right click the place on the map, and
* select "What's here?". At the bottom, youll see a card with the
* coordinates.
*
* Once configured, copy UserMod_SunRiseAndSet.h to the sketch file (the same folder as wled00.ino exists),
* and then edit "usermods_list.cpp":
* Add '#include "UserMod_SunRiseAndSet.h"' in the 'includes' area
* Add 'usermods.add(new UserMod_SunRiseAndSet());' in the registerUsermods() area
*
*/
class UserMod_SunRiseAndSet : public Usermod
{
private:
/**** USER SETTINGS ****/
float m_fLatitude = 40.6; // latitude where sunrise/set are calculated
float m_fLongitude = -79.80; // longitude where sunrise/set are calculated
int8_t m_sunriseOffset = 0; // offset from sunrise, in minutes, when macro should be run (negative for before sunrise, positive for after sunrise)
int8_t m_sunsetOffset = 0; // offset from sunset, in minutes, when macro should be run (negative for before sunset, positive for after sunset)
uint8_t m_sunriseMacro = 15; // macro number to run at sunrise
uint8_t m_sunsetMacro = 16; // macro number to run at sunset
/**** END OF USER SETTINGS. DO NOT EDIT BELOW THIS LINE! ****/
Dusk2Dawn *m_pD2D = NULL; // this must be dynamically allocated in order for parameters to be loaded from EEPROM
int m_nUserSunrise = -1; // time, in minutes from midnight, of sunrise
int m_nUserSunset = -1; // time, in minutes from midnight, of sunset
byte m_nLastRunMinute = -1; // indicates what minute the userloop was last run - used so that the code only runs once per minute
public:
virtual void setup(void)
{
/* TODO: From EEPROM, load the following variables:
*
* int16_t latitude16 = 4060; // user provided latitude, multiplied by 100 and rounded
* int16_t longitude16 = -7980; // user provided longitude, multiplied by 100 and rounded.
* int8_t sunrise_offset = 0; // number of minutes to offset the sunrise macro trigger (positive for minutes after sunrise, negative for minutes before)
* int8_t sunset_offset = 0; // number of minutes to offset the sunset macro trigger (positive for minutes after sunset, negative for minutes before)
*
* then:
* m_fLatitude = (float)latitude / 100.0;
* m_fLongitude = (float)longitude / 100.0;
* m_sunriseOffset = sunrise_offset;
* m_sunsetOffset = sunset_offset;
*/
if ((0.0 != m_fLatitude) || (0.0 != m_fLongitude))
{
m_pD2D = new Dusk2Dawn (m_fLatitude, m_fLongitude, 0 /* UTC */);
// can't really check for failures. if the alloc fails, the mod just doesn't work.
}
}
void loop(void)
{
// without NTP, or a configured lat/long, none of this stuff is going to work...
// As an alternative, need to figure out how to determine if the user has manually set the clock or not.
if (m_pD2D && (999000000L != ntpLastSyncTime))
{
// to prevent needing to import all the timezone stuff from other modules, work completely in UTC
time_t timeUTC = toki.second();
tmElements_t tmNow;
breakTime(timeUTC, tmNow);
int nCurMinute = tmNow.Minute;
if (m_nLastRunMinute != nCurMinute) //only check once a new minute begins
{
m_nLastRunMinute = nCurMinute;
int numMinutes = (60 * tmNow.Hour) + m_nLastRunMinute; // how many minutes into the day are we?
// check to see if sunrise/sunset should be re-determined. Only do this if neither sunrise nor sunset
// are set. That happens when the device has just stated, and after both sunrise/sunset have already run.
if ((-1 == m_nUserSunrise) && (-1 == m_nUserSunset))
{
m_nUserSunrise = m_pD2D->sunrise(tmNow.Year + 1970, tmNow.Month, tmNow.Day, false) % 1440;
m_nUserSunset = m_pD2D->sunset(tmNow.Year + 1970, tmNow.Month, tmNow.Day, false) % 1440;
if (m_nUserSunrise > numMinutes) // has sunrise already passed? if so, recompute for tomorrow
{
breakTime(timeUTC + (60*60*24), tmNow);
m_nUserSunrise = m_pD2D->sunrise(tmNow.Year + 1970, tmNow.Month, tmNow.Day, false) % 1440;
if (m_nUserSunset > numMinutes) // if sunset has also passed, recompute that as well
{
m_nUserSunset = m_pD2D->sunset(tmNow.Year + 1970, tmNow.Month, tmNow.Day, false) % 1440;
}
}
// offset by user provided values. becuase the offsets are signed bytes, the max offset is just over 2 hours.
m_nUserSunrise += m_sunriseOffset;
m_nUserSunset += m_sunsetOffset;
}
if (numMinutes == m_nUserSunrise) // Good Morning!
{
if (m_sunriseMacro)
applyMacro(m_sunriseMacro); // run macro 15
m_nUserSunrise = -1;
}
else if (numMinutes == m_nUserSunset) // Good Night!
{
if (m_sunsetMacro)
applyMacro(m_sunsetMacro); // run macro 16
m_nUserSunset = -1;
}
} // if (m_nLastRunMinute != nCurMinute)
} // if (m_pD2D && (999000000L != ntpLastSyncTime))
}
void addToJsonState(JsonObject& root)
{
JsonObject user = root["SunRiseAndSet"];
if (user.isNull()) user = root.createNestedObject("SunRiseAndSet");
char buf[10];
if (-1 != m_nUserSunrise)
{
snprintf(buf, 10, "%02d:%02d UTC", m_nUserSunrise / 60, m_nUserSunrise % 60);
user["rise"] = buf;
}
if (-1 != m_nUserSunset)
{
snprintf(buf, 10, "%02d:%02d UTC", m_nUserSunset / 60, m_nUserSunset % 60);
user["set"] = buf;
}
JsonObject vars = user.createNestedObject("vars");
vars["lat"] = m_fLatitude;
vars["long"] = m_fLongitude;
vars["rise_mac"] = m_sunriseMacro;
vars["set_mac"] = m_sunsetMacro;
vars["rise_off"] = m_sunriseOffset;
vars["set_off"] = m_sunsetOffset;
}
~UserMod_SunRiseAndSet(void)
{
if (m_pD2D) delete m_pD2D;
}
};

View File

@ -1,17 +1,16 @@
# Description # Description
That usermod implements support of simple hand gestures with VL53L0X sensor: on/off and brightness correction. Implements support of simple hand gestures via a VL53L0X sensor: on/off and brightness adjustment.
It can be useful for kitchen strips to avoid any touches. Useful for controlling strips when you want to avoid touching anything.
- on/off - just swipe a hand below your sensor ("shortPressAction" is called and can be customized through WLED macros) - on/off - swipe your hand below the sensor ("shortPressAction" is called. Can be customized via WLED macros)
- brightness correction - keep your hand below sensor for 1 second to switch to "brightness" mode. - brightness adjustment - hold your hand below the sensor for 1 second to switch to "brightness" mode.
Configure brightness by changing distance to the sensor (see parameters below for customization). adjust the brightness by changing the distance between your hand and the sensor (see parameters below for customization).
"macroLongPress" is also called here.
## Installation ## Installation
1. Attach VL53L0X sensor to i2c pins according to default pins for your board. 1. Attach VL53L0X sensor to i2c pins according to default pins for your board.
2. Add `-D USERMOD_VL53L0X_GESTURES` to your build flags at platformio.ini (plaformio_override.ini) for needed environment. 2. Add `-D USERMOD_VL53L0X_GESTURES` to your build flags at platformio.ini (plaformio_override.ini) for needed environment.
In my case, for example: `build_flags = ${common.build_flags_esp8266} -D RLYPIN=12 -D USERMOD_VL53L0X_GESTURES` In my case, for example: `build_flags = ${env.build_flags} -D USERMOD_VL53L0X_GESTURES`
3. Add "pololu/VL53L0X" dependency below to `lib_deps` like this: 3. Add "pololu/VL53L0X" dependency below to `lib_deps` like this:
```ini ```ini
lib_deps = ${env.lib_deps} lib_deps = ${env.lib_deps}
@ -21,15 +20,10 @@ lib_deps = ${env.lib_deps}
My entire `platformio_override.ini` for example (for nodemcu board): My entire `platformio_override.ini` for example (for nodemcu board):
```ini ```ini
[platformio] [platformio]
default_envs = nodemcu default_envs = nodemcuv2
[env:nodemcu] [env:nodemcuv2]
board = nodemcu build_flags = ${env.build_flags} -D USERMOD_VL53L0X_GESTURES
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 RLYPIN=12 -D USERMOD_VL53L0X_GESTURES
lib_deps = ${env.lib_deps} lib_deps = ${env.lib_deps}
pololu/VL53L0X @ ^1.3.0 pololu/VL53L0X @ ^1.3.0
``` ```

View File

@ -3,14 +3,13 @@
* It can be useful for kitchen strips to avoid any touches. * It can be useful for kitchen strips to avoid any touches.
* - on/off - just swipe a hand below your sensor ("shortPressAction" is called and can be customized through WLED macros) * - on/off - just swipe a hand below your sensor ("shortPressAction" is called and can be customized through WLED macros)
* - brightness correction - keep your hand below sensor for 1 second to switch to "brightness" mode. * - brightness correction - keep your hand below sensor for 1 second to switch to "brightness" mode.
* Configure brightness by changing distance to the sensor (see parameters below for customization). Configure brightness by changing distance to the sensor (see parameters below for customization).
* "macroLongPress" is also called here.
* *
* Enabling this mod usermod: * Enabling this usermod:
* 1. Attach VL53L0X sensor to i2c pins according to default pins for your board. * 1. Attach VL53L0X sensor to i2c pins according to default pins for your board.
* 2. Add "-D USERMOD_VL53L0X_GESTURES" to your build flags at platformio.ini (plaformio_override.ini) for needed environment. * 2. Add `-D USERMOD_VL53L0X_GESTURES` to your build flags at platformio.ini (plaformio_override.ini) for needed environment.
* In my case, for example: build_flags = ${common.build_flags_esp8266} -D RLYPIN=12 -D USERMOD_VL53L0X_GESTURES * In my case, for example: `build_flags = ${env.build_flags} -D USERMOD_VL53L0X_GESTURES`
* 3. Add "pololu/VL53L0X" dependency to lib_deps like this: * 3. Add "pololu/VL53L0X" dependency below to `lib_deps` like this:
* lib_deps = ${env.lib_deps} * lib_deps = ${env.lib_deps}
* pololu/VL53L0X @ ^1.3.0 * pololu/VL53L0X @ ^1.3.0
*/ */
@ -22,11 +21,11 @@
#include <VL53L0X.h> #include <VL53L0X.h>
#ifndef VL53L0X_MAX_RANGE_MM #ifndef VL53L0X_MAX_RANGE_MM
#define VL53L0X_MAX_RANGE_MM 230 // max height in millimiters to react for motions #define VL53L0X_MAX_RANGE_MM 230 // max height in millimeters to react for motions
#endif #endif
#ifndef VL53L0X_MIN_RANGE_OFFSET #ifndef VL53L0X_MIN_RANGE_OFFSET
#define VL53L0X_MIN_RANGE_OFFSET 60 // minimal range in millimiters that sensor can detect. Used in long motions to correct brightnes calculation. #define VL53L0X_MIN_RANGE_OFFSET 60 // minimal range in millimeters that sensor can detect. Used in long motions to correct brightness calculation.
#endif #endif
#ifndef VL53L0X_DELAY_MS #ifndef VL53L0X_DELAY_MS
@ -34,7 +33,7 @@
#endif #endif
#ifndef VL53L0X_LONG_MOTION_DELAY_MS #ifndef VL53L0X_LONG_MOTION_DELAY_MS
#define VL53L0X_LONG_MOTION_DELAY_MS 1000 // how often to get data from sensor #define VL53L0X_LONG_MOTION_DELAY_MS 1000 // switch onto "long motion" action after this delay
#endif #endif
class UsermodVL53L0XGestures : public Usermod { class UsermodVL53L0XGestures : public Usermod {
@ -42,6 +41,7 @@ class UsermodVL53L0XGestures : public Usermod {
//Private class members. You can declare variables and functions only accessible to your usermod here //Private class members. You can declare variables and functions only accessible to your usermod here
unsigned long lastTime = 0; unsigned long lastTime = 0;
VL53L0X sensor; VL53L0X sensor;
bool enabled = true;
bool wasMotionBefore = false; bool wasMotionBefore = false;
bool isLongMotion = false; bool isLongMotion = false;
@ -50,7 +50,7 @@ class UsermodVL53L0XGestures : public Usermod {
public: public:
void setup() { void setup() {
Wire.begin(); if (i2c_scl<0 || i2c_sda<0) { enabled = false; return; }
sensor.setTimeout(150); sensor.setTimeout(150);
if (!sensor.init()) if (!sensor.init())
@ -63,45 +63,40 @@ class UsermodVL53L0XGestures : public Usermod {
void loop() { void loop() {
if (!enabled || strip.isUpdating()) return;
if (millis() - lastTime > VL53L0X_DELAY_MS) if (millis() - lastTime > VL53L0X_DELAY_MS)
{ {
lastTime = millis(); lastTime = millis();
int range = sensor.readRangeSingleMillimeters(); int range = sensor.readRangeSingleMillimeters();
DEBUG_PRINTF(F("range: %d, brightness: %d"), range, bri); DEBUG_PRINTF("range: %d, brightness: %d\r\n", range, bri);
if (range < VL53L0X_MAX_RANGE_MM) if (range < VL53L0X_MAX_RANGE_MM)
{ {
if (!wasMotionBefore) if (!wasMotionBefore)
{ {
motionStartTime = millis(); motionStartTime = millis();
DEBUG_PRINTF(F("motionStartTime: %d"), motionStartTime); DEBUG_PRINTF("motionStartTime: %d\r\n", motionStartTime);
} }
wasMotionBefore = true; wasMotionBefore = true;
if (millis() - motionStartTime > VL53L0X_LONG_MOTION_DELAY_MS) //long motion if (millis() - motionStartTime > VL53L0X_LONG_MOTION_DELAY_MS) //long motion
{ {
DEBUG_PRINTF(F("long motion: %d"), motionStartTime); DEBUG_PRINTF("long motion: %d\r\n", motionStartTime);
if (!isLongMotion) if (!isLongMotion)
{ {
if (macroLongPress)
{
applyMacro(macroLongPress);
}
isLongMotion = true; isLongMotion = true;
} }
// set brightness according to range // set brightness according to range
bri = (VL53L0X_MAX_RANGE_MM - max(range, VL53L0X_MIN_RANGE_OFFSET)) * 255 / (VL53L0X_MAX_RANGE_MM - VL53L0X_MIN_RANGE_OFFSET); bri = (VL53L0X_MAX_RANGE_MM - max(range, VL53L0X_MIN_RANGE_OFFSET)) * 255 / (VL53L0X_MAX_RANGE_MM - VL53L0X_MIN_RANGE_OFFSET);
DEBUG_PRINTF(F("new brightness: %d"), bri); DEBUG_PRINTF("new brightness: %d", bri);
colorUpdated(1); stateUpdated(1);
} }
} else if (wasMotionBefore) { //released } else if (wasMotionBefore) { //released
long dur = millis() - motionStartTime;
if (!isLongMotion) if (!isLongMotion)
{ //short press { //short press
DEBUG_PRINTF(F("shortPressAction...")); DEBUG_PRINTLN(F("shortPressAction..."));
shortPressAction(); shortPressAction();
} }
wasMotionBefore = false; wasMotionBefore = false;
@ -110,6 +105,19 @@ class UsermodVL53L0XGestures : public Usermod {
} }
} }
/*
* 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)
* I highly recommend checking out the basics of ArduinoJson serialization and deserialization in order to use custom settings!
*/
// void addToConfig(JsonObject& root)
// {
// JsonObject top = root.createNestedObject("VL53L0x");
// JsonArray pins = top.createNestedArray("pin");
// pins.add(i2c_scl);
// pins.add(i2c_sda);
// }
/* /*
* getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!). * 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. * This could be used in the future for the system to determine whether your usermod is installed.

View File

@ -9,10 +9,10 @@
## Features ## Features
- SSD1306 128x32 or 128x64 I2C OLED display - SSD1306 128x32 or 128x64 I2C OLED display
- On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect) - On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect)
- Auto display shutoff for saving display lifetime - Auto display shutoff for extending display lifetime
- Dallas temperature sensor - Dallas temperature sensor
- Reporting temperature to MQTT broker - Reporting temperature to MQTT broker
- Relay for energy saving - Relay for saving energy
## Hardware ## Hardware
![Shield](https://github.com/srg74/WLED-wemos-shield/blob/master/resources/Images/Assembly_8.jpg) ![Shield](https://github.com/srg74/WLED-wemos-shield/blob/master/resources/Images/Assembly_8.jpg)

View File

@ -101,6 +101,7 @@ void userLoop() {
if (temptimer - lastMeasure > 60000) if (temptimer - lastMeasure > 60000)
{ {
lastMeasure = temptimer; lastMeasure = temptimer;
#ifndef WLED_DISABLE_MQTT
//Check if MQTT Connected, otherwise it will crash the 8266 //Check if MQTT Connected, otherwise it will crash the 8266
if (mqtt != nullptr) if (mqtt != nullptr)
{ {
@ -116,6 +117,7 @@ void userLoop() {
t += "/temperature"; t += "/temperature";
mqtt->publish(t.c_str(), 0, true, String(board_temperature).c_str()); mqtt->publish(t.c_str(), 0, true, String(board_temperature).c_str());
} }
#endif
} }
// Check if we time interval for redrawing passes. // Check if we time interval for redrawing passes.
@ -137,9 +139,9 @@ void userLoop() {
needRedraw = true; needRedraw = true;
} else if (knownBrightness != bri) { } else if (knownBrightness != bri) {
needRedraw = true; needRedraw = true;
} else if (knownMode != strip.getMode()) { } else if (knownMode != strip.getMainSegment().mode) {
needRedraw = true; needRedraw = true;
} else if (knownPalette != strip.getSegment(0).palette) { } else if (knownPalette != strip.getMainSegment().palette) {
needRedraw = true; needRedraw = true;
} }
@ -163,8 +165,8 @@ void userLoop() {
#endif #endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri; knownBrightness = bri;
knownMode = strip.getMode(); knownMode = strip.getMainSegment().mode;
knownPalette = strip.getSegment(0).palette; knownPalette = strip.getMainSegment().palette;
u8x8.clear(); u8x8.clear();
u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.setFont(u8x8_font_chroma48medium8_r);
@ -185,58 +187,14 @@ void userLoop() {
// Third row with mode name // Third row with mode name
u8x8.setCursor(2, 2); u8x8.setCursor(2, 2);
uint8_t qComma = 0; char lineBuffer[17];
bool insideQuotes = false; extractModeName(knownMode, JSON_mode_names, lineBuffer, 16);
uint8_t printedChars = 0; u8x8.print(lineBuffer);
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
// Fourth row with palette name // Fourth row with palette name
u8x8.setCursor(2, 3); u8x8.setCursor(2, 3);
qComma = 0; extractModeName(knownPalette, JSON_palette_names, lineBuffer, 16);
insideQuotes = false; u8x8.print(lineBuffer);
printedChars = 0;
// Looking for palette name in JSON.
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownPalette))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
u8x8.setFont(u8x8_font_open_iconic_embedded_1x1); u8x8.setFont(u8x8_font_open_iconic_embedded_1x1);
u8x8.drawGlyph(0, 0, 80); // wifi icon u8x8.drawGlyph(0, 0, 80); // wifi icon

View File

@ -103,6 +103,7 @@ void userLoop() {
{ {
lastMeasure = tempTimer; lastMeasure = tempTimer;
#ifndef WLED_DISABLE_MQTT
// Check if MQTT Connected, otherwise it will crash the 8266 // Check if MQTT Connected, otherwise it will crash the 8266
if (mqtt != nullptr) if (mqtt != nullptr)
{ {
@ -122,6 +123,7 @@ void userLoop() {
h += "/humidity"; h += "/humidity";
mqtt->publish(h.c_str(), 0, true, String(board_humidity).c_str()); mqtt->publish(h.c_str(), 0, true, String(board_humidity).c_str());
} }
#endif
} }
// Check if we time interval for redrawing passes. // Check if we time interval for redrawing passes.
@ -143,9 +145,9 @@ void userLoop() {
needRedraw = true; needRedraw = true;
} else if (knownBrightness != bri) { } else if (knownBrightness != bri) {
needRedraw = true; needRedraw = true;
} else if (knownMode != strip.getMode()) { } else if (knownMode != strip.getMainSegment().mode) {
needRedraw = true; needRedraw = true;
} else if (knownPalette != strip.getSegment(0).palette) { } else if (knownPalette != strip.getMainSegment().palette) {
needRedraw = true; needRedraw = true;
} }
@ -169,8 +171,8 @@ void userLoop() {
#endif #endif
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP();
knownBrightness = bri; knownBrightness = bri;
knownMode = strip.getMode(); knownMode = strip.getMainSegment().mode;
knownPalette = strip.getSegment(0).palette; knownPalette = strip.getMainSegment().palette;
u8x8.clear(); u8x8.clear();
u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.setFont(u8x8_font_chroma48medium8_r);
@ -191,58 +193,14 @@ void userLoop() {
// Third row with mode name // Third row with mode name
u8x8.setCursor(2, 2); u8x8.setCursor(2, 2);
uint8_t qComma = 0; char lineBuffer[17];
bool insideQuotes = false; extractModeName(knownMode, JSON_mode_names, lineBuffer, 16);
uint8_t printedChars = 0; u8x8.print(lineBuffer);
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
// Fourth row with palette name // Fourth row with palette name
u8x8.setCursor(2, 3); u8x8.setCursor(2, 3);
qComma = 0; extractModeName(knownPalette, JSON_palette_names, lineBuffer, 16);
insideQuotes = false; u8x8.print(lineBuffer);
printedChars = 0;
// Looking for palette name in JSON.
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++) {
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i);
switch (singleJsonSymbol) {
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownPalette))
break;
u8x8.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2))
break;
}
u8x8.setFont(u8x8_font_open_iconic_embedded_1x1); u8x8.setFont(u8x8_font_open_iconic_embedded_1x1);
u8x8.drawGlyph(0, 0, 80); // wifi icon u8x8.drawGlyph(0, 0, 80); // wifi icon

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,773 @@
#pragma once
#ifdef ARDUINO_ARCH_ESP32
#include "wled.h"
#include <driver/i2s.h>
#include <driver/adc.h>
#include <soc/i2s_reg.h> // needed for SPH0465 timing workaround (classic ESP32)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
#include <driver/adc_deprecated.h>
#include <driver/adc_types_deprecated.h>
#endif
// type of i2s_config_t.SampleRate was changed from "int" to "unsigned" in IDF 4.4.x
#define SRate_t uint32_t
#else
#define SRate_t int
#endif
//#include <driver/i2s_std.h>
//#include <driver/i2s_pdm.h>
//#include <driver/i2s_tdm.h>
//#include <driver/gpio.h>
// see https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/chip-series-comparison.html#related-documents
// and https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/i2s.html#overview-of-all-modes
#if defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(ESP8266) || defined(ESP8265)
// there are two things in these MCUs that could lead to problems with audio processing:
// * no floating point hardware (FPU) support - FFT uses float calculations. If done in software, a strong slow-down can be expected (between 8x and 20x)
// * single core, so FFT task might slow down other things like LED updates
#if !defined(SOC_I2S_NUM) || (SOC_I2S_NUM < 1)
#error This audio reactive usermod does not support ESP32-C2 or ESP32-C3.
#else
#warning This audio reactive usermod does not support ESP32-C2 and ESP32-C3.
#endif
#endif
/* ToDo: remove. ES7243 is controlled via compiler defines
Until this configuration is moved to the webinterface
*/
// if you have problems to get your microphone work on the left channel, uncomment the following line
//#define I2S_USE_RIGHT_CHANNEL // (experimental) define this to use right channel (digital mics only)
// Uncomment the line below to utilize ADC1 _exclusively_ for I2S sound input.
// benefit: analog mic inputs will be sampled contiously -> better response times and less "glitches"
// WARNING: this option WILL lock-up your device in case that any other analogRead() operation is performed;
// for example if you want to read "analog buttons"
//#define I2S_GRAB_ADC1_COMPLETELY // (experimental) continously sample analog ADC microphone. WARNING will cause analogRead() lock-up
// data type requested from the I2S driver - currently we always use 32bit
//#define I2S_USE_16BIT_SAMPLES // (experimental) define this to request 16bit - more efficient but possibly less compatible
#ifdef I2S_USE_16BIT_SAMPLES
#define I2S_SAMPLE_RESOLUTION I2S_BITS_PER_SAMPLE_16BIT
#define I2S_datatype int16_t
#define I2S_unsigned_datatype uint16_t
#define I2S_data_size I2S_BITS_PER_CHAN_16BIT
#undef I2S_SAMPLE_DOWNSCALE_TO_16BIT
#else
#define I2S_SAMPLE_RESOLUTION I2S_BITS_PER_SAMPLE_32BIT
//#define I2S_SAMPLE_RESOLUTION I2S_BITS_PER_SAMPLE_24BIT
#define I2S_datatype int32_t
#define I2S_unsigned_datatype uint32_t
#define I2S_data_size I2S_BITS_PER_CHAN_32BIT
#define I2S_SAMPLE_DOWNSCALE_TO_16BIT
#endif
/* There are several (confusing) options in IDF 4.4.x:
* I2S_CHANNEL_FMT_RIGHT_LEFT, I2S_CHANNEL_FMT_ALL_RIGHT and I2S_CHANNEL_FMT_ALL_LEFT stands for stereo mode, which means two channels will transport different data.
* I2S_CHANNEL_FMT_ONLY_RIGHT and I2S_CHANNEL_FMT_ONLY_LEFT they are mono mode, both channels will only transport same data.
* I2S_CHANNEL_FMT_MULTIPLE means TDM channels, up to 16 channel will available, and they are stereo as default.
* if you want to receive two channels, one is the actual data from microphone and another channel is suppose to receive 0, it's different data in two channels, you need to choose I2S_CHANNEL_FMT_RIGHT_LEFT in this case.
*/
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) && (ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(4, 4, 4))
// espressif bug: only_left has no sound, left and right are swapped
// https://github.com/espressif/esp-idf/issues/9635 I2S mic not working since 4.4 (IDFGH-8138)
// https://github.com/espressif/esp-idf/issues/8538 I2S channel selection issue? (IDFGH-6918)
// https://github.com/espressif/esp-idf/issues/6625 I2S: left/right channels are swapped for read (IDFGH-4826)
#ifdef I2S_USE_RIGHT_CHANNEL
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_LEFT
#define I2S_MIC_CHANNEL_TEXT "right channel only (work-around swapped channel bug in IDF 4.4)."
#define I2S_PDM_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_RIGHT
#define I2S_PDM_MIC_CHANNEL_TEXT "right channel only"
#else
//#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ALL_LEFT
//#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_RIGHT_LEFT
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_RIGHT
#define I2S_MIC_CHANNEL_TEXT "left channel only (work-around swapped channel bug in IDF 4.4)."
#define I2S_PDM_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_LEFT
#define I2S_PDM_MIC_CHANNEL_TEXT "left channel only."
#endif
#else
// not swapped
#ifdef I2S_USE_RIGHT_CHANNEL
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_RIGHT
#define I2S_MIC_CHANNEL_TEXT "right channel only."
#else
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_LEFT
#define I2S_MIC_CHANNEL_TEXT "left channel only."
#endif
#define I2S_PDM_MIC_CHANNEL I2S_MIC_CHANNEL
#define I2S_PDM_MIC_CHANNEL_TEXT I2S_MIC_CHANNEL_TEXT
#endif
/* Interface class
AudioSource serves as base class for all microphone types
This enables accessing all microphones with one single interface
which simplifies the caller code
*/
class AudioSource {
public:
/* All public methods are virtual, so they can be overridden
Everything but the destructor is also removed, to make sure each mic
Implementation provides its version of this function
*/
virtual ~AudioSource() {};
/* Initialize
This function needs to take care of anything that needs to be done
before samples can be obtained from the microphone.
*/
virtual void initialize(int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE) = 0;
/* Deinitialize
Release all resources and deactivate any functionality that is used
by this microphone
*/
virtual void deinitialize() = 0;
/* getSamples
Read num_samples from the microphone, and store them in the provided
buffer
*/
virtual void getSamples(float *buffer, uint16_t num_samples) = 0;
/* check if the audio source driver was initialized successfully */
virtual bool isInitialized(void) {return(_initialized);}
/* identify Audiosource type - I2S-ADC or I2S-digital */
typedef enum{Type_unknown=0, Type_I2SAdc=1, Type_I2SDigital=2} AudioSourceType;
virtual AudioSourceType getType(void) {return(Type_I2SDigital);} // default is "I2S digital source" - ADC type overrides this method
protected:
/* Post-process audio sample - currently on needed for I2SAdcSource*/
virtual I2S_datatype postProcessSample(I2S_datatype sample_in) {return(sample_in);} // default method can be overriden by instances (ADC) that need sample postprocessing
// Private constructor, to make sure it is not callable except from derived classes
AudioSource(SRate_t sampleRate, int blockSize, float sampleScale) :
_sampleRate(sampleRate),
_blockSize(blockSize),
_initialized(false),
_sampleScale(sampleScale)
{};
SRate_t _sampleRate; // Microphone sampling rate
int _blockSize; // I2S block size
bool _initialized; // Gets set to true if initialization is successful
float _sampleScale; // pre-scaling factor for I2S samples
};
/* Basic I2S microphone source
All functions are marked virtual, so derived classes can replace them
*/
class I2SSource : public AudioSource {
public:
I2SSource(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f) :
AudioSource(sampleRate, blockSize, sampleScale) {
_config = {
.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX),
.sample_rate = _sampleRate,
.bits_per_sample = I2S_SAMPLE_RESOLUTION,
.channel_format = I2S_MIC_CHANNEL,
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
//.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2,
.dma_buf_count = 8,
.dma_buf_len = _blockSize,
.use_apll = 0,
.bits_per_chan = I2S_data_size,
#else
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 8,
.dma_buf_len = _blockSize,
.use_apll = false
#endif
};
}
virtual void initialize(int8_t i2swsPin = I2S_PIN_NO_CHANGE, int8_t i2ssdPin = I2S_PIN_NO_CHANGE, int8_t i2sckPin = I2S_PIN_NO_CHANGE, int8_t mclkPin = I2S_PIN_NO_CHANGE) {
DEBUGSR_PRINTLN("I2SSource:: initialize().");
if (i2swsPin != I2S_PIN_NO_CHANGE && i2ssdPin != I2S_PIN_NO_CHANGE) {
if (!pinManager.allocatePin(i2swsPin, true, PinOwner::UM_Audioreactive) ||
!pinManager.allocatePin(i2ssdPin, false, PinOwner::UM_Audioreactive)) { // #206
DEBUGSR_PRINTF("\nAR: Failed to allocate I2S pins: ws=%d, sd=%d\n", i2swsPin, i2ssdPin);
return;
}
}
// i2ssckPin needs special treatment, since it might be unused on PDM mics
if (i2sckPin != I2S_PIN_NO_CHANGE) {
if (!pinManager.allocatePin(i2sckPin, true, PinOwner::UM_Audioreactive)) {
DEBUGSR_PRINTF("\nAR: Failed to allocate I2S pins: sck=%d\n", i2sckPin);
return;
}
} else {
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
#if !defined(SOC_I2S_SUPPORTS_PDM_RX)
#warning this MCU does not support PDM microphones
#endif
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
// This is an I2S PDM microphone, these microphones only use a clock and
// data line, to make it simpler to debug, use the WS pin as CLK and SD pin as DATA
// example from espressif: https://github.com/espressif/esp-idf/blob/release/v4.4/examples/peripherals/i2s/i2s_audio_recorder_sdcard/main/i2s_recorder_main.c
// note to self: PDM has known bugs on S3, and does not work on C3
// * S3: PDM sample rate only at 50% of expected rate: https://github.com/espressif/esp-idf/issues/9893
// * S3: I2S PDM has very low amplitude: https://github.com/espressif/esp-idf/issues/8660
// * C3: does not support PDM to PCM input. SoC would allow PDM RX, but there is no hardware to directly convert to PCM so it will not work. https://github.com/espressif/esp-idf/issues/8796
_config.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM); // Change mode to pdm if clock pin not provided. PDM is not supported on ESP32-S2. PDM RX not supported on ESP32-C3
_config.channel_format =I2S_PDM_MIC_CHANNEL; // seems that PDM mono mode always uses left channel.
_config.use_apll = true; // experimental - use aPLL clock source to improve sampling quality
#endif
}
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
if (mclkPin != I2S_PIN_NO_CHANGE) {
_config.use_apll = true; // experimental - use aPLL clock source to improve sampling quality, and to avoid glitches.
// //_config.fixed_mclk = 512 * _sampleRate;
// //_config.fixed_mclk = 256 * _sampleRate;
}
#if !defined(SOC_I2S_SUPPORTS_APLL)
#warning this MCU does not have an APLL high accuracy clock for audio
// S3: not supported; S2: supported; C3: not supported
_config.use_apll = false; // APLL not supported on this MCU
#endif
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
if (ESP.getChipRevision() == 0) _config.use_apll = false; // APLL is broken on ESP32 revision 0
#endif
#endif
// Reserve the master clock pin if provided
_mclkPin = mclkPin;
if (mclkPin != I2S_PIN_NO_CHANGE) {
if(!pinManager.allocatePin(mclkPin, true, PinOwner::UM_Audioreactive)) {
DEBUGSR_PRINTF("\nAR: Failed to allocate I2S pin: MCLK=%d\n", mclkPin);
return;
} else
_routeMclk(mclkPin);
}
_pinConfig = {
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
.mck_io_num = mclkPin, // "classic" ESP32 supports setting MCK on GPIO0/GPIO1/GPIO3 only. i2s_set_pin() will fail if wrong mck_io_num is provided.
#endif
.bck_io_num = i2sckPin,
.ws_io_num = i2swsPin,
.data_out_num = I2S_PIN_NO_CHANGE,
.data_in_num = i2ssdPin
};
//DEBUGSR_PRINTF("[AR] I2S: SD=%d, WS=%d, SCK=%d, MCLK=%d\n", i2ssdPin, i2swsPin, i2sckPin, mclkPin);
esp_err_t err = i2s_driver_install(I2S_NUM_0, &_config, 0, nullptr);
if (err != ESP_OK) {
DEBUGSR_PRINTF("AR: Failed to install i2s driver: %d\n", err);
return;
}
DEBUGSR_PRINTF("AR: I2S#0 driver %s aPLL; fixed_mclk=%d.\n", _config.use_apll? "uses":"without", _config.fixed_mclk);
DEBUGSR_PRINTF("AR: %d bits, Sample scaling factor = %6.4f\n", _config.bits_per_sample, _sampleScale);
if (_config.mode & I2S_MODE_PDM) {
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in PDM MASTER mode."));
} else {
DEBUGSR_PRINTLN(F("AR: I2S#0 driver installed in MASTER mode."));
}
err = i2s_set_pin(I2S_NUM_0, &_pinConfig);
if (err != ESP_OK) {
DEBUGSR_PRINTF("AR: Failed to set i2s pin config: %d\n", err);
i2s_driver_uninstall(I2S_NUM_0); // uninstall already-installed driver
return;
}
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
err = i2s_set_clk(I2S_NUM_0, _sampleRate, I2S_SAMPLE_RESOLUTION, I2S_CHANNEL_MONO); // set bit clocks. Also takes care of MCLK routing if needed.
if (err != ESP_OK) {
DEBUGSR_PRINTF("AR: Failed to configure i2s clocks: %d\n", err);
i2s_driver_uninstall(I2S_NUM_0); // uninstall already-installed driver
return;
}
#endif
_initialized = true;
}
virtual void deinitialize() {
_initialized = false;
esp_err_t err = i2s_driver_uninstall(I2S_NUM_0);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to uninstall i2s driver: %d\n", err);
return;
}
if (_pinConfig.ws_io_num != I2S_PIN_NO_CHANGE) pinManager.deallocatePin(_pinConfig.ws_io_num, PinOwner::UM_Audioreactive);
if (_pinConfig.data_in_num != I2S_PIN_NO_CHANGE) pinManager.deallocatePin(_pinConfig.data_in_num, PinOwner::UM_Audioreactive);
if (_pinConfig.bck_io_num != I2S_PIN_NO_CHANGE) pinManager.deallocatePin(_pinConfig.bck_io_num, PinOwner::UM_Audioreactive);
// Release the master clock pin
if (_mclkPin != I2S_PIN_NO_CHANGE) pinManager.deallocatePin(_mclkPin, PinOwner::UM_Audioreactive);
}
virtual void getSamples(float *buffer, uint16_t num_samples) {
if (_initialized) {
esp_err_t err;
size_t bytes_read = 0; /* Counter variable to check if we actually got enough data */
I2S_datatype newSamples[num_samples]; /* Intermediary sample storage */
err = i2s_read(I2S_NUM_0, (void *)newSamples, sizeof(newSamples), &bytes_read, portMAX_DELAY);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to get samples: %d\n", err);
return;
}
// For correct operation, we need to read exactly sizeof(samples) bytes from i2s
if (bytes_read != sizeof(newSamples)) {
DEBUGSR_PRINTF("Failed to get enough samples: wanted: %d read: %d\n", sizeof(newSamples), bytes_read);
return;
}
// Store samples in sample buffer and update DC offset
for (int i = 0; i < num_samples; i++) {
newSamples[i] = postProcessSample(newSamples[i]); // perform postprocessing (needed for ADC samples)
float currSample = 0.0f;
#ifdef I2S_SAMPLE_DOWNSCALE_TO_16BIT
currSample = (float) newSamples[i] / 65536.0f; // 32bit input -> 16bit; keeping lower 16bits as decimal places
#else
currSample = (float) newSamples[i]; // 16bit input -> use as-is
#endif
buffer[i] = currSample;
buffer[i] *= _sampleScale; // scale samples
}
}
}
protected:
void _routeMclk(int8_t mclkPin) {
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// MCLK routing by writing registers is not needed any more with IDF > 4.4.0
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 4, 0)
// this way of MCLK routing only works on "classic" ESP32
/* Enable the mclk routing depending on the selected mclk pin (ESP32: only 0,1,3)
Only I2S_NUM_0 is supported
*/
if (mclkPin == GPIO_NUM_0) {
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);
WRITE_PERI_REG(PIN_CTRL,0xFFF0);
} else if (mclkPin == GPIO_NUM_1) {
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3);
WRITE_PERI_REG(PIN_CTRL, 0xF0F0);
} else {
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2);
WRITE_PERI_REG(PIN_CTRL, 0xFF00);
}
#endif
#endif
}
i2s_config_t _config;
i2s_pin_config_t _pinConfig;
int8_t _mclkPin;
};
/* ES7243 Microphone
This is an I2S microphone that requires ininitialization over
I2C before I2S data can be received
*/
class ES7243 : public I2SSource {
private:
void _es7243I2cWrite(uint8_t reg, uint8_t val) {
#ifndef ES7243_ADDR
#define ES7243_ADDR 0x13 // default address
#endif
Wire.beginTransmission(ES7243_ADDR);
Wire.write((uint8_t)reg);
Wire.write((uint8_t)val);
uint8_t i2cErr = Wire.endTransmission(); // i2cErr == 0 means OK
if (i2cErr != 0) {
DEBUGSR_PRINTF("AR: ES7243 I2C write failed with error=%d (addr=0x%X, reg 0x%X, val 0x%X).\n", i2cErr, ES7243_ADDR, reg, val);
}
}
void _es7243InitAdc() {
_es7243I2cWrite(0x00, 0x01);
_es7243I2cWrite(0x06, 0x00);
_es7243I2cWrite(0x05, 0x1B);
_es7243I2cWrite(0x01, 0x00); // 0x00 for 24 bit to match INMP441 - not sure if this needs adjustment to get 16bit samples from I2S
_es7243I2cWrite(0x08, 0x43);
_es7243I2cWrite(0x05, 0x13);
}
public:
ES7243(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f) :
I2SSource(sampleRate, blockSize, sampleScale) {
_config.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT;
};
void initialize(int8_t i2swsPin, int8_t i2ssdPin, int8_t i2sckPin, int8_t mclkPin) {
DEBUGSR_PRINTLN("ES7243:: initialize();");
if ((i2sckPin < 0) || (mclkPin < 0)) {
DEBUGSR_PRINTF("\nAR: invalid I2S pin: SCK=%d, MCLK=%d\n", i2sckPin, mclkPin);
return;
}
// First route mclk, then configure ADC over I2C, then configure I2S
_es7243InitAdc();
I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
}
void deinitialize() {
I2SSource::deinitialize();
}
};
/* ES8388 Sound Modude
This is an I2S sound processing unit that requires ininitialization over
I2C before I2S data can be received.
*/
class ES8388Source : public I2SSource {
private:
void _es8388I2cWrite(uint8_t reg, uint8_t val) {
#ifndef ES8388_ADDR
Wire.beginTransmission(0x10);
#define ES8388_ADDR 0x10 // default address
#else
Wire.beginTransmission(ES8388_ADDR);
#endif
Wire.write((uint8_t)reg);
Wire.write((uint8_t)val);
uint8_t i2cErr = Wire.endTransmission(); // i2cErr == 0 means OK
if (i2cErr != 0) {
DEBUGSR_PRINTF("AR: ES8388 I2C write failed with error=%d (addr=0x%X, reg 0x%X, val 0x%X).\n", i2cErr, ES8388_ADDR, reg, val);
}
}
void _es8388InitAdc() {
// https://dl.radxa.com/rock2/docs/hw/ds/ES8388%20user%20Guide.pdf Section 10.1
// http://www.everest-semi.com/pdf/ES8388%20DS.pdf Better spec sheet, more clear.
// https://docs.google.com/spreadsheets/d/1CN3MvhkcPVESuxKyx1xRYqfUit5hOdsG45St9BCUm-g/edit#gid=0 generally
// Sets ADC to around what AudioReactive expects, and loops line-in to line-out/headphone for monitoring.
// Registries are decimal, settings are binary as that's how everything is listed in the docs
// ...which makes it easier to reference the docs.
//
_es8388I2cWrite( 8,0b00000000); // I2S to slave
_es8388I2cWrite( 2,0b11110011); // Power down DEM and STM
_es8388I2cWrite(43,0b10000000); // Set same LRCK
_es8388I2cWrite( 0,0b00000101); // Set chip to Play & Record Mode
_es8388I2cWrite(13,0b00000010); // Set MCLK/LRCK ratio to 256
_es8388I2cWrite( 1,0b01000000); // Power up analog and lbias
_es8388I2cWrite( 3,0b00000000); // Power up ADC, Analog Input, and Mic Bias
_es8388I2cWrite( 4,0b11111100); // Power down DAC, Turn on LOUT1 and ROUT1 and LOUT2 and ROUT2 power
_es8388I2cWrite( 2,0b01000000); // Power up DEM and STM and undocumented bit for "turn on line-out amp"
// #define use_es8388_mic
#ifdef use_es8388_mic
// The mics *and* line-in are BOTH connected to LIN2/RIN2 on the AudioKit
// so there's no way to completely eliminate the mics. It's also hella noisy.
// Line-in works OK on the AudioKit, generally speaking, as the mics really need
// amplification to be noticable in a quiet room. If you're in a very loud room,
// the mics on the AudioKit WILL pick up sound even in line-in mode.
// TL;DR: Don't use the AudioKit for anything, use the LyraT.
//
// The LyraT does a reasonable job with mic input as configured below.
// Pick one of these. If you have to use the mics, use a LyraT over an AudioKit if you can:
_es8388I2cWrite(10,0b00000000); // Use Lin1/Rin1 for ADC input (mic on LyraT)
//_es8388I2cWrite(10,0b01010000); // Use Lin2/Rin2 for ADC input (mic *and* line-in on AudioKit)
_es8388I2cWrite( 9,0b10001000); // Select Analog Input PGA Gain for ADC to +24dB (L+R)
_es8388I2cWrite(16,0b00000000); // Set ADC digital volume attenuation to 0dB (left)
_es8388I2cWrite(17,0b00000000); // Set ADC digital volume attenuation to 0dB (right)
_es8388I2cWrite(38,0b00011011); // Mixer - route LIN1/RIN1 to output after mic gain
_es8388I2cWrite(39,0b01000000); // Mixer - route LIN to mixL, +6dB gain
_es8388I2cWrite(42,0b01000000); // Mixer - route RIN to mixR, +6dB gain
_es8388I2cWrite(46,0b00100001); // LOUT1VOL - 0b00100001 = +4.5dB
_es8388I2cWrite(47,0b00100001); // ROUT1VOL - 0b00100001 = +4.5dB
_es8388I2cWrite(48,0b00100001); // LOUT2VOL - 0b00100001 = +4.5dB
_es8388I2cWrite(49,0b00100001); // ROUT2VOL - 0b00100001 = +4.5dB
// Music ALC - the mics like Auto Level Control
// You can also use this for line-in, but it's not really needed.
//
_es8388I2cWrite(18,0b11111000); // ALC: stereo, max gain +35.5dB, min gain -12dB
_es8388I2cWrite(19,0b00110000); // ALC: target -1.5dB, 0ms hold time
_es8388I2cWrite(20,0b10100110); // ALC: gain ramp up = 420ms/93ms, gain ramp down = check manual for calc
_es8388I2cWrite(21,0b00000110); // ALC: use "ALC" mode, no zero-cross, window 96 samples
_es8388I2cWrite(22,0b01011001); // ALC: noise gate threshold, PGA gain constant, noise gate enabled
#else
_es8388I2cWrite(10,0b01010000); // Use Lin2/Rin2 for ADC input ("line-in")
_es8388I2cWrite( 9,0b00000000); // Select Analog Input PGA Gain for ADC to 0dB (L+R)
_es8388I2cWrite(16,0b01000000); // Set ADC digital volume attenuation to -32dB (left)
_es8388I2cWrite(17,0b01000000); // Set ADC digital volume attenuation to -32dB (right)
_es8388I2cWrite(38,0b00001001); // Mixer - route LIN2/RIN2 to output
_es8388I2cWrite(39,0b01010000); // Mixer - route LIN to mixL, 0dB gain
_es8388I2cWrite(42,0b01010000); // Mixer - route RIN to mixR, 0dB gain
_es8388I2cWrite(46,0b00011011); // LOUT1VOL - 0b00011110 = +0dB, 0b00011011 = LyraT balance fix
_es8388I2cWrite(47,0b00011110); // ROUT1VOL - 0b00011110 = +0dB
_es8388I2cWrite(48,0b00011110); // LOUT2VOL - 0b00011110 = +0dB
_es8388I2cWrite(49,0b00011110); // ROUT2VOL - 0b00011110 = +0dB
#endif
}
public:
ES8388Source(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f, bool i2sMaster=true) :
I2SSource(sampleRate, blockSize, sampleScale) {
_config.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT;
};
void initialize(int8_t i2swsPin, int8_t i2ssdPin, int8_t i2sckPin, int8_t mclkPin) {
DEBUGSR_PRINTLN("ES8388Source:: initialize();");
if ((i2sckPin < 0) || (mclkPin < 0)) {
DEBUGSR_PRINTF("\nAR: invalid I2S pin: SCK=%d, MCLK=%d\n", i2sckPin, mclkPin);
return;
}
// First route mclk, then configure ADC over I2C, then configure I2S
_es8388InitAdc();
I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
}
void deinitialize() {
I2SSource::deinitialize();
}
};
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
#if !defined(SOC_I2S_SUPPORTS_ADC) && !defined(SOC_I2S_SUPPORTS_ADC_DAC)
#warning this MCU does not support analog sound input
#endif
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// ADC over I2S is only availeable in "classic" ESP32
/* ADC over I2S Microphone
This microphone is an ADC pin sampled via the I2S interval
This allows to use the I2S API to obtain ADC samples with high sample rates
without the need of manual timing of the samples
*/
class I2SAdcSource : public I2SSource {
public:
I2SAdcSource(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f) :
I2SSource(sampleRate, blockSize, sampleScale) {
_config = {
.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_ADC_BUILT_IN),
.sample_rate = _sampleRate,
.bits_per_sample = I2S_SAMPLE_RESOLUTION,
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
#else
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
#endif
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 8,
.dma_buf_len = _blockSize,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0
};
}
/* identify Audiosource type - I2S-ADC*/
AudioSourceType getType(void) {return(Type_I2SAdc);}
void initialize(int8_t audioPin, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE) {
DEBUGSR_PRINTLN("I2SAdcSource:: initialize().");
_myADCchannel = 0x0F;
if(!pinManager.allocatePin(audioPin, false, PinOwner::UM_Audioreactive)) {
DEBUGSR_PRINTF("failed to allocate GPIO for audio analog input: %d\n", audioPin);
return;
}
_audioPin = audioPin;
// Determine Analog channel. Only Channels on ADC1 are supported
int8_t channel = digitalPinToAnalogChannel(_audioPin);
if (channel > 9) {
DEBUGSR_PRINTF("Incompatible GPIO used for analog audio input: %d\n", _audioPin);
return;
} else {
adc_gpio_init(ADC_UNIT_1, adc_channel_t(channel));
_myADCchannel = channel;
}
// Install Driver
esp_err_t err = i2s_driver_install(I2S_NUM_0, &_config, 0, nullptr);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to install i2s driver: %d\n", err);
return;
}
adc1_config_width(ADC_WIDTH_BIT_12); // ensure that ADC runs with 12bit resolution
// Enable I2S mode of ADC
err = i2s_set_adc_mode(ADC_UNIT_1, adc1_channel_t(channel));
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to set i2s adc mode: %d\n", err);
return;
}
// see example in https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino
adc1_config_channel_atten(adc1_channel_t(channel), ADC_ATTEN_DB_11); // configure ADC input amplification
#if defined(I2S_GRAB_ADC1_COMPLETELY)
// according to docs from espressif, the ADC needs to be started explicitly
// fingers crossed
err = i2s_adc_enable(I2S_NUM_0);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to enable i2s adc: %d\n", err);
//return;
}
#else
// bugfix: do not disable ADC initially - its already disabled after driver install.
//err = i2s_adc_disable(I2S_NUM_0);
// //err = i2s_stop(I2S_NUM_0);
//if (err != ESP_OK) {
// DEBUGSR_PRINTF("Failed to initially disable i2s adc: %d\n", err);
//}
#endif
_initialized = true;
}
I2S_datatype postProcessSample(I2S_datatype sample_in) {
static I2S_datatype lastADCsample = 0; // last good sample
static unsigned int broken_samples_counter = 0; // number of consecutive broken (and fixed) ADC samples
I2S_datatype sample_out = 0;
// bring sample down down to 16bit unsigned
I2S_unsigned_datatype rawData = * reinterpret_cast<I2S_unsigned_datatype *> (&sample_in); // C++ acrobatics to get sample as "unsigned"
#ifndef I2S_USE_16BIT_SAMPLES
rawData = (rawData >> 16) & 0xFFFF; // scale input down from 32bit -> 16bit
I2S_datatype lastGoodSample = lastADCsample / 16384 ; // prepare "last good sample" accordingly (26bit-> 12bit with correct sign handling)
#else
rawData = rawData & 0xFFFF; // input is already in 16bit, just mask off possible junk
I2S_datatype lastGoodSample = lastADCsample * 4; // prepare "last good sample" accordingly (10bit-> 12bit)
#endif
// decode ADC sample data fields
uint16_t the_channel = (rawData >> 12) & 0x000F; // upper 4 bit = ADC channel
uint16_t the_sample = rawData & 0x0FFF; // lower 12bit -> ADC sample (unsigned)
I2S_datatype finalSample = (int(the_sample) - 2048); // convert unsigned sample to signed (centered at 0);
if ((the_channel != _myADCchannel) && (_myADCchannel != 0x0F)) { // 0x0F means "don't know what my channel is"
// fix bad sample
finalSample = lastGoodSample; // replace with last good ADC sample
broken_samples_counter ++;
if (broken_samples_counter > 256) _myADCchannel = 0x0F; // too many bad samples in a row -> disable sample corrections
//Serial.print("\n!ADC rogue sample 0x"); Serial.print(rawData, HEX); Serial.print("\tchannel:");Serial.println(the_channel);
} else broken_samples_counter = 0; // good sample - reset counter
// back to original resolution
#ifndef I2S_USE_16BIT_SAMPLES
finalSample = finalSample << 16; // scale up from 16bit -> 32bit;
#endif
finalSample = finalSample / 4; // mimic old analog driver behaviour (12bit -> 10bit)
sample_out = (3 * finalSample + lastADCsample) / 4; // apply low-pass filter (2-tap FIR)
//sample_out = (finalSample + lastADCsample) / 2; // apply stronger low-pass filter (2-tap FIR)
lastADCsample = sample_out; // update ADC last sample
return(sample_out);
}
void getSamples(float *buffer, uint16_t num_samples) {
/* Enable ADC. This has to be enabled and disabled directly before and
* after sampling, otherwise Wifi dies
*/
if (_initialized) {
#if !defined(I2S_GRAB_ADC1_COMPLETELY)
// old code - works for me without enable/disable, at least on ESP32.
//esp_err_t err = i2s_start(I2S_NUM_0);
esp_err_t err = i2s_adc_enable(I2S_NUM_0);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to enable i2s adc: %d\n", err);
return;
}
#endif
I2SSource::getSamples(buffer, num_samples);
#if !defined(I2S_GRAB_ADC1_COMPLETELY)
// old code - works for me without enable/disable, at least on ESP32.
err = i2s_adc_disable(I2S_NUM_0); //i2s_adc_disable() may cause crash with IDF 4.4 (https://github.com/espressif/arduino-esp32/issues/6832)
//err = i2s_stop(I2S_NUM_0);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to disable i2s adc: %d\n", err);
return;
}
#endif
}
}
void deinitialize() {
pinManager.deallocatePin(_audioPin, PinOwner::UM_Audioreactive);
_initialized = false;
_myADCchannel = 0x0F;
esp_err_t err;
#if defined(I2S_GRAB_ADC1_COMPLETELY)
// according to docs from espressif, the ADC needs to be stopped explicitly
// fingers crossed
err = i2s_adc_disable(I2S_NUM_0);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to disable i2s adc: %d\n", err);
}
#endif
i2s_stop(I2S_NUM_0);
err = i2s_driver_uninstall(I2S_NUM_0);
if (err != ESP_OK) {
DEBUGSR_PRINTF("Failed to uninstall i2s driver: %d\n", err);
return;
}
}
private:
int8_t _audioPin;
int8_t _myADCchannel = 0x0F; // current ADC channel for analog input. 0x0F means "undefined"
};
#endif
/* SPH0645 Microphone
This is an I2S microphone with some timing quirks that need
special consideration.
*/
// https://github.com/espressif/esp-idf/issues/7192 SPH0645 i2s microphone issue when migrate from legacy esp-idf version (IDFGH-5453)
// a user recommended this: Try to set .communication_format to I2S_COMM_FORMAT_STAND_I2S and call i2s_set_clk() after i2s_set_pin().
class SPH0654 : public I2SSource {
public:
SPH0654(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f) :
I2SSource(sampleRate, blockSize, sampleScale)
{}
void initialize(int8_t i2swsPin, int8_t i2ssdPin, int8_t i2sckPin, int8_t = I2S_PIN_NO_CHANGE) {
DEBUGSR_PRINTLN("SPH0654:: initialize();");
I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin);
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// these registers are only existing in "classic" ESP32
REG_SET_BIT(I2S_TIMING_REG(I2S_NUM_0), BIT(9));
REG_SET_BIT(I2S_CONF_REG(I2S_NUM_0), I2S_RX_MSB_SHIFT);
#else
#warning FIX ME! Please.
#endif
}
};
#endif

View File

@ -0,0 +1,73 @@
# Audioreactive usermod
Enabless controlling LEDs via audio input. Audio source can be a microphone or analog-in (AUX) using an appropriate adapter.
Supported microphones range from analog (MAX4466, MAX9814, ...) to digital (INMP441, ICS-43434, ...).
Does audio processing and provides data structure that specially written effects can use.
**does not** provide effects or draw anything to an LED strip/matrix.
## Additional Documentation
This usermod is an evolution of [SR-WLED](https://github.com/atuline/WLED), and a lot of documentation and information can be found in the [SR-WLED wiki](https://github.com/atuline/WLED/wiki):
* [getting started with audio](https://github.com/atuline/WLED/wiki/First-Time-Setup#sound)
* [Sound settings](https://github.com/atuline/WLED/wiki/Sound-Settings) - similar to options on the usemod settings page in WLED.
* [Digital Audio](https://github.com/atuline/WLED/wiki/Digital-Microphone-Hookup)
* [Analog Audio](https://github.com/atuline/WLED/wiki/Analog-Audio-Input-Options)
* [UDP Sound sync](https://github.com/atuline/WLED/wiki/UDP-Sound-Sync)
## Supported MCUs
This audioreactive usermod works best on "classic ESP32" (dual core), and on ESP32-S3 which also has dual core and hardware floating point support.
It will compile succesfully for ESP32-S2 and ESP32-C3, however might not work well, as other WLED functions will become slow. Audio processing requires a lot of computing power, which can be problematic on smaller MCUs like -S2 and -C3.
Analog audio is only possible on "classic" ESP32, but not on other MCUs like ESP32-S3.
Currently ESP8266 is not supported, due to low speed and small RAM of this chip.
There are however plans to create a lightweight audioreactive for the 8266, with reduced features.
## Installation
### using customised _arduinoFFT_ library for use with this usermod
Add `-D USERMOD_AUDIOREACTIVE` to your PlatformIO environment `build_flags`, as well as `https://github.com/blazoncek/arduinoFFT.git` to your `lib_deps`.
If you are not using PlatformIO (which you should) try adding `#define USERMOD_AUDIOREACTIVE` to *my_config.h* and make sure you have _arduinoFFT_ library downloaded and installed.
Customised _arduinoFFT_ library for use with this usermod can be found at https://github.com/blazoncek/arduinoFFT.git
### using latest (develop) _arduinoFFT_ library
Alternatively, you can use the latest arduinoFFT development version.
ArduinoFFT `develop` library is slightly more accurate, and slighly faster than our customised library, however also needs additional 2kB RAM.
* `build_flags` = `-D USERMOD_AUDIOREACTIVE` `-D UM_AUDIOREACTIVE_USE_NEW_FFT`
* `lib_deps`= `https://github.com/kosme/arduinoFFT#develop @ 1.9.2`
## Configuration
All parameters are runtime configurable. Some may require a hard reset after changing them (I2S microphone or selected GPIOs).
If you want to define default GPIOs during compile time, use the following (default values in parentheses):
- `-D SR_DMTYPE=x` : defines digital microphone type: 0=analog, 1=generic I2S (default), 2=ES7243 I2S, 3=SPH0645 I2S, 4=generic I2S with master clock, 5=PDM I2S
- `-D AUDIOPIN=x` : GPIO for analog microphone/AUX-in (36)
- `-D I2S_SDPIN=x` : GPIO for SD pin on digital microphone (32)
- `-D I2S_WSPIN=x` : GPIO for WS pin on digital microphone (15)
- `-D I2S_CKPIN=x` : GPIO for SCK pin on digital microphone (14)
- `-D MCLK_PIN=x` : GPIO for master clock pin on digital Line-In boards (-1)
- `-D ES7243_SDAPIN` : GPIO for I2C SDA pin on ES7243 microphone (-1)
- `-D ES7243_SCLPIN` : GPIO for I2C SCL pin on ES7243 microphone (-1)
**NOTE** I2S is used for analog audio sampling. Hence, the analog *buttons* (i.e. potentiometers) are disabled when running this usermod with an analog microphone.
### Advanced Compile-Time Options
You can use the following additional flags in your `build_flags`
* `-D SR_SQUELCH=x` : Default "squelch" setting (10)
* `-D SR_GAIN=x` : Default "gain" setting (60)
* `-D I2S_USE_RIGHT_CHANNEL`: Use RIGHT instead of LEFT channel (not recommended unless you strictly need this).
* `-D I2S_USE_16BIT_SAMPLES`: Use 16bit instead of 32bit for internal sample buffers. Reduces sampling quality, but frees some RAM ressources (not recommended unless you absolutely need this).
* `-D I2S_GRAB_ADC1_COMPLETELY`: Experimental: continously sample analog ADC microphone. Only effective on ESP32. WARNING this _will_ cause conflicts(lock-up) with any analogRead() call.
* `-D MIC_LOGGER` : (debugging) Logs samples from the microphone to serial USB. Use with serial plotter (Arduino IDE)
* `-D SR_DEBUG` : (debugging) Additional error diagnostics and debug info on serial USB.
## Release notes
* 2022-06 Ported from [soundreactive WLED](https://github.com/atuline/WLED) - by @blazoncek (AKA Blaz Kristan) and the [SR-WLED team](https://github.com/atuline/WLED/wiki#sound-reactive-wled-fork-team).
* 2022-11 Updated to align with "[MoonModules/WLED](https://amg.wled.me)" audioreactive usermod - by @softhack007 (AKA Frank M&ouml;hle).

View File

@ -54,35 +54,27 @@ void userLoop()
switch (myKey) { switch (myKey) {
case '1': case '1':
applyPreset(1); applyPreset(1);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case '2': case '2':
applyPreset(2); applyPreset(2);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case '3': case '3':
applyPreset(3); applyPreset(3);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case '4': case '4':
applyPreset(4); applyPreset(4);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case '5': case '5':
applyPreset(5); applyPreset(5);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case '6': case '6':
applyPreset(6); applyPreset(6);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case 'A': case 'A':
applyPreset(7); applyPreset(7);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case 'B': case 'B':
applyPreset(8); applyPreset(8);
colorUpdated(CALL_MODE_FX_CHANGED);
break; break;
case '7': case '7':

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