Developer Guide
Welcome to the MyStation developer documentation. This guide provides technical details about the system architecture, implementation, and development processes.
For Developers
This section is for developers who want to:
- 🔧 Understand the system architecture
- 📝 Contribute to the project
- 🐛 Debug and fix issues
- ✨ Add new features
- 🔌 Modify hardware configuration
👤 Are you not a developer? See the User Guide instead.
Project Overview
MyStation is an ESP32-based e-paper display system that shows real-time public transport departures and weather information.
Key Technologies
- Platform: ESP32-C3 / ESP32-S3
- Framework: Arduino framework via PlatformIO
- Display: 7.5" e-paper (GDEY075T7, 800x480)
- Network: WiFi 2.4 GHz (802.11 b/g/n)
- Storage: NVS (Non-Volatile Storage) for configuration
- OTA: Over-the-air firmware updates
- Power: Deep sleep with intelligent wake-up
Core Features
- Configuration System - Multi-phase boot with web-based setup
- WiFi Management - Auto-connect, fallback, mDNS
- Display System - Multiple modes, efficient e-paper rendering
- Power Management - Deep sleep, battery monitoring, scheduled wake
- OTA Updates - Secure firmware updates over WiFi
- API Integration - Google Geolocation, RMV API, DWD Weather, OpenStreetMap Nominatim
Quick Navigation
🏗️ Architecture & Design
- Boot Process - Detailed boot flow and phases
⚙️ Core Systems
- Configuration Layers - NVS storage, phases, data structures
- Display System - E-paper rendering, modes, layouts
- Power Management - Deep sleep, wake sources, battery (see Run Book)
- OTA System - Firmware updates, scheduling, rollback (see Run Book)
📡 Integration & APIs
- API Integration - Google, RMV, DWD APIs
- WiFi Management - Connection, fallback, mDNS (see Run Book)
🛠️ Development
- Development Setup - Getting started with PlatformIO
- Testing - Native tests, mocks, debugging
- Run Book - Operational procedures and troubleshooting
🔌 Hardware
- Hardware Assembly - Pin connections and wiring diagrams
Technology Stack
Hardware
| Component | Model | Purpose |
|---|---|---|
| MCU | ESP32-C3 / S3 | Main processor |
| Display | GDEY075T7 | 7.5" e-paper, 800x480 |
| WiFi | Built-in | 2.4 GHz 802.11 b/g/n |
| Storage | 4MB Flash | Firmware + SPIFFS + NVS |
| Power | 3.7V LiPo | Battery powered |
Software
| Library | Version | Purpose |
|---|---|---|
| PlatformIO | Latest | Build system |
| Arduino-ESP32 | 6.5.0 | Framework |
| WiFiManager | 2.0.17 | WiFi configuration |
| ArduinoJson | 6.21.4 | JSON parsing |
| GxEPD2 | 1.6.4 | E-paper driver |
| U8g2 | 1.8.0 | Font rendering |
APIs
| Service | Purpose | Authentication |
|---|---|---|
| Google Geolocation | Location detection | API Key |
| RMV API | Public transport data | API Key |
| DWD Weather | Weather forecasts | None (open) |
| GitHub | OTA updates | Certificate pinning |
Key Concepts
Configuration Phases
MyStation uses a three-phase boot process:
- Phase 1: WiFi Setup - No WiFi configured, create AP
- Phase 2: App Setup - WiFi configured, need station config
- Phase 3: Operational - Fully configured, normal operation
See Boot Process for details.
Deep Sleep Cycle
Normal operation follows this pattern:
Wake Up → Connect WiFi → Fetch Data → Update Display → Deep Sleep
↑ │
└──────────────────────────────────────────────────────────┘
(Configured interval)
Display Modes
Three display modes supported:
- DISPLAY_MODE_HALF_AND_HALF (0) - Weather + Departures
- DISPLAY_MODE_WEATHER_ONLY (1) - Weather full screen
- DISPLAY_MODE_DEPARTURE_ONLY (2) - Departures full screen
See Display System for rendering details.
Configuration Storage
All settings stored in NVS (Non-Volatile Storage):
- WiFi credentials (encrypted namespace)
- Station configuration
- Display preferences
- Update intervals
- Sleep schedule
See Configuration Layers for data structures.
Code Organization
mystation/
├── src/ # Source code
│ ├── main.cpp # Entry point
│ ├── api/ # API clients
│ ├── config/ # Configuration
│ ├── display/ # Display rendering
│ ├── ota/ # OTA updates
│ ├── sec/ # Security (AES)
│ └── util/ # Utilities
├── include/ # Header files (mirrors src/)
├── lib/ # Libraries
├── test/ # Unit tests
├── data/ # SPIFFS files
├── docs/ # Documentation
└── platformio.ini # Build configuration
Common Development Tasks
Testing Changes
# Run native tests
pio test -e native
# Run specific test
pio test -e native -f test_timing_manager
# Upload and monitor
pio run --target upload && pio device monitor
See Testing for test framework details.
Contributing
Code Style
- Indentation: 4 spaces (no tabs)
- Braces: K&R style (opening brace on same line)
- Naming:
- Classes: PascalCase
- Functions: camelCase
- Constants: UPPER_SNAKE_CASE
- Variables: camelCase
refer .clang-format file for full style guide
Git Workflow
- Fork the repository
- Create feature branch
- Make commits (atomic, well-described)
- Test thoroughly
- Submit pull request
- Address review comments
Documentation
- Update relevant documentation with code changes
- Add examples for new features
- Keep README.md current
- Document breaking changes
Resources
Documentation
- 📖 User Guide - End-user documentation
- 📚 Configuration Keys Quick Reference - Configuration keys
External Resources
Community
- GitHub Issues - Bug reports and feature requests
- Pull Requests - Code contributions
- Discussions - Questions and ideas
Next Steps
New to the Project?
- Understand Boot Process
- Set up Development Environment
Ready to Code?
- Check open issues for tasks
- Set up your development environment
- Start with small improvements
- Ask questions if stuck
Want to Contribute?
- Read contributing guidelines
- Pick an issue or suggest a feature
- Discuss approach before major changes
- Write tests for new functionality
- Update documentation
- Submit pull request
Questions? Check the Troubleshooting Guide or open an issue on GitHub.