feat: initialize ESP32 project with PlatformIO (#1)#6
feat: initialize ESP32 project with PlatformIO (#1)#6addidea wants to merge 1 commit intoClawland-AI:mainfrom
Conversation
Closes Clawland-AI#1 Complete PlatformIO project setup includes: **Core Firmware (src/main.cpp)**: - WiFi connectivity with auto-reconnect - MQTT client for upstream reporting - Status and sensor data publishing - Command subscription (status, restart) - Heartbeat and keepalive logic - Serial logging with emojis for readability **Project Structure**: - platformio.ini: ESP32 board config + dependencies - lib/: Custom sensor driver directory with usage guide - .gitignore: Build artifacts, IDE files, secrets **Documentation (README.md)**: - 3 flashing methods: PlatformIO IDE, CLI, esptool.py - Step-by-step installation guide - Troubleshooting section (USB detection, WiFi, MQTT) - Project structure overview - Next steps linking to other issues **Features**: - Production-ready WiFi/MQTT stack - Configurable via constants (SSID, broker, topics) - MQTT topics: status, sensors, commands - Memory-efficient (runs on ESP32-C3 with 400KB RAM) Ready to flash and test on hardware! 🚀
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on March 16
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| } | ||
| } else { | ||
| mqttClient.loop(); | ||
| } |
There was a problem hiding this comment.
No WiFi reconnection logic in main loop
High Severity
The loop() only handles MQTT reconnection but never checks or recovers WiFi connectivity. setupWiFi() is called once in setup() and WiFi.setAutoReconnect(true) is never called. ESP32 does not auto-reconnect WiFi by default, so if WiFi drops, the device permanently loses network connectivity. The MQTT reconnect branch will repeatedly call connectMQTT() — which blocks for up to 15 seconds per attempt via PubSubClient's socket timeout — making the device unresponsive with no path to recovery.


Description
Complete ESP32 project initialization with PlatformIO, WiFi, and MQTT stack.
Closes #1
What's Included
✅ Core Firmware (src/main.cpp)
✅ Project Structure
platformio.ini: ESP32 board config + dependencies (PubSubClient, DHT, Adafruit Unified Sensor)lib/README.md: Custom sensor driver directory with usage guide.gitignore: Build artifacts, IDE files, environment secrets✅ Documentation (README.md)
Key Features
microclaw/status→ Agent health metricsmicroclaw/sensors→ Sensor data streammicroclaw/commands→ Remote controlTesting
src/main.cppwith your WiFi/MQTT credentialspio run --target uploadpio device monitor→ See connection logsNext Steps
Ready for review! 🐾
Note
Medium Risk
Introduces new WiFi/MQTT connection, periodic publishing, and remote command handling in the main firmware loop; connectivity/loop timing issues could affect device stability but changes are contained to startup/telemetry code.
Overview
Bootstraps the ESP32 firmware in
src/main.cppwith WiFi setup and an MQTT client: connects/subscribes on startup, auto-reconnects inloop(), publishes periodic placeholder sensor payloads, and emits a JSON status message (uptime/heap/RSSI). It also adds basic command handling overmicroclaw/commands(requeststatusandrestart).Improves project onboarding by expanding
README.mdwith PlatformIO install/flash instructions (IDE/CLI/manual), troubleshooting, and project structure, addslib/README.mddescribing how to add custom sensor drivers, and broadens.gitignoreto exclude build artifacts, IDE/OS files, logs, and secret env/header files.Written by Cursor Bugbot for commit d1ac3bc. This will update automatically on new commits. Configure here.