Commit Graph

217 Commits

Author SHA1 Message Date
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
Frank
b9007f2dc6 bugfix
fix compiler error on non-fastpath builds
2024-08-16 18:02:25 +02:00
Frank
030a7cee53 another small speedup, and segment stability improvement
* removed a few sanity check that are done again later in getPixelColor
* stability: prevent crashes when changing segments settings or effect options
2024-08-16 17:54:11 +02:00
Frank
6e415dfbbe HUB75 hack
HUB75 is very memory hungry - this hack deletes the mapping table when its not needed --> frees 8Kb with a 64x64 panel.
2024-08-07 18:31:06 +02:00
Frank
7f9da309c9 const const const
adding hints for the compiler for optimization.
In case your custom build complains about "const", just remove the keyword. based on e82f38e277, but going further :-)

* "const" class functions : function does not modify any class attributes ( --> "this" becomes const)

* __attribute__((pure)) :  function return value depends only on the parameters and/or global variables. The function does not modify any global or static variables.
* __attribute__((const)) : function only examines arguments (no globals), and has no effects except the return value. This slightly more strict than "pure"
* hot: tells the compiler "this functions is called very often"
* cold: the opposite of hot
2024-08-07 14:58:38 +02:00
Frank
273154db76 drawArc speedup (Circle mapping mode)
* Optimize drawArc to skip pixels that are off-screen or outside the circle's bounding box. Also move repeating calculations out of the inner loop.

testcase 64x64 : 8fps --> 33 fps :-)
2024-08-06 18:13:59 +02:00
Frank
42919f9daf blob effect improvements, and a dirty hack for HUB75 double buffer
* mode_2Dfloatingblobs() improvements for large panels
* Segment::fillCircle() speed optimizations
* HUB75 hack (disabled by default): skip first fill(BLACK) when using double buffering (as the buffer gets cleared after each frame)
2024-08-06 15:53:46 +02:00
Frank
5240c3450b Segment drawing optimizations (FASTPATH only)
* cache width, height, and a few more values that are normally re-calculated for each pixel
* make normal sPC a bit faster
* Segment::fade_out() optimization

--> only active in FASTPATH mode, to preserve flash on small devices (8266)
--> code still needs some polishing
--> up to 20% speedup with some 2D effects (esp32,  flash qio 80Mhz, -O2)
2024-08-05 21:30:25 +02:00
Frank
9bcc5da132 code cleanup
- removed commented-out code
- reduced blank lines
2024-07-16 20:48:15 +02:00