You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cfe8b91
Browse filesBrowse the repository at this point in the historyBrowse files
Phase 1.5 of #3022: tighten the FL_JSON_HAS_FLOAT=0 contract so the
FastLED library never reaches an IEEE-754 helper on Low-memory targets,
regardless of which sketch is linked.
src/fl/stl/json.h:
* Drop the #else truncation fallback in json(float/double),
operator=(float/double), and set(key, float/double). On
FL_JSON_HAS_FLOAT=0 these are now SFINAE-templated static_assert
overloads that name the migration path (fl::fixed_point<>) — a
silent static_cast<i64>(f) inside the library was pulling
__aeabi_f2iz / __aeabi_d2iz (~64B each) into the link at every
call site, even when the user only ever wanted integer storage.
* Add fl::json ↔ fl::fixed_point setter / extractor API. Our number
format is itself a super fixed point — the i64 variant slot is the
natural carrier for any Q-format value, so the new templated
json(FP), operator=(FP), set(key, FP), and as_fixed_point<FP>()
overloads pack/unpack the raw integer representation directly.
SFINAE detects fixed_point-shaped types via INT_BITS / FRAC_BITS /
raw() / from_raw() member probes (works for s16x16, s0x32, u24x8,
s12x4, and so on — see src/fl/math/fixed_point/).
src/platforms/shared/ui/json/{slider,number_field}.cpp.hpp:
* Wrap whole-TU bodies in #if FL_JSON_HAS_FLOAT. JsonSliderImpl and
JsonNumberFieldImpl carry intrinsically-float value/min/max/step
storage and serialize via json.set(key, float); gating the TU keeps
the soft-FP cascade out of the library archive on Low-memory
builds. Sketches that don't instantiate these widgets see zero
impact; sketches that try to fail at link with `undefined
reference`, mirroring the existing FASTLED_NO_JSON ergonomics in
ScreenMap. Phase-2 plan tracked under #3022: add fixed-point
widget variants (JsonSliderImplFixed<Q16x16>) so Low-memory
sketches still have working sliders.
src/platforms/shared/ui/json/json_console.cpp.hpp:
* Tighten the existing SKETCH_HAS_LARGE_MEMORY gate to
SKETCH_HAS_LARGE_MEMORY && FL_JSON_HAS_FLOAT. JsonConsole parses
serial input through strtod and routes float values into
json::set(key, float); the secondary gate makes the TU drop out
under user opt-out via -DFL_JSON_HAS_FLOAT=0 on a Large-memory
part too.
Note on local verification: lint passes; the worktree's `bash test`
runner is blocked by a Windows-worktree meson_native.txt lifecycle
race against ninja regeneration (file gets purged between meson setup
and the first build action) — relying on PR CI for the test/compile
matrix.
Closes#3029.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
0 commit comments