Conversation
M5Unified 0.2.21 replaced IOExpander_Base::setPullMode(pin, bool) with
setPullMode(pin, gpio_pull_t), so the library no longer compiled against it
("cannot convert bool to m5::IOExpander_Base::gpio_pull_t" in M5StamPLC.cpp
and modules/M5StamPLC_AC.cpp).
Call the new form (false -> pull_down, true -> pull_up) and require
M5Unified >= 0.2.21 in library.properties / library.json so the dependency
is resolved by the Library Manager and PlatformIO. The old bool form only
selected the pull direction and left the pull enable bit at its reset
default (enabled) during init, so pull_up / pull_down keep the same register
state.
ainyan03
force-pushed
the
ioexpander_m5unified_0_2_21
branch
from
August 28, 2026 07:39
1995388 to
7f539df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
M5Unified 0.2.21 changed the
IOExpander_Basepull API:setPullMode(pin, bool)andenablePull(pin, bool)were replaced bysetPullMode(pin, gpio_pull_t)(pull_none/pull_up/pull_down). M5StamPLC 1.2.0 calls the old form in five places, so it no longer compiles against the current M5Unified release:(Same class of problem as m5stack/StackChan-BSP#12 for StackChan-BSP.)
Change
setPullMode(pin, false)→pull_down,setPullMode(pin, true)→pull_up.depends=M5Unified (>=0.2.21)inlibrary.propertiesand"M5Unified": ">=0.2.21"inlibrary.json, so the Library Manager and PlatformIO install a matching M5Unified instead of failing at compile time.The register state is unchanged: the old bool form only wrote the PI4IOE5V6408 pull-select register (0x0D) and relied on the pull-enable register (0x0B) being at its reset default (all enabled) during init;
pull_up/pull_downwrite the same select bit and set the enable bit that was already set.M5.begin()does not touch the pull state of pins 4–6 beforeio_expander_a_init(), and the AC module's expander is freshly constructed.Verification
Compiled a sketch calling
M5StamPLC.begin()with PlatformIO (pioarduino 55.03.34,m5stack-stamps3, Arduino) against M5Unified 0.2.21 (develop) + M5GFX 0.2.28: fails on the unmodified library with the errors above, builds with this change.clang-format --dry-runreports no differences for the touched files.Note on the
Build ExamplesworkflowIt cannot validate this change at the moment: with the current
m5stack:esp32"latest" core (esp32s3-libs 3.3.9) every example already fails onmainin the SDK's esp-modbus header (mb_port_types.h:118: ISO C++ forbids declaration of '_Atomic'), reached throughM5StamPLC.h→mbcontroller.h, before any library code is compiled (the last green run used esp32s3-libs 3.3.7). I reproduced that on my fork for bothmainand this branch (identical failure). That is a core/SDK problem independent of this PR; pinning the core version in the workflow would be a separate change.clang-format Checkpasses on this branch.