ClimateCall has overloaded set_target_temperature*(float) and
set_target_temperature*(optional<float>), so the compiler can't
infer NumT. Use static_cast to select the float overload.
ClimateCall has overloaded set_target_temperature*(float) and
set_target_temperature*(optional<float>), so the compiler can't
infer NumT. Use static_cast to select the float overload.
- Mark find_query_value_ as const
- Remove redundant hasArg() guards where parse_number() already
handles empty strings (returns nullopt)
- Use !empty() instead of hasArg() for parse_bool_param_
- Merge parse_float_param_ and parse_int_param_ into single
parse_num_param_ template
- Combine missing/empty checks for IR data parameter
On Arduino, arg() returns const String&, so auto copies unnecessarily.
const auto& binds to the reference on Arduino and extends the temporary
lifetime on IDF.
Switch all web_server callers from getParam()/hasParam() to arg()/hasArg().
Both APIs exist on Arduino ESPAsyncWebServer and our IDF implementation.
On the IDF side, getParam() allocated a new AsyncWebParameter on the heap
for every successful lookup, cached it in a vector, and required cleanup
in the destructor. No caller ever held the pointer or called getParam
twice with the same name - every use was just getParam("x")->value()
immediately.
Rewrite IDF arg()/hasArg() to call query_key_value() directly, bypassing
getParam entirely. The linker strips the now-unreferenced getParam,
AsyncWebParameter, and cache machinery.
Saves ~348 bytes flash on ESP32-IDF, ~272 bytes on ESP8266 Arduino.
The 1460-byte MULTIPART_CHUNK_SIZE buffer was moved from heap to stack
in #13549, but the httpd task stack is only ~4096-5632 bytes. This
causes a stack overflow crash when processing OTA uploads, especially
on configs with BLE components that add additional stack pressure.
Move it back to heap since this buffer is only used during OTA uploads
(not a hot path), so heap fragmentation is not a concern here.
Fixes stack overflow: "A stack overflow in task httpd has been detected"
Refactor multipart utility functions to work with const char* + length
instead of std::string to eliminate temporary heap allocations during
header parsing. The original implementations used std::string for
convenience when the OTA multipart support was first added, but these
can be avoided since the multipart parser already provides raw pointers
and lengths in its callbacks.
- extract_header_param: takes (const char*, size_t, const char*, std::string&)
instead of (const std::string&, const std::string&) -> std::string.
Assigns directly to destination, avoiding intermediate string construction.
- str_startswith_case_insensitive: takes (const char*, size_t, const char*)
instead of (const std::string&, const std::string&)
- str_trim: takes (const char*, size_t, std::string&) instead of
(const std::string&) -> std::string
- Rename stristr to strcasestr_n with explicit haystack length parameter
to make the relationship to POSIX strcasestr clear and fix a latent
buffer over-read risk (stristr relied on null-termination which the
multipart parser does not guarantee for its callback data)
- process_header_ no longer creates a std::string copy of the raw
parser buffer before calling utility functions
Saves ~350 bytes of flash.