How jef-sure/esp32-co2-station works
This ESP32 firmware is a CO₂ air-quality station. Its main workflow reads SCD41 measurements, updates an animated on-device dashboard, and reports readings over MQTT; users can configure networking and measurement offsets through BLE provisioning or a local web page. The README also documents touch-based display control, Home Assistant discovery, and timezone settings. The excerpts show the sensor task, settings persistence, web handlers, MQTT behavior, and provisioning pieces, but omit parts of the main event loop, so uncertain call wiring is not shown.
Main entry points: app_settings.c Settings store · main.c SCD41 task · app_webserver.c Configuration server · provisioning.c BLE provisioning
Components 14
Device measurement and display
- Application loop
main/main.c - SCD41 task
main/main.c - Dashboard rendering
main/main.c - Dashboard fonts
main/app_fonts.c
Network and configuration
- Configuration server
main/app_webserver.c - BLE provisioning
main/provisioning.c - Wi-Fi station
- MQTT publisher
main/app_mqtt.c
Persistent settings
- Settings store
main/app_settings.c - Timezone rules
main/tzones.c
Other components
- Occupant
- SCD41 sensor
- Round display
- MQTT broker
Connections 13
- Application loop → SCD41 task: starts task
- SCD41 task → SCD41 sensor: reads measurements
- SCD41 task → Settings store: reads offsets
- Application loop → Dashboard rendering: renders readings
- Dashboard rendering → Dashboard fonts: uses fonts
- Dashboard rendering → Round display: draws dashboard
- Occupant → Application loop: touch controls
- Configuration server → Settings store: saves configuration
- Configuration server → Timezone rules: applies timezone
- BLE provisioning → Settings store: loads network name
- BLE provisioning → Wi-Fi station: starts station
- MQTT publisher → Settings store: reads credentials
- MQTT publisher → MQTT broker: publishes readings