Skip to content

[WIP] Add reliable flashing features and test firmware#28

Merged
Crashkeyz merged 1 commit intomainfrom
copilot/add-flashing-reliability-features
Dec 29, 2025
Merged

[WIP] Add reliable flashing features and test firmware#28
Crashkeyz merged 1 commit intomainfrom
copilot/add-flashing-reliability-features

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Create a non-destructive feature branch off main and open a pull request implementing the following changes to make flashing reliable, add test firmware, OTA support, and a boot splash. Do NOT delete or alter existing branches. Repository: Crashkeyz/UltimatumCardputerKey.

Summary of changes to implement:

  1. platformio.ini
  • Set upload_speed default to 115200 for the m5stack-cardputer env.
  • Add an optional environment [env:m5stack-cardputer-fast] that keeps upload_speed = 921600.
  • Add comments describing OTA upload options and how to enable espota.
  1. Reliable esptool flash scripts
  • Add scripts/flash_esptool.sh (Linux/macOS): accepts PORT, BIN, BAUD; erases flash; writes firmware using esptool for esp32s3; verifies result; exits non-zero on failure; mark executable.
  • Add scripts/flash_esptool.bat (Windows): analogous commands and usage notes.
  1. Test firmware
  • Add src/test_blink/main.cpp: initializes M5Unified, displays "FLASH OK" and toggles every 500ms; prints "FLASH OK" to Serial at 115200. Compatible with the existing m5stack-cardputer env.
  1. OTA example
  • Add src/ota_update/main.cpp: M5Unified init, Wi-Fi provisioning options (compile-time via build flags, data partition file, or serial entry), initialize ArduinoOTA (or esp32s3-compatible OTA), print OTA progress/state to Serial and display. Include README in src/ota_update/README.md describing setup and how to use espota (upload_port, password) and platformio.ini example for espota.
  1. Boot splash
  • Add src/boot_splash/main.cpp or integrate into main startup to display the splash text "HACK THE PLANT!!!" on the M5 display at boot for ~3s and print same message to Serial at 115200. Make the splash text configurable via a #define in a header.
  1. README updates
  • Add sections "Build and Flash", "Use esptool (recommended if M5 Burner stalls)", "M5 Burner notes", "Test firmware", and "OTA Update" with exact commands and troubleshooting steps.
  1. CI workflow
  • Add .github/workflows/build-firmware.yml: builds the m5stack-cardputer env on push/PR, and uploads .bin and .elf as artifacts for download.
  1. Branch & PR
  • Create a new branch named refactor/flash-ota-cleanup from main, push all changes there, and open a pull request from refactor/flash-ota-cleanup into main.
  • The PR description should list changed/added files and include testing steps (build, esptool flash, splash check, OTA check). Do NOT assign the PR.

Testing instructions to include in PR description:

  • pio run -e m5stack-cardputer
  • python -m pip install esptool
  • python -m esptool --chip esp32s3 --port /dev/ttyUSB0 --baud 115200 erase_flash
  • python -m esptool --chip esp32s3 --port /dev/ttyUSB0 --baud 115200 write_flash -z 0x1000 .pio/build/m5stack-cardputer/firmware.bin
  • Verify display shows "FLASH OK" for test firmware and boot splash shows "HACK THE PLANT!!!" on main firmware.
  • OTA: document how to provide Wi-Fi credentials and use PlatformIO espota upload; verify new firmware runs after OTA.

Notes:

  • Do NOT implement any functionality that would bypass authorization or enable unauthorized access. All OTA updates require passwords and secure provisioning as described in the README.
  • Keep changes minimal and well-documented to make review easy.

Please create the PR and respond with the PR URL and a short summary of the files changed and next steps. I will add the Lily repo later when provided to add OTA there as well.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Crashkeyz Crashkeyz marked this pull request as ready for review December 29, 2025 10:50
@Crashkeyz Crashkeyz merged commit 4f91aec into main Dec 29, 2025
0 of 2 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