First capture with the vehicle actually moving (raw/log_20260717_145930.txt, 1857 frames, filtered to 0x0BA + 0x1D2). Verified, closing yesterday's inference: ST_GR_GRB values 6/7/8/9/A observed directly = 2nd..6th. So 0x0BA byte 0's low nibble is a COMPLETE gear source on its own - P/R/N plus 1st..6th, reverse included. 0x1D2 is now needed only for the lever and the D/S/M mode, which 0x0BA does not carry. Value 4 is still unaccounted for. Also caught ST_CCLT (torque converter lockup clutch) live - 422 frames "controlling", clustered in the higher gears. This matters beyond curiosity: a closed clutch bolts the turbine to the impeller, so turbine == engine exactly. Any turbine/engine slip ratio read at road speed must check CCLT first or it will report "not engaged" for a perfectly healthy locked-up box. Decoded into driveline_t with that warning attached. Output shaft: identification now verified (rises monotonically 1139->16702 across gears 1->6, zero whenever the output is held). Scaling narrowed to x0.125 but NOT adopted - it implies a coherent 901->1872 rpm upshift schedule across five independent 6HP26X ratios, where raw-as-rpm would imply 7,200-15,000 rpm against a ~4,500 redline. Still rests on the unproven assumption that each gear's max output is its upshift point, so the field stays in raw counts. One capture including 0x1A2 settles it: turbine/output gives each ratio directly. Gearbox confirmed as ZF 6HP26X (user). Same gearset as the 6HP26, so the ratio table holds; the X is the xDrive output variant, which dates the donor to E60/E61 rather than E65 - the 7-series never took M57N with xDrive. That partly answers a standing open question, and raises a new one: the X box measures its output shaft upstream of the transfer case, so if a Patrol transfer case sits in the path its ratio enters the km/h conversion and changes with high/low range. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ESP32-S3-LCD-5B - PlatformIO Version
Automotive display controller for Waveshare ESP32-S3-Touch-LCD-5B (1024x600 RGB LCD).
Features
- ✅ WiFi - Network scanning with dynamic SSID list
- ✅ UART - Automotive data transmission @ 5Hz (GPIO 43/44)
- ✅ Debug Mode - FPS and CPU metrics display
- ✅ Settings Persistence - NVS storage for toggle states
- ✅ Touch UI - LVGL 8.4.0 with SquareLine Studio UI
- ✅ FreeRTOS - Multi-core architecture (WiFi/UART on Core 0, LVGL on Core 1)
Hardware
- Board: Waveshare ESP32-S3-Touch-LCD-5B
- Display: 1024x600 RGB LCD (5-inch capacitive touch)
- MCU: ESP32-S3 dual-core @ 240MHz
- Flash: 16MB
- PSRAM: 8MB OPI PSRAM
Prerequisites
Install PlatformIO
Option A: VS Code Extension (Recommended)
- Install Visual Studio Code
- Install "PlatformIO IDE" extension from VS Code marketplace
Option B: Command Line
pip install -U platformio
Build & Upload
Using PlatformIO CLI
# Navigate to project directory
cd migrate-to-pio
# Build project (first build downloads libraries - takes ~5 min)
pio run
# Upload to board
pio run --target upload
# Monitor serial output
pio device monitor
# Or combine upload + monitor
pio run --target upload && pio device monitor
Using VS Code
- Open project folder in VS Code
- PlatformIO toolbar will appear at bottom
- Click "Build" (checkmark icon)
- Click "Upload" (arrow icon)
- Click "Serial Monitor" (plug icon)
Project Structure
migrate-to-pio/
├── platformio.ini # PlatformIO configuration
├── partition_table.csv # Partition table (3MB app + 1MB SPIFFS)
├── src/ # Source code (non-UI)
│ ├── main.cpp # Main application
│ ├── automotive_data.h # UART data structures
│ └── lvgl_v8_port.h/cpp # LVGL porting layer
├── ui/ # SquareLine Studio exports
│ └── ui*.h/c # UI files (auto-generated)
├── include/
│ └── lv_conf.h # LVGL configuration
└── .pio/ # Build artifacts (gitignored)
Important: Configure SquareLine Studio to export UI files to the ui/ directory. This prevents the auto-generated UI code from overwriting your custom source files in src/.
Configuration
Partition Scheme
Current: Huge APP (3MB No OTA / 1MB SPIFFS)
- NVS: 20KB (settings storage)
- OTA data: 8KB
- App: 3MB (application code)
- SPIFFS: 1MB (file system)
Edit partition_table.csv to customize partition sizes.
Serial Monitor
- Baud Rate: 115200
- Debug Level: Set in
platformio.ini→CORE_DEBUG_LEVEL- 0 = None
- 1 = Error (default)
- 5 = Verbose
Libraries
Dependencies auto-managed by PlatformIO:
- ESP32_Display_Panel @ 1.0.4
- ESP32_IO_Expander @ 1.1.1
- LVGL @ 8.4.0
Built-in ESP32 libraries:
- WiFi, Preferences, FreeRTOS, TWAI (CAN bus)
Usage
WiFi Configuration
- Navigate to Settings screen
- Toggle WiFi ON
- Wait for network scan (~2-3 seconds)
- Select network from list
- Enter password (if secured)
- Connection status displayed
UART Transmission
- Navigate to Settings screen
- Toggle UART ON
- Data transmits @ 5Hz on:
- TX: GPIO 43
- RX: GPIO 44
- Baud: 115200
Connect UART-to-USB adapter to monitor:
screen /dev/ttyUSB0 115200
# or
minicom -D /dev/ttyUSB0 -b 115200
Debug Metrics
- Navigate to Settings screen
- Toggle Debug ON
- FPS and CPU metrics appear on screen
- Updates every 1 second
Troubleshooting
Build Fails
Issue: Libraries not downloading
# Clear library cache and rebuild
pio lib update
pio run --target clean
pio run
Issue: Partition table not found
- Ensure
partition_table.csvexists in project root - Check
board_build.partitionsinplatformio.ini
Upload Fails
Issue: Port not detected
# List available ports
pio device list
# Specify port manually
pio run --target upload --upload-port /dev/ttyUSB0
Issue: Permission denied on Linux
sudo usermod -a -G dialout $USER
# Log out and back in
Display Issues
Issue: White flash on boot
- Normal - backlight control prevents most flashing
- Optimized in
main.cppsetup sequence
Issue: Screen drift (RGB LCD)
- Handled by high-performance ESP32 libraries
- Platform packages configured in
platformio.ini
Memory Issues
Issue: Heap overflow / crashes
- PSRAM is enabled in board config
- Check
board_build.psram_type = opiinplatformio.ini - Verify LVGL buffer size in
lvgl_v8_port.h
Performance
- FPS: ~50 FPS @ 1024x600 resolution
- CPU Load: ~80% (Core 1 LVGL rendering)
- WiFi Scan: 1-3 seconds for 10-20 networks
- UART Overhead: +1-2% CPU @ 5Hz transmission
- Build Time:
- First build: ~5-10 minutes (downloads libraries)
- Incremental: ~10-30 seconds (much faster than Arduino IDE!)
Development
Adding Libraries
Edit platformio.ini → lib_deps:
lib_deps =
existing/library@1.0.0
new/library@2.0.0
Changing Debug Level
Edit platformio.ini → build_flags:
build_flags =
-DCORE_DEBUG_LEVEL=5 ; 0=None, 1=Error, 5=Verbose
Custom Partition
- Edit
partition_table.csv - Adjust partition sizes (hex values)
- Rebuild:
pio run
Original Arduino IDE Version
The original Arduino IDE project remains in parent directory for comparison/rollback if needed.
License
Generated with Claude Code - https://claude.com/claude-code