This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the CC_G5 project - a MobiFlight custom firmware device that implements a glass cockpit G5-style attitude indicator display for flight simulation. The device combines an ESP32-S3 microcontroller with an LCD display to show compass headings, CDI (Course Deviation Indicator), glide slope information, and navigation data.
- Primary MCU: ESP32-S3 DevKitC-1 with PSRAM
- Display: 4-inch LCD with LovyanGFX graphics library
- Secondary MCU: RP2040 for rotary encoder interface via I2C
- Communication: I2C between ESP32 and RP2040, Serial/USB to PC
- CC_G5: Primary display controller (
CC_G5/CC_G5.h|.cpp) - handles all display rendering, navigation data processing, and graphics updates - MFCustomDevice: MobiFlight integration layer (
CC_G5/MFCustomDevice.h|.cpp) - manages device lifecycle and message handling - CC_EncoderInterface: I2C encoder interface (
CC_G5/CCi2c.h|.cpp) - handles rotary encoder input from RP2040
- Uses LovyanGFX library for high-performance graphics
- Multiple sprite layers for complex overlays:
- Compass background with rotating tick marks
- CDI pointer and deviation bars
- Glide slope indicators
- Navigation mode indicators
- Text overlays for headings and distances
- GPS Mode: Shows GPS navigation data (magenta indicators)
- NAV Mode: Shows VOR/ILS navigation data (green indicators)
- CDI Scale Types: Multiple approach types (ENR, TERM, VNAV, LP, LOC, etc.)
- Primary config:
platformio.ini- includes core MobiFlight dependencies - Custom config:
CC_G5/CC_G5_platformio.ini- device-specific environment
# Build all environments
pio run
# Build specific CC_G5 environment
pio run -e ccrawford_cc_g5_esp32s3
# Clean build
pio run -t clean
# Upload firmware
pio run -t uploadget_version.py: Sets firmware version from environment variablesget_CoreFiles.py: Downloads MobiFlight core firmware sourcecopy_fw_files.py: Packages firmware files and creates distribution ZIP
- LovyanGFX: High-performance graphics library for ESP32
- MobiFlight Core: Base firmware framework (version controlled via
custom_core_firmware_version) - ESP32 Arduino Core: Platform framework
The device receives navigation data via MobiFlight's message system. Key message IDs in CC_G5::set():
- Message 0: Heading angle
- Message 1: Heading bug angle
- Message 2: CDI direction
- Message 3: CDI to/from indicator
- Message 4: CDI offset
- Message 5: Glide slope indicator
- Message 6: Ground speed
- Message 9: Navigation source (GPS=1, NAV=0)
updateCommon(): Main display refreshupdateGps(): GPS mode specific displaysupdateNav(): NAV mode specific displays- Individual draw functions for each display element
- ESP32 acts as I2C master, RP2040 as slave at address 0x08
- Interrupt-driven data reading on GPIO17
- 3-byte protocol: encoder delta, encoder button, extra button
CC_G5/CC_G5.h|.cpp: Main device implementationCC_G5/MFCustomDevice.h|.cpp: MobiFlight integrationCC_G5/CCi2c.h|.cpp: I2C encoder interface
CC_G5/4inchLCDConfig.h: Display configurationCC_G5/MFCustomDevicesConfig.h: Device type definitions
CC_G5/Sprites/: 16-bit color sprite imagesCC_G5/Images/: Font and 1-bit imagesCC_G5/Community/: MobiFlight connector configuration files
CC_G5/Scripts/: Python image conversion utilities
- Add message ID case in
CC_G5::set() - Add corresponding member variable
- Update appropriate draw function
- Test in both GPS and NAV modes
- Modify draw functions in
CC_G5.cpp - Update sprite definitions if needed
- Consider both color modes (GPS=magenta, NAV=green)
- Test rotation and positioning calculations
- Update protocol in both ESP32 (
CC_G5.cpp) and RP2040 code - Modify interrupt handling if needed
- Update
CCi2c.h|.cppfor interface changes
- Current branch:
i2c-support- implementing I2C encoder interface - Main development typically done on feature branches
- Many modified files indicate active development phase