diff --git a/src/main.cpp b/src/main.cpp index 50ce84b..b82289e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,19 @@ #include #include +#include +#include #include #include #include - #include #include #include +#define FIRMWARE "2.2" +#define BOARD "ESP8266 Dev" +#define SERVICE "LEDController" +const String STATUSURL = "http://moon.basement.lan/l/boardstatus.php"; + // The GPIO pin numbers for the three colors. Make sure these match your wiring/schematic. #define GPIO_RED 13 #define GPIO_GREEN 12 @@ -120,6 +126,16 @@ void inline blueBlinkISR(void) { timer0_write(ESP.getCycleCount() + 40000000); } +void sendDeviceStatus() { + WiFiClient client; + HTTPClient http; + http.begin(client, STATUSURL.c_str()); + http.addHeader("Content-Type", "application/x-www-form-urlencoded"); + String httpData = "mac=" + WiFi.macAddress() + "&board=" + BOARD + "&firmware=" + FIRMWARE + "&service=" + SERVICE; + int httpResponseCode = http.POST(httpData); + http.end(); +} + // Set up our initial states and WiFi void setup() { // Set the three color PWM pins to output @@ -155,6 +171,7 @@ void setup() { timer0_write(ESP.getCycleCount() + 1000); interrupts(); wifiManager.autoConnect("JaJLEDController"); + sendDeviceStatus(); ArduinoOTA.onStart([]() { String type; if ( ArduinoOTA.getCommand() == U_FLASH )