225 Commits

Author SHA1 Message Date
Frank
49130c9ec9 (chores) cleanup some compiler warnings
* switch-cases that fall through
* potential buffer overflow in improv.cpp
* potentially uninitialized variables in FX.cpp
* potential array out-of-range on segment::col[]
* minor optimization: only apply gamma correction when result is needed
* tag some possibly unused variables with   [[maybe_unused]]
2026-03-11 13:54:58 +01:00
Frank Möhle
cce3c0b5d3 psram-aware malloc functions (backport of upstream #4895) (#342)
Introduces new memory allocation functions, based on wled#4895 by @DedeHai

* keep a minimum of 15KB RAM available to UI - improves stability
* S3/S2/C3 automatically use "fast RTC Ram" for small data (reduces fragmentation)
* auto-detects PSRAM (or no PSRAM) when firmware was built with -D BOARD_HAS_PSRAM
* d_malloc() and d_calloc() prefer DRAM if possible (faster), but fall back to PSRAM when free RAM gets low.
2026-02-18 17:57:47 +01:00
Frank
1f065f69c2 post-merge
* replace all remaining sqrt16() with sqrt32_bw()
* align particleGalaxy effects with upstream
2026-01-17 13:21:02 +01:00
Frank
617ea8fa04 bugfix: ledmap.json discarded too early
* added missing check for "ledmap.json" file => always applied
* added missing check for ledmap1...10
* setupMatrix test for "unity" ledmap was too early - removed (need to find a better place for this)
2025-12-30 15:46:47 +01:00
Frank
02d23b3316 fixing some compiler warnings
signed vs. unsigned, deprecated functions, printf parameter size mismatch
2025-12-17 00:03:18 +01:00
Frank
f69c0717de Revert "ledmap not needed, part 2: always delete ledmap if it does not change pixel order"
This reverts commit e9082d6da2.
2025-12-03 14:00:16 +01:00
Frank
e9082d6da2 ledmap not needed, part 2: always delete ledmap if it does not change pixel order 2025-12-02 23:08:45 +01:00
Frank
2ef623eeaa always do the "no ledmap needed" test & optimization 2025-12-02 22:33:06 +01:00
Frank
15451c16f9 reduce debug noise on serial
downgraded a few USER_PRINT to DEBUG_PRINT
2025-11-30 01:22:34 +01:00
Frank
e38c2b32c8 finishing touches
* replace strlen with strnlen
* avoid static variable in getFontInfo
* remove legacy code in drawCharacter (new code works well)

it works for me, let's ship it ;-)
2025-11-21 17:26:04 +01:00
Frank
e6676372d8 refactor / cleanup font selection logic
* centralize font selection logic into  getFontInfo()
* removed unneeded parameter "numberOfChars" from drawText()
* new file: wled_fonts.hpp to centralize font management logic (inline)
* only compile wchar16ToCodepage437 when WLED_ENABLE_FULL_FONTS
* minor cleanup
2025-11-21 17:04:08 +01:00
Frank
213cd185b5 explanations for CP437 translations, some cleanups, bugfix for drawString
* explanation for CP437 glyph groups
* translation for MonnModules symbol
* "smiley" replacement for 4-bytes and overlong unicode codes
* always compile unicodetool.cpp (codepage translation still depends on WLED_ENABLE_UNICODE)
* bugfix: DrawString now skips over glyphs that would be rejected by DrawCharacter
* minor cleanup
2025-11-21 13:48:38 +01:00
Frank
415aadc6e0 removing dead code 2025-11-21 00:10:33 +01:00
Frank
c3dce1353c fix font shadow code
stupid mistake ... it must still be "i>0" because its about the scanline, not the character code
2025-11-21 00:01:13 +01:00
Frank
e63dc7e71e longer segment names
* introducing WLED_MAX_SEGNAME_LEN from upstream
* default: max name length = 48
* hopefully found all places where the segment name length was hardcoded (32, 33, 34)
* some comments still refer to "32" but wtf
2025-11-20 23:49:26 +01:00
Frank
2c3592c3f3 fix off-by-one array violation, debug message wghen segment name is too long
* fix possible off-by-one array overflow in drawText
* debug message when too-long segment name was dropped
2025-11-20 18:43:15 +01:00
Frank
45f793b338 first light 👍😅
* idea seems to work
* scrolling is broken, probably I need to create a unicode-aware ``strlen``
2025-11-20 13:57:55 +01:00
Frank
a3ccc5a8eb work in progress
it just compiles, don't ship it !
2025-11-20 02:36:12 +01:00
Frank
c3b8e0182b plan: next steps
just an empty framework
2025-11-20 02:07:30 +01:00
Frank
9f31f2444f some precautions to prevent buffer out-of-bounds access and concurrency problems
* make sure that filenames can hold 32chars of segment.name
* fix logic error in Segment::drawCharacter
* protect free(Segment::_globalLeds) with a critical section
2025-11-14 22:43:44 +01:00
Frank
bb44dd8616 robustness improvements for image presets
prevent errors / crashes when drawing "i" images from a preset.
- prevent out-of-bounds writing (segment smaller than image)
- make sure that segment properties are cached correctly
- always do "show" when strip was triggered (avoids lost frames)
2025-11-04 20:28:26 +01:00
Frank
40064490ad strip level setPixelColor and getPixelColor optimization
* moved sPC and gPC functions out of their .cpp files into FX.h, so the compiler can optimize better.

depending of effect used, this gives a 2% up to 8% speedup.
2025-11-01 16:50:20 +01:00
Frank
13331e3de0 const WS2812FX::setPixelColorXY
small optimization for speed
2025-10-31 11:09:45 +01:00
Frank
f8a673ce81 code robustness improvements plus minor speedup
* make  XY() and _setPixelColorXY_raw() const (minor speedup)
* segment is a struct not a class: friend class Segment --> friend struct Segment
* fix missing braces around two macros
* use non-throwing "new" where possible
* improve robustness of transition code
2025-01-07 15:58:38 +01:00
Frank
972257a7ee minor code cleanup
* removed dead code
* prevent promotion to double
* made constants constexpr
* made some methods const
* fixed a few typo's
2024-12-04 22:18:39 +01:00
Frank
5a2096ab21 partly inline getPixelColorXY
allows the compiler to inline access to ledsrgb[] , while still keeping the "no buffer" case in a separate function so program size does not blow up.

--> up to 10% faster
2024-11-24 19:09:35 +01:00
Frank
ce8fc8930e const const const
small speedup by declaring some functions "const"
2024-11-24 17:45:25 +01:00
Frank
202255849f fix errors when width>255 or height>255
some effects still don't work when x y dimensions do not fit into 8bit
2024-11-13 23:06:27 +01:00
Frank
aafebf7aad bugfix: make pseudo-1D segments (width=1, height=x) work again 2024-11-07 19:34:19 +01:00
Frank
9189329570 scrolling text improvement
better readability
- only add "shadow" pixels when overlay text is actually scrolling, or displayed value changes very often
2024-10-28 21:26:04 +01:00
Frank
05adb7dfae prevent drawLine from drawing out of bounds
the "smooth" variant was sometimes producing XY positions outside the canvas.
2024-10-24 18:16:43 +02:00
Frank
922c5e74df drawCharacter minor speedup 2024-10-23 14:23:54 +02:00
Frank
855d61af4e draw character minor speedup
Only use palette math when text with color gradient is needed
2024-10-22 23:10:30 +02:00
Frank
7c6178418a cache virtualLength() and some cleanup
speedup for 1D->2D mapping
2024-10-19 23:29:53 +02:00
Frank
670c621ffe Arc - gPC fix by @Brandon502
with fix for missing pixel on 8x32 and similar ratios.
2024-10-19 22:26:11 +02:00
Frank
e75fc4d457 fix holes in DNA effect (>32 pixel high segments)
avoid holes by using drawLine when there is a gap
2024-10-16 21:25:52 +02:00
Ewoud
33318dab25 Merge pull request #170 from MoonModules/license 2024-10-16 00:14:46 +02:00
Frank
22b16ab542 Align all licensing statements with EUPL-1.2 2024-10-14 21:52:52 +02:00
Frank
4fadcade93 fix for off-by-one error in Lissajous (float version) 2024-10-06 19:59:59 +02:00
Frank
79f5db6d65 fadePixelColorXY bugfix 2024-10-02 16:12:48 +02:00
Frank
63ff7205d6 wu_pixel small optimization
5% faster
2024-09-29 18:37:18 +02:00
Frank
3110b0a476 fix for XL builds
some usermod still seems to used sPC(float, float, c).

> Linking .pio/build/esp32_4MB_XL/firmware.elf
.pio/build/esp32_4MB_XL/src/usermods_list.cpp.o:(.literal._ZN7Frame3DD5Ev[Frame3D::~Frame3D()]+0x4): undefined reference to `Segment::setPixelColorXY(float, float, unsigned int, bool, bool)'
2024-09-29 18:02:39 +02:00
Frank
7e9474e78c depricate sPC(float, float)
the function is already removed in upstream.
You can use wu_pixel() instead, which is much faster and more accurate.
2024-09-29 17:51:44 +02:00
Frank
2aa0d47036 adding getPixelColorRestored()
similar to getPixelColor, but returns the original pixel without brightness adjustments.

* getPixelColorRestored is used by segment::sPC and segment::gPC
* getPixelColor is still used by ABL (auto brightness limiter)
2024-09-28 02:43:12 +02:00
Frank
b245112d2a some drawing speedups
* speedups for addPixelColorXY, fadePixelColorXY, fadeToBlackBy
2024-09-28 02:19:53 +02:00
Frank
0555b8e5f2 HUB75: avoid allocating ledMap
based on an idea by @troyhacks : fight heap fragmentation by avoiding to allocate ledMap when not needed.
2024-09-28 02:18:24 +02:00
Frank
3a506aded2 trying to keep scrolling text readable
the problem (partly solved) is that scrolling text does not erase any previous text, but simply paints pixels in addition.

* add a "shadow" area around each letter, which is explicitly painted black
* only possible when  Trail=0, and overlay option selected
2024-09-28 02:12:53 +02:00
Frank
80a2f2b85b minor corrections
* fix some override problems bus_manager (canShow() must not be const!!!)
* fixing some "comparing integer with different signedness" warnings
2024-09-21 19:41:51 +02:00
Blaz Kristan
6d83adae3c Mirroring bugfix. 2024-09-05 00:06:12 +02:00
Frank
b47c55db90 fix 8266 builds
wled00/FX_fcn.cpp:974:16: error: '_isSuperSimpleSegment' was not declared in this scope
2024-08-18 13:21:55 +02:00