Skip to content

M5Stack Unit C6L: display support, dual-firmware OTA switching#1885

Open
TheRealHaoLiu wants to merge 5 commits intomeshcore-dev:mainfrom
TheRealHaoLiu:main-m5stack-unit-c6l
Open

M5Stack Unit C6L: display support, dual-firmware OTA switching#1885
TheRealHaoLiu wants to merge 5 commits intomeshcore-dev:mainfrom
TheRealHaoLiu:main-m5stack-unit-c6l

Conversation

@TheRealHaoLiu
Copy link

@TheRealHaoLiu TheRealHaoLiu commented Mar 1, 2026

Summary

Complete M5Stack Unit C6L support with correct hardware configuration, display, and dual-firmware OTA switching. This is a superset of #1884 — includes all the pin/IO expander fixes plus additional features.

Note: This PR includes all fixes from #1884. Merge one or the other, not both.

Hardware fixes (same as #1884)

  • Correct I2C pins, TCXO voltage, NeoPixel, USB CDC
  • Add PI4IO I2C GPIO expander support
  • Remove incorrect SX126X_RXEN
  • Fix ESP32-C6 BLE build (esp_mac.h)

New features

  • SSD1306 64x48 SPI display driver: New SSD1306SPIDisplay class with fix for Adafruit library missing 64x48 COM pins configuration
  • Dual-firmware OTA switching: Hold BOOT button during power-on to switch between repeater and companion firmware stored in separate OTA partitions, with buzzer feedback
  • Repeater display UI: Boot screen, node name with marquee scrolling, radio parameters, I2C expander button wake
  • Companion display UI: Boot screen, BLE PIN display, node name with marquee scrolling, frequency, unread message count
  • File organization: Variant-specific UITasks in companion/ and repeater/ subdirectories

Test plan

  • Repeater and companion builds compile
  • Tested on actual M5Stack Unit C6L hardware
  • OTA partition switching works via BOOT button hold
  • Display renders correctly on 64x48 SSD1306 OLED
  • Marquee scrolling works for long node names
  • Button wakes display after auto-off
  • Both firmware identities preserved independently in SPIFFS

🤖 Generated with Claude Code

@TheRealHaoLiu TheRealHaoLiu marked this pull request as draft March 1, 2026 03:26
@TheRealHaoLiu TheRealHaoLiu force-pushed the main-m5stack-unit-c6l branch 3 times, most recently from 21991cb to 7f42d19 Compare March 1, 2026 03:52
TheRealHaoLiu and others added 5 commits February 28, 2026 22:55
Add companion_radio_ble build for M5Stack Unit C6L (ESP32-C6 with SX1262).

Features:
- PI4IO I/O expander support for LoRa RF control (LNA, RF switch, reset)
- Button input via I/O expander
- Buzzer support
- US/Canada frequency preset (910.525 MHz, SF7, BW62.5, CR5)
- BLE companion radio interface

Hardware pins:
- SPI: SCLK=20, MISO=22, MOSI=21, NSS=23
- LoRa: DIO1=7, BUSY=19, reset via I/O expander
- I2C: SDA=10, SCL=8
- NeoPixel TX LED: GPIO2
- Buzzer: GPIO11

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add SSD1306SPIDisplay driver with lazy initialization for SPI bus sharing
- Add minimal UITask for 64x48 display showing PIN, node name, frequency
- Share SPI bus between LoRa radio and display with spi_initialized flag
- Support display auto-off after 30 seconds and button wake

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename companion_radio_ble env to follow naming conventions
- Add m5stack_unit_c6l_repeater with packet logging
- Add m5stack_unit_c6l_room_server with packet logging
- All environments use matching LoRa settings (910.525MHz, SF7, BW62.5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…Unit C6L

- Add OTA partition switching via BOOT button hold during startup,
  allowing switching between repeater and companion firmware without
  reflashing. Buzzer feedback indicates switch or error.
- Fix SSD1306 64x48 display garbled output by setting correct COM pins
  configuration (0x12) after Adafruit library init, which lacks a 64x48
  case. Disable text wrap to prevent long text from overflowing.
- Fix ESP32-C6 BLE build by adding missing esp_mac.h include for
  esp_efuse_mac_get_default().
- Add display support to repeater build with C6L-specific UITask
  featuring boot screen, marquee scrolling for long node names,
  and I2C expander button wake.
- Add boot screen to companion UITask showing MeshCore version and
  mode, with marquee scrolling and unread message count.
- Reorganize variant UITask files into companion/ and repeater/
  subdirectories for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix strdup memory leak in repeater UITask: use stack buffer instead
- Remove redundant _display null check in companion UITask (already
  guarded at top of loop())
- Remove redundant build_src_filter exclusions in companion, repeater,
  and room_server envs (base config already handles them)
- Remove repeater UITask.h copy: include original header directly via
  relative path instead of maintaining a duplicate
- Remove unused -I flag for repeater subdirectory
- Delete upstream UnitC6LBoard.h/cpp (replaced by M5StackUnitC6LBoard)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant