Repository navigation
refactor(system): introduce FL_PLATFORM_HAS_*_MEMORY canonical names (closes #3000) - #3019
Conversation
…loses #3000) The memory-tier classification macros are named `SKETCH_HAS_*_MEMORY`, but they describe *platform* memory capacity, not anything about a user sketch. The name was misleading — and worse, it implied that sketches could/should override the value when in practice it is silicon-derived (with a build-flag escape hatch). This commit promotes `FL_PLATFORM_HAS_*_MEMORY` to the canonical spelling and re-derives the legacy `SKETCH_HAS_*_MEMORY` names as deprecated aliases. Both spellings continue to evaluate identically; external user sketches keep compiling unchanged. Changes (single file — `src/fl/system/sketch_macros.h`): * `FL_PLATFORM_HAS_TINY_MEMORY` is now the source of truth (was `SKETCH_HAS_TINY_MEMORY`). * `FL_PLATFORM_HAS_LARGE_MEMORY` is now the source of truth (was `SKETCH_HAS_LARGE_MEMORY`). * `FL_PLATFORM_HAS_HUGE_MEMORY` is now the source of truth (was `SKETCH_HAS_HUGE_MEMORY`). * `FL_PLATFORM_HAS_*_MEMORY_OVERRIDDEN` likewise. * Override detection accepts **either** spelling on the build-flag side — `-DSKETCH_HAS_LARGE_MEMORY=1` and `-DFL_PLATFORM_HAS_LARGE_MEMORY=1` are equivalent inputs, and setting one defines the other plus the `_OVERRIDDEN` marker. * `SKETCH_HAS_*_MEMORY` / `SKETCH_HAS_*_MEMORY_OVERRIDDEN` / `SKETCH_HAS_LOTS_OF_MEMORY` / `SKETCH_HAS_VERY_LARGE_MEMORY` are preserved as backward-compat aliases via `#ifndef` + `#define` chains pointing at the canonical FL_PLATFORM_HAS_* names. The ~50 internal callers in `src/`, `examples/`, `tests/`, and `ci/` that still spell the macro `SKETCH_HAS_*_MEMORY` are intentionally NOT touched in this PR — they keep working via the alias path. Each subsystem (audio, log, system, channels, platforms, examples, CI tooling) will migrate to the canonical name in its own focused follow-up PR, where the diff is reviewable in isolation. The issue body's explicit requirement that the rename "MUST keep the old SKETCH_HAS_* names working as deprecated aliases" is satisfied by this single-file change today; the migration of internal users is a series of mechanical follow-ups that can land independently. Open question from the issue body (`FL_PLATFORM_HAS_*` vs `FL_HAS_*`): I went with the issue's recommendation (`FL_PLATFORM_HAS_*`) because the tier is a property of the target platform/MCU, and the `FL_PLATFORM_` prefix matches other platform-detection macros. If a maintainer prefers `FL_HAS_*`, the alias chain means that future rename is also non-breaking — just re-point the SKETCH_HAS_* aliases to the new name and either maintain both `FL_PLATFORM_HAS_*` and `FL_HAS_*` as duplicates or deprecate one in favour of the other. Closes #3000. Test plan: * `bash lint` — clean. * `bash test fl_log --cpp` — passes (uses `FASTLED_LOG_RUNTIME_ENABLED` which is gated on `SKETCH_HAS_LARGE_MEMORY` via the alias). * `bash test power --cpp` — passes (`power_mgt.cpp.hpp` keys off `SKETCH_HAS_LARGE_MEMORY` via the alias). * `bash autoresearch lpc845brk --upload-port COM10 --skip-lint --timeout 5` — LPC845 firmware still builds (text 62.16 KB / 64 KB; same byte-for-byte as before, confirming the aliases are zero-overhead) and the bring-up RPC test passes on real hardware. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesMemory Tier Macro Rename (sketch_macros.h)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The memory-tier classification macros are named
SKETCH_HAS_*_MEMORY, but they describe platform memory capacity, not anything about a user sketch. The name was misleading — and worse, it implied that sketches could/should override the value when in practice it is silicon-derived (with a build-flag escape hatch).This PR promotes
FL_PLATFORM_HAS_*_MEMORYto the canonical spelling and re-derives the legacySKETCH_HAS_*_MEMORYnames as deprecated aliases. Both spellings continue to evaluate identically; external user sketches keep compiling unchanged.Changes (single file —
src/fl/system/sketch_macros.h)FL_PLATFORM_HAS_TINY_MEMORY/FL_PLATFORM_HAS_LARGE_MEMORY/FL_PLATFORM_HAS_HUGE_MEMORYare now the source-of-truth defines (plus the_OVERRIDDENvariants).-DSKETCH_HAS_LARGE_MEMORY=1and-DFL_PLATFORM_HAS_LARGE_MEMORY=1are equivalent inputs, and setting one defines the other plus the_OVERRIDDENmarker.SKETCH_HAS_*_MEMORY/SKETCH_HAS_*_MEMORY_OVERRIDDEN/SKETCH_HAS_LOTS_OF_MEMORY/SKETCH_HAS_VERY_LARGE_MEMORYare preserved as backward-compat aliases via#ifndef+#definechains pointing at the canonicalFL_PLATFORM_HAS_*names.The ~50 internal callers in
src/,examples/,tests/, andci/that still spell the macroSKETCH_HAS_*_MEMORYare intentionally NOT touched in this PR — they keep working via the alias path. Each subsystem will migrate to the canonical name in its own focused follow-up PR, where the diff is reviewable in isolation. The issue body's explicit requirement that the rename "MUST keep the oldSKETCH_HAS_*names working as deprecated aliases" is satisfied by this single-file change today.Open question from the issue (
FL_PLATFORM_HAS_*vsFL_HAS_*)Went with the issue's recommendation (
FL_PLATFORM_HAS_*) because the tier is a property of the target platform/MCU, and theFL_PLATFORM_prefix matches other platform-detection macros. If a maintainer prefersFL_HAS_*, the alias chain means that future rename is also non-breaking — just re-point theSKETCH_HAS_*aliases to the new name.Test plan
bash lint— clean.bash test fl_log --cpp— passes (usesFASTLED_LOG_RUNTIME_ENABLEDwhich is gated onSKETCH_HAS_LARGE_MEMORYvia the alias).bash test power --cpp— passes (power_mgt.cpp.hppkeys offSKETCH_HAS_LARGE_MEMORYvia the alias).bash autoresearch lpc845brk --upload-port COM10 --skip-lint --timeout 5— LPC845 firmware still builds (text 62.16 KB / 64 KB; same byte-for-byte as before, confirming the aliases are zero-overhead) and the bring-up RPC test passes on real hardware.Closes #3000.
🤖 Generated with Claude Code
Summary by CodeRabbit