Version 2.0 (add device/board status)
This commit is contained in:
parent
349a62c4c0
commit
6e00746f98
16
src/main.cpp
16
src/main.cpp
|
@ -10,6 +10,11 @@
|
||||||
#include <ESP32Encoder.h>
|
#include <ESP32Encoder.h>
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
|
|
||||||
|
#define FIRMWARE "2.0"
|
||||||
|
#define BOARD "ESP32"
|
||||||
|
#define SERVICE "LEDChooser"
|
||||||
|
const String STATUSURL = "http://moon.basement.lan/l/boardstatus.php";
|
||||||
|
|
||||||
// Pins Used:
|
// Pins Used:
|
||||||
// 4, 13, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33, 34, 36, 39
|
// 4, 13, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33, 34, 36, 39
|
||||||
|
|
||||||
|
@ -337,6 +342,16 @@ void configModeCallback (WiFiManager *myWiFiManager) {
|
||||||
oled.display();
|
oled.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set COLORMODEPIN to INTPUT_PULLUP
|
// Set COLORMODEPIN to INTPUT_PULLUP
|
||||||
pinMode(COLORMODEPIN, INPUT_PULLUP);
|
pinMode(COLORMODEPIN, INPUT_PULLUP);
|
||||||
|
@ -436,6 +451,7 @@ void setup() {
|
||||||
WiFiManager wifiManager;
|
WiFiManager wifiManager;
|
||||||
wifiManager.setAPCallback(configModeCallback);
|
wifiManager.setAPCallback(configModeCallback);
|
||||||
wifiManager.autoConnect("LEDChooser");
|
wifiManager.autoConnect("LEDChooser");
|
||||||
|
sendDeviceStatus();
|
||||||
ArduinoOTA
|
ArduinoOTA
|
||||||
.onStart([]() {
|
.onStart([]() {
|
||||||
String type;
|
String type;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user