Skip to content

Latest commit

 

History

History
107 lines (79 loc) · 3.3 KB

File metadata and controls

107 lines (79 loc) · 3.3 KB

Building A-COM from Source

Prerequisites

  • PlatformIO — install via VS Code extension or CLI
  • M5Stack Core2 device
  • USB-C cable (data)

Quick build

# Install PlatformIO CLI (if not using VS Code)
pip install platformio

# Build
pio run

# Build + upload to connected Core2
pio run -t upload

# Open serial monitor (115200 baud)
pio device monitor

The compiled firmware will be at: .pio/build/m5stack-core2/firmware.bin

Project structure

source/
├── platformio.ini       # PlatformIO config (board, libraries)
├── codes.txt            # DigiROM protocol reference
├── src/
│   └── main.cpp         # Main application (UI, menus, flow)
└── lib/
    ├── acom/            # A-COM specific modules
    │   ├── acom_ui.h    # UI primitives (buttons, lists, header)
    │   ├── digirom_codes.h        # Hardcoded DigiROM tables
    │   ├── sd_digirom_db.h        # SD card JSON database loader
    │   └── acom_settings.h        # Settings persistence
    └── dmcomm/          # DMComm protocol library (modified)
        ├── dmcomm_controller.h    # Main protocol orchestrator
        ├── dmcomm_classic_comm.h  # V-type and X-type comm
        ├── dmcomm_color_comm.h    # C-type (Color) comm
        ├── dmcomm_pin_control.h   # GPIO + ADC abstraction
        └── dmcomm_digirom.h       # DigiROM string parser

Dependencies

platformio.ini declares these libraries (auto-installed by PlatformIO):

  • M5Core2 — official M5Stack Core2 board library
  • ArduinoJson — JSON parsing for SD database

Customizing

Change the boot version string

Edit src/main.cpp:

#define ACOM_VERSION "1.2.0"

The firmware binary embeds "A-COM v1.2.0" as a searchable marker, used by the OTA update screen to display the new version before flashing.

Add new hardcoded codes

Edit lib/acom/digirom_codes.h — append to the vpetBattles[], pendulumBattles[], progressBattles[], jogressCodes[], or eggCodes[] arrays.

Change UI colors

Edit lib/acom/acom_ui.h — the CLR_* defines are RGB565 values:

#define CLR_BG       0x18A1   // background
#define CLR_HEADER   0x4A00   // header bar
#define CLR_ACCENT   0xFC60   // bright orange (Greymon body)
#define CLR_BTN      0x3186   // button background
#define CLR_BTN_HL   0xD380   // selected button

Add a new device to the SD database

  1. Edit ../sdcard/digirom_db.json — add a new device block
  2. Add corresponding sprite PNGs to ../sdcard/images/<device_id>/
  3. Reload the SD card; the new device appears in the device list

To prepare from a GIF source set, use tools/prep_sd.py.

Troubleshooting build issues

Error Cause / Fix
AXP192_ADDR redefined warning Harmless — M5Core2 lib defines it; we redefine for clarity
ArduinoJson errors Ensure lib_deps in platformio.ini includes bblanchon/ArduinoJson@^7.0.0
Missing M5Core2 Run pio pkg install to fetch dependencies
Out of flash Reduce SD database or trim debug strings

License

Source code is MIT licensed. The DMComm protocol library (in lib/dmcomm/) is derived from the original DMComm project by BladeSabre, also under MIT.