feat: migrate from M5StickCPlus to M5Unified, add M5StickS3 support#3
feat: migrate from M5StickCPlus to M5Unified, add M5StickS3 support#3imliubo wants to merge 3 commits into
Conversation
|
We really need this PR. Since we're migrating to the more powerful M5StickCPlus2 and its power management module has fundamentally changed, M5Unified seems like the better approach. |
|
Awesome! This M5Unified migration is exactly what we need — a unified API that lets the same codebase run on both C Plus and S3. Looking forward to the merge, I have my M5StickS3 ready to flash 👍 |
|
Hi, I'm testing this on Windows 11 with M5StickC Plus. With the original firmware, I get Serial log: Does this branch fix the Windows BLE issue, or is this a known problem |
|
Verified on S3: Build & flash via pio run -e m5stack-sticks3 -t upload succeed But can not trigger it because I do not have a pro subscription... Trying to get it work with local claude code now.. |
|
@imliubo Thanks for the great work! Two observations on M5StickS3 from the device info screen:
|
|
Hi @eMUQI Thanks for those feedback.
I will test and try find the reason.
Yes, it's hardware limitation, we can't read the charge/discharge current. |
|
Hi @knottttt, I didn't test it with Windows PC, I assume this is a Windows problem. |
- Add a fork note at the top linking the upstream repo and PR anthropics#3. - Flashing section now shows the per-env commands (m5stickc-plus vs m5stack-sticks3) and documents the S3's TinyUSB port-rename quirk plus the 1200-baud touch for forcing bootloader entry. - Controls section mentions how hotkey mode re-routes Hold A/B. - New "Hotkey mode" section covers enabling, the four modifier presets, behavior, and a Keyboard Viewer / Ctrl+click smoke test.
|
Hi @felixrieseberg , |
|
Hope you will add support for StackChan (basically S3Core with stepper motors) as well. |
|
Hi @imliubo, thanks again for your work on this PR. I tested it on an M5StickS3, but I’m not sure whether these issues were introduced by this PR or if they were already present in the project. I’m currently seeing a few problems on StickS3:
Here is a preliminary revision(by codex) for your reference: http://github.com/eMUQI/claude-desktop-buddy/commit/bd5efae2d57dab0bb2a1d274232b12732da52403 |
|
Hi @eMUQI ,
It seems the time only updates after connecting to Claude Desktop. I need to think about how to test this, because I don't have access to Claude.
It looks only happen when after charge to full? If in charging state(battery voltage < 4.1v) it was stable. Because StickS3 don't have real PMIC, we detect the charge IC(LGS4056) charge state pin as the charge status, so it maight be a little unstable.
Yes, the brightness setting looks not saved. I've reviewed your code, and it looks like the modifications are quite complete. Perhaps you could merge the code directly into this PR? |
|
Hi @eMUQI, thanks again for the detailed testing and the patch! I found a way to connect to Claude Desktop and I've tested your changes locally on M5StickS3 and everything works well — the clock no longer reboots when standing upright on USB power, the orientation now matches the device posture, the charging status is stable, and the brightness setting persists across reboots.
I've cherry-picked your commit (bd5efae) onto this PR with original authorship preserved, and will continue the PR from here. Credit goes to you for the fix. 🙌 Thank you very much for your detailed testing and explanation. |
|
@imliubo could you please sign your commits? We require all code to be signed. Thank you! |
ad72036 to
5d04fe3
Compare
|
@felixrieseberg Done! I've amended ad72036 to include the Signed-off-by trailer and force-pushed the branch. All three commits now carry the signature. Sorry for the oversight! |
|
Hi @felixrieseberg , let me know if there’s anything I should update or improve. Thanks! |
|
@imliubo could you plz merge? It seems to be approved by @felixrieseberg |
Replace the M5StickCPlus-specific library with M5Unified + M5GFX so the same codebase runs on M5StickC Plus and M5StickS3. platformio.ini: - Extract shared config into [env], add [env:m5stack-sticks3] with PSRAM, USB-CDC and M5PM1 power management lib API migration (all source files): - M5StickCPlus.h → M5Unified.h - TFT_eSprite / TFT_eSPI → M5Canvas / lgfx::v1::LGFXBase - M5.Axp.* → M5.Power.* / M5.Lcd.* - M5.Beep → M5.Speaker - M5.Imu.getAccelData → M5.Imu.getAccel - M5.Axp.GetBtnPress() → M5.BtnPWR.wasClicked() - RTC_TimeTypeDef/RTC_DateTypeDef → m5::rtc_time_t/m5::rtc_date_t - LittleFS.begin(false) → begin(true) for auto-format on first boot Hardware adaptation: - Guard LED_PIN behind CONFIG_IDF_TARGET_ESP32S3 (S3 has no user LED) - Remove AXP192-specific temp readout - Use M5.Power.getBatteryLevel() instead of manual voltage calculation Signed-off-by: imliubo <imliubo@makingfun.xyz>
Avoid formatting LittleFS on the first mount attempt so existing pet data is not wiped after a firmware upgrade when the filesystem fails to mount cleanly. Only fall back to a format/remount path when the filesystem still isn't accessible. Also restore the previous USB-power semantics for clock and screen-off behavior by tracking VBUS presence separately from charging state. This prevents a fully charged device that remains plugged into USB from auto- blanking once charging current stops. Signed-off-by: imliubo <imliubo@makingfun.xyz>
…ss setting (cherry picked from commit bd5efae) Signed-off-by: imliubo <imliubo@makingfun.xyz>
5d04fe3 to
6d28f2c
Compare
|
Hi @maxromanovsky , thanks for the nudge! I had misunderstood the signing requirement earlier — only added the Signed-off-by trailer instead of cryptographically signing the commits. All three commits are now signed with SSH (ED25519) and should show as Verified. @felixrieseberg sorry for the back-and-forth — could you take another look and merge when you have a moment? No code changes since your approval, only signatures. Thanks! |




Migrate from M5StickCPlus to M5Unified — add M5StickS3 support
Summary
Replace the M5StickCPlus-specific library with M5Unified + M5GFX, enabling the same codebase to run on both M5StickC Plus and M5StickS3 without conditional compilation for core functionality.
Changes
Build system (
platformio.ini)[env][env:m5stack-sticks3]with PSRAM, USB-CDC, and M5PM1 power managementAPI migration (all source files)
M5StickCPlus.hM5Unified.hTFT_eSprite/TFT_eSPIM5Canvas/lgfx::v1::LGFXBaseM5.Axp.*M5.Power.*/M5.Lcd.*M5.BeepM5.SpeakerM5.Imu.getAccelData()M5.Imu.getAccel()M5.Axp.GetBtnPress()M5.BtnPWR.wasClicked()RTC_TimeTypeDef/RTC_DateTypeDefm5::rtc_time_t/m5::rtc_date_tLittleFS.begin(false)LittleFS.begin(true)(auto-format on first boot)Hardware adaptation
LED_PINwithCONFIG_IDF_TARGET_ESP32S3(S3 has no user LED)M5.Power.getBatteryLevel()instead of manual voltage-to-percentage calculationTested on