Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.01k stars 3.24k forks source link

End oappend v2 #4152

Closed willmmiles closed 1 month ago

willmmiles commented 1 month ago

Replacement for #4134 without any usermod changes, which can be considered as a separate PR.

Replace the usage of oppend with Arduino's Print abstraction. This permits efficient use of dynamically allocated memory for returning settings page data, without requiring a single large contiguous allocation up front, or risking smashing the stack.

This change also permits the output generation functions to easily use more sophisticated serialization functions such as printf, reducing the number of required function calls. With this optimization, the overall result is approximate parity in code size to the original implementation.

softhack007 commented 1 month ago

👍

blazoncek commented 1 month ago

I am ok to merge this PR.

netmindz commented 1 month ago

Great work

FreakyJ commented 1 month ago

Is this a bug or by purpose in xml.cpp? SET_F changed to F grafik

willmmiles commented 1 month ago

Is this a bug or by purpose in xml.cpp? SET_F changed to F

It's intentional. F() informs print() (via overloading) that the string is stored in PROGMEM on PROGMEM-distinct boards, so it can use an optimized/safer algorithm. SET_F() casts away the distinction, which can result in poor performance or crashes.