From 72d3ad7393a990c6ea029d9144fb5c8625fe0f38 Mon Sep 17 00:00:00 2001 From: luoweiyuan Date: Fri, 17 Jul 2026 18:19:34 +0800 Subject: [PATCH] Add M5StampP4X board detection Stamp-P4 and Stamp-P4X differ only by the ESP32-P4 silicon revision. Detect revision 300 and later as Stamp-P4X while keeping earlier revisions identified as Stamp-P4. --- src/M5Unified.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/M5Unified.cpp b/src/M5Unified.cpp index 2150c61..879eec9 100644 --- a/src/M5Unified.cpp +++ b/src/M5Unified.cpp @@ -12,6 +12,10 @@ #include #include +#if defined (CONFIG_IDF_TARGET_ESP32P4) +#include +#endif + #if !defined (CONFIG_IDF_TARGET) || defined (CONFIG_IDF_TARGET_ESP32) #if __has_include () #include @@ -1743,7 +1747,13 @@ static constexpr const uint8_t _pin_table_mbus[][31] = { else if(m5gfx::gpio_in(GPIO_NUM_0)) // M5UnitPoEP4 G0 always High board = board_t::board_M5UnitPoEP4; else - board = board_t::board_M5StampP4; + { + esp_chip_info_t chip_info; + esp_chip_info(&chip_info); + board = chip_info.revision >= 300 + ? board_t::board_M5StampP4X + : board_t::board_M5StampP4; + } } #endif