177 lines
5.8 KiB
Markdown
177 lines
5.8 KiB
Markdown
# 🎉 Project Migration Complete!
|
|
|
|
## Summary
|
|
|
|
Successfully migrated the DCC-Bench project from WiFi/WebServer control to **ESP32-2432S028R touchscreen control**.
|
|
|
|
## ✅ What Was Changed
|
|
|
|
### 1. Hardware Platform
|
|
- ✅ Changed from generic ESP32 to **ESP32-2432S028R** (with built-in ILI9341 touchscreen)
|
|
- ✅ Updated `platformio.ini` with correct board and TFT configuration
|
|
- ✅ Added TFT_eSPI and XPT2046_Touchscreen libraries
|
|
|
|
### 2. New Features Added
|
|
- ✅ **TouchscreenUI**: Full graphical interface with buttons and slider
|
|
- ✅ **RelayController**: 2-rail/3-rail track switching via relay
|
|
- ✅ **Power Control**: ON/OFF button with safety features
|
|
- ✅ **Mode Switching**: DCC ↔ Analog with automatic power-off
|
|
- ✅ **Settings Persistence**: All settings saved to NVS
|
|
|
|
### 3. Components Removed
|
|
- ✅ WiFiManager (no longer needed)
|
|
- ✅ WebServer (replaced by touchscreen)
|
|
- ✅ Web interface files (data/ folder)
|
|
- ✅ Bootstrap dependencies
|
|
|
|
### 4. Safety Improvements
|
|
- ✅ **Auto power-off** when switching modes (prevents dangerous transitions)
|
|
- ✅ Visual power state indication (green/red button)
|
|
- ✅ Clear mode indication (cyan for DCC, yellow for Analog)
|
|
|
|
### 5. Updated Pin Assignments
|
|
All pins updated to avoid conflicts with ESP32-2432S028R peripherals:
|
|
|
|
| Component | Old Pins | New Pins |
|
|
|-----------|----------|----------|
|
|
| DCC Output | 32, 33 | 17, 16 |
|
|
| Motor Control | 25, 26, 27 | 18, 19, 23 |
|
|
| Relay | - | 4 |
|
|
| Touch/Display | - | 2, 12-15, 21, 22 |
|
|
|
|
### 6. Documentation Created
|
|
- ✅ `ESP32-2432S028R_MIGRATION.md` - Detailed migration guide
|
|
- ✅ `WIRING_ESP32-2432S028R.md` - Complete wiring guide
|
|
- ✅ `QUICK_REFERENCE.md` - Quick reference card
|
|
- ✅ Updated `README.md` - Main documentation
|
|
|
|
## 📋 Files Modified
|
|
|
|
### Created:
|
|
- `include/TouchscreenUI.h`
|
|
- `src/TouchscreenUI.cpp`
|
|
- `include/RelayController.h`
|
|
- `src/RelayController.cpp`
|
|
- `ESP32-2432S028R_MIGRATION.md`
|
|
- `WIRING_ESP32-2432S028R.md`
|
|
- `QUICK_REFERENCE.md`
|
|
|
|
### Modified:
|
|
- `platformio.ini` - Board config and libraries
|
|
- `include/Config.h` - Removed WiFi, added rail mode and power state
|
|
- `src/Config.cpp` - Updated save/load logic
|
|
- `include/MotorController.h` - Updated pin assignments
|
|
- `include/DCCGenerator.h` - Updated pin assignments
|
|
- `src/main.cpp` - Completely rewritten for touchscreen
|
|
- `README.md` - Updated documentation
|
|
|
|
### Removed:
|
|
- `include/WiFiManager.h`
|
|
- `src/WiFiManager.cpp`
|
|
- `include/WebServer.h`
|
|
- `src/WebServer.cpp`
|
|
|
|
### Kept (not used, but preserved):
|
|
- `include/LEDIndicator.h` - Can be used for future features
|
|
- `src/LEDIndicator.cpp` - Can be used for future features
|
|
- `data/` folder - Web files (not needed but preserved)
|
|
|
|
## 🚀 Next Steps
|
|
|
|
### To Build and Upload:
|
|
```bash
|
|
# Build the project
|
|
pio run
|
|
|
|
# Upload to ESP32-2432S028R
|
|
pio run --target upload
|
|
|
|
# Monitor serial output
|
|
pio device monitor
|
|
```
|
|
|
|
### To Test:
|
|
1. ✅ Power on via USB-C
|
|
2. ✅ Verify display shows UI
|
|
3. ✅ Test touch responsiveness
|
|
4. ✅ Toggle each button
|
|
5. ✅ Test speed slider
|
|
6. ✅ Verify relay clicking
|
|
7. ✅ Test mode switching (should power off)
|
|
8. ✅ Verify settings persist after reboot
|
|
|
|
## 📚 Documentation Reference
|
|
|
|
- **Main README**: [README.md](README.md)
|
|
- **Migration Details**: [ESP32-2432S028R_MIGRATION.md](ESP32-2432S028R_MIGRATION.md)
|
|
- **Wiring Guide**: [WIRING_ESP32-2432S028R.md](WIRING_ESP32-2432S028R.md)
|
|
- **Quick Reference**: [QUICK_REFERENCE.md](QUICK_REFERENCE.md)
|
|
|
|
## ⚠️ Important Notes
|
|
|
|
### Power Safety
|
|
- **Switching modes automatically powers OFF** - this is by design for safety
|
|
- Always verify power state before testing with a locomotive
|
|
|
|
### Pin Conflicts Resolved
|
|
- Original design had GPIO 33 conflict (DCC_B and Touch CS)
|
|
- Resolved by moving DCC to GPIO 16/17 and Touch to GPIO 22
|
|
|
|
### External Circuits Required
|
|
- **DCC Mode**: Requires DCC booster circuit (LMD18200 or similar)
|
|
- **DC Mode**: Requires motor driver (LM18200 or similar)
|
|
- **Relay**: Requires 5V relay module for 2-rail/3-rail switching
|
|
|
|
### Settings Storage
|
|
All settings stored in ESP32 NVS and persist across:
|
|
- Power cycles
|
|
- Firmware updates (unless NVS is erased)
|
|
- Reboots
|
|
|
|
## 🎯 Feature Highlights
|
|
|
|
### User Interface
|
|
```
|
|
┌─────────────────────────────────────────┐
|
|
│ [POWER] [MODE] [RAILS] [DIR] │
|
|
│ ON/OFF DCC/DC 2/3Rail FWD/REV │
|
|
│ │
|
|
│ Speed: 45% │
|
|
│ │
|
|
│ ═══════════════○════════════ │
|
|
│ │
|
|
│ PWR:ON | Mode:DCC | 3-Rail | Addr:3 │
|
|
│ Speed:45% FWD │
|
|
└─────────────────────────────────────────┘
|
|
```
|
|
|
|
### Button Colors
|
|
- **Power**: Green (ON) / Red (OFF)
|
|
- **Mode**: Cyan (DCC) / Yellow (Analog)
|
|
- **Rails**: Green (3-Rail) / Gray (2-Rail)
|
|
- **Direction**: White text
|
|
|
|
## 🔄 Version Information
|
|
|
|
- **Previous Version**: 1.0 (WiFi/WebServer based)
|
|
- **Current Version**: 2.0 (Touchscreen based)
|
|
- **Platform**: ESP32-2432S028R
|
|
- **Framework**: Arduino via PlatformIO
|
|
|
|
## ✨ Future Enhancement Ideas
|
|
|
|
1. **DCC Address Entry**: Numeric keypad on touchscreen
|
|
2. **Function Buttons**: F0-F12 control for DCC mode
|
|
3. **Speed Presets**: Quick buttons (25%, 50%, 75%, 100%)
|
|
4. **Current Monitoring**: Display track current (requires sensor)
|
|
5. **Locomotive Profiles**: Save/load multiple loco configurations
|
|
6. **Emergency Stop**: Large dedicated button
|
|
7. **Sound Feedback**: Beep on button press
|
|
8. **Brightness Control**: Adjust display backlight
|
|
|
|
---
|
|
|
|
**Migration Date**: December 1, 2025
|
|
**Git Branch**: ESP32-2432 (feature branch)
|
|
**Status**: ✅ Complete and ready for testing
|