Skip to content

Fix the build on ESP targets without board detection and on SDL - #356

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:detect_build_fixes
Oct 15, 2026
Merged

lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:detect_build_fixes

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

ESP targets without board detection (ESP32-S2, for example)

  • M5GFX.cpp failed to compile: the detection headers and helpers were guarded by the list of supported targets, but init_impl() and autodetect() used them unconditionally ('select_fixed_board' was not declared in this scope, ...).
  • A single internal macro now selects the detection path. On the other targets no detection runs and the board stays board_unknown, as in 0.2.33; a fixed_board request is refused with a warning. These targets now also skip NVS reads and writes.

SDL

  • setDetectConfig() was defined only inside the ESP section, so calling it failed to link (M5Unified::begin() always calls it).
  • It is now defined for every platform. SDL init uses fixed_board when it is set, then M5GFX_BOARD, then the previous default.

The host tests in extras/board_spec that compile excerpts of M5GFX.cpp define the new macro.

Testing

  • ESP32-S2 (Arduino 2.x): builds again.
  • SDL: a sketch that calls setDetectConfig() and init() links.
  • Local build matrix of the versions used by this repository's CI (all supported chips, Arduino and ESP-IDF): all passed, no new warnings. extras/board_spec: npm test and npm run check passed. CI on the fork: passed.

M5GFX.cpp failed to compile on ESP targets that have no board detection
package (ESP32-S2, for example): the detection headers and helpers were
guarded by the list of supported targets, but init_impl() and
autodetect() used them unconditionally. A single internal macro now
selects the detection path. On the other targets no detection runs and
the board stays board_unknown, as in 0.2.33; a fixed_board request is
refused with a warning. Unsupported targets now also skip NVS reads and
writes, whereas 0.2.33 performed unsuccessful detection and could write
the unknown result back to NVS.

On SDL, setDetectConfig() was defined only inside the ESP section, so
calling it (M5Unified::begin() always does) failed to link. It is now
defined for every platform. SDL init uses fixed_board when it is set,
then M5GFX_BOARD, then the previous default.
@lovyan03
lovyan03 merged commit 75acc9a into m5stack:develop Oct 15, 2026
26 checks passed
@ainyan03
ainyan03 deleted the detect_build_fixes branch October 15, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants