Skip to content

Clean up board detection leftovers and panel checks - #312

Merged
lovyan03 merged 4 commits into
m5stack:developfrom
ainyan03:detect_cleanup
Sep 27, 2026
Merged

lovyan03 merged 4 commits into
m5stack:developfrom
ainyan03:detect_cleanup

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

Summary

Follow-up cleanup after the board detection framework (#311): remove what the legacy autodetect chain left behind in M5GFX.cpp, and move the remaining panel checks of Core2 / Tough, CoreS3 and Tab5 to the same shape as the other boards. About 510 lines are removed in total.

Changes

  • Remove legacy leftovers from M5GFX.cpp: unused soft I2C / SD / reset helpers, SPI bus settings that were filled in but never applied, and the placeholder Bus_SPI created before detection. Removing the placeholder also fixes a failed re-detection restoring the previous panel with an already freed bus.
  • Core2 / Tough: confirmed by the AXP ID and the Station exclusion; the ILI9342C/E check and the Tough touch probe run after the PMIC power sequence. No PMIC register is written before confirmation, so the register backup/restore code is gone. Because AXP192 is shared with Station, an attempt where neither the Core2 panel nor the Tough touch answers fails and retries instead of storing Core2.
  • CoreS3: the ILI9342C/E keys are read with the same software SPI sequence as Core2, before construction (the LCD bus is 3-wire, so reads return on MOSI). The hardware-SPI panel ID helpers are removed from M5GFX.cpp.
  • Tab5: the panel is selected from the touch controller (ST firmware 1 → ST7121, 3 → ST7123, GT911 → ILI9881C); the 80 ms wait and the repeated DSI ID reads run only when no touch controller answers.
  • ToughC5 and NessoN1 no longer read the panel ID only to log a warning.

Behavior changes

  • An AXP2101 Core2 whose panel does not answer the ID read is still detected as Core2 (variant defaults to ILI9342C).
  • If the PMIC power sequence fails, the refine stage is skipped and a Tough is built as Core2 (same as the CoreS3 family).
  • Tab5 startup is at least 80 ms shorter when the touch controller answers.

Testing

  • Hardware, repeated resets per unit, every boot detected through the framework with the expected panel variant:
    • Core2 v1.0 / v1.1 (ILI9342C) / v1.3 (ILI9342E) / AWS, Tough, Station
    • Station with its LCD ID read forced to fail: detection retries and ends unknown instead of storing Core2
    • CoreS3 (ILI9342C, ILI9342E), CoreS3 SE (2 units)
    • Tab5 with ST7123 and with GT911 / ILI9881C, including power-cycle starts
    • ToughC5
  • Builds: the upstream CI matrix and the board catalog checks pass on the fork.

All boards are detected through the board detection framework, so the
helpers and settings kept for the removed per-board blocks are unused:
the soft I2C probe helpers, the SD SPI-mode and panel reset helpers, an
unused I2C port constant, an unused include, and the SPI bus settings
that autodetect() filled in but never applied.

autodetect() also no longer replaces _bus_last with an unconfigured
Bus_SPI before probing. A successful detection installs its own bus; when
a re-detection ended unknown, the previous panel was restored while its
bus had already been freed by that placeholder.
The Core2 family is now confirmed by the AXP192 / AXP2101 ID and the
Station exclusion. The ILI9342C / ILI9342E check and the Tough touch
probe run in the refine stage after the PMIC power sequence, as on the
CoreS3 family. No PMIC register is written before confirmation, so the
register backup and restore paths are removed.

AXP192 is shared by Core2 v1.0, Tough and Station, and Station is told
apart only by its LCD ID. When that read misses and the Core2 panel and
the Tough touch controller do not answer either, the attempt fails and
detection retries instead of storing Core2. An AXP2101 Core2 whose panel
does not answer is still detected as Core2 (the variant then defaults
to ILI9342C).
The touch controller identifies the panel: ST touch firmware 1 means
ST7121, 3 means ST7123, and a GT911 means ILI9881C. Use that result
directly, without the 80 ms wait and the DSI ID reads that repeated the
check. Only when no touch controller answers, fall back to the DSI ID
read for ILI9881C as before.
Read the ILI9342C / ILI9342E keys with the same software SPI sequence as
Core2, from the refine stage, and pass the result to construction as an
option bit. The LCD bus is 3-wire, so read data returns on MOSI. This
removes the hardware-SPI panel ID helpers from M5GFX.cpp, and the
construction now starts the bus at its normal 40 / 16 MHz.

ToughC5 and NessoN1 no longer read the panel ID only to log a mismatch
warning; the result never affected detection.
@lovyan03
lovyan03 merged commit 7d067a8 into m5stack:develop Sep 27, 2026
29 checks passed
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