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
- Battery Management - Voltage thresholds, discharge curve, percentage calculation
- 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.