How 1cfer/tars works
TARS is an ESP32 environmental monitor: it samples and filters sensor readings, displays them locally, and periodically sends a JSON update to the MOREHA/FIWARE cloud. Its state machine separates startup, reading, sending, and developer setup. The developer mode also supports Wi-Fi setup and web-based OTA/configuration. The README documents the cloud’s Keyrock–Wilma–Orion flow and historical dashboard; those services are external to this repository. Some firmware wiring is unsampled, so the graph omits unverified calls and uses the README for documented transitions.
Main entry points: StateMachine.cpp State machine · Estados.cpp Sending state · TokenManager.h Token manager · WiFiManager.h Wi-Fi manager
Components 22
Device firmware
- Firmware entry
firmware/TARS/TARS.ino - State machine
firmware/TARS/StateMachine.cpp - Startup state
firmware/TARS/Estados.cpp - Reading state
firmware/TARS/Estados.cpp - Sending state
firmware/TARS/Estados.cpp - Developer state
firmware/TARS/Estados.cpp - Button events
firmware/TARS/ButtonHandler.h - Sensor acquisition
firmware/TARS/SensorManager.cpp - OLED screens
firmware/TARS/DisplayManager.cpp - Payload builder
firmware/TARS/PayloadBuilder.cpp
Network and setup
- App configuration
firmware/TARS/AppConfig.h - Wi-Fi manager
firmware/TARS/WiFiManager.h - Setup and OTA
firmware/TARS/DevWebOTA.cpp - Token manager
firmware/TARS/TokenManager.h
Cloud platform
- Keyrock
- Wilma proxy
- Orion broker
- QuantumLeap / CrateDB
- MOREHA dashboard
Physical device
- 3D-printed enclosure
hardware/TARS_TOP.3mf
Other components
- Device operator
- Wi-Fi network
Connections 24
- Device operator → Firmware entry: operates
- Firmware entry → State machine: runs
- State machine → Startup state: dispatches
README.md - State machine → Reading state: dispatches
README.md - State machine → Sending state: dispatches
README.md - State machine → Developer state: dispatches
README.md - Button events → State machine: provides events
- Startup state → Wi-Fi manager: connects through
firmware/TARS/Estados.cpp - Reading state → Sensor acquisition: reads periodically
firmware/TARS/Estados.cpp - Reading state → OLED screens: refreshes
firmware/TARS/Estados.cpp - Sending state → Sensor acquisition: gets averages
firmware/TARS/Estados.cpp - Sending state → Payload builder: builds payload
firmware/TARS/Estados.cpp - Developer state → Setup and OTA: handles requests
firmware/TARS/Estados.cpp - Developer state → Wi-Fi manager: configures network
firmware/TARS/Estados.cpp - Developer state → OLED screens: shows setup screens
firmware/TARS/Estados.cpp - App configuration → Token manager: supplies credentials
firmware/TARS/TokenManager.h - Sending state → Token manager: ensures token
firmware/TARS/Estados.cpp - Token manager → Keyrock: requests token
firmware/TARS/TokenManager.h - Sending state → Wilma proxy: PATCHes payload
README.md - Wilma proxy → Keyrock: validates token
README.md - Wilma proxy → Orion broker: forwards update
README.md - Orion broker → QuantumLeap / CrateDB: feeds history
README.md - QuantumLeap / CrateDB → MOREHA dashboard: serves history
- Wi-Fi network → Wi-Fi manager: connects to