mirror of
https://github.com/meshtastic/firmware.git
synced 2026-08-01 19:08:59 -04:00
DEBUG_MUTE (set for all of stm32) already compiles every LOG_* call out entirely at the preprocessor stage, but nanopb's own error-message strings are a separate mechanism it doesn't touch - PB_RETURN_ERROR still embeds descriptive text in .rodata regardless of whether anything ever logs it. Rather than hardcoding -DPB_NO_ERRMSG=1 next to every place DEBUG_MUTE is set, derive it in bin/platformio-custom.py via the SCons build environment, mirroring the existing meshtastic-device-ui/APP_VERSION CPPDEFINES pattern already in that file. This reaches both the main project env and the Nanopb library builder specifically, since nanopb is a separate LibraryBuilder whose own CPPDEFINES aren't otherwise touched by a plain env.Append() on the app env. The CPPDEFINES membership check normalizes both bare (-DDEBUG_MUTE) and value-bearing (-DDEBUG_MUTE=1) forms, since SCons represents the latter as a tuple. DEBUG_MUTE currently only appears in variants/stm32/stm32.ini and variants/stm32/milesight_gs301/platformio.ini, so today this only affects stm32wl builds - but it will apply automatically to any future platform that sets DEBUG_MUTE too, without that platform's .ini needing to know about the pairing. Saves 1,248 bytes flash on wio-e5, no RAM change, no feature loss beyond terser protobuf decode/encode error text. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Yong <me@ndoo.sg>
16 KiB
16 KiB