Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End oappend v2 #4152

Open
wants to merge 8 commits into
base: 0_15
Choose a base branch
from
Open

End oappend v2 #4152

wants to merge 8 commits into from

Conversation

willmmiles
Copy link
Collaborator

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.

willmmiles and others added 8 commits September 18, 2024 19:47
Since we validate the file existence ourselves, no need to have
AsyncWebServer do it again.
Useful for checking that I haven't broken anything.
Remove the large stack buffer as we're just going to copy it in to a
heap buffer anyways.  Later we can refine the length estimation or use a
rope-style dynamic data structure like DynamicBufferList.
Use a static Print* to transform old oappend calls to print calls.
Reduce the total number of calls by using printf_P and skipping atoi().
Use named functions to describe what's being printed.
Use a name that makes it a bit clearer what the output is.  The new name
is applied consistently through most uses.
Usermods are not yet updated.
@willmmiles willmmiles mentioned this pull request Sep 19, 2024
@softhack007
Copy link
Collaborator

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants