Pridani prepinacu funkci

master
David Zálešák 2 years ago
parent 809282ecd9
commit 83d53f328c

@ -79,11 +79,13 @@ void setup() {
//========== Web server setup ========== //========== Web server setup ==========
if(METRICS_EXPORT || API){
if(METRICS_EXPORT){ if(METRICS_EXPORT){
server.on("/metrics", HTTP_GET, [](AsyncWebServerRequest *request){ server.on("/metrics", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain; charset=utf-8", metrics); request->send(200, "text/plain; charset=utf-8", metrics);
}); });
} }
if(API){
server.on("/set", HTTP_GET, [](AsyncWebServerRequest *request){ server.on("/set", HTTP_GET, [](AsyncWebServerRequest *request){
//nutno nastavit maxima a minima //nutno nastavit maxima a minima
@ -135,12 +137,14 @@ void setup() {
request->send(200, "text/plain; charset=utf-8", repply); request->send(200, "text/plain; charset=utf-8", repply);
}); });
}
if(API && WEBAPP){
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html"); server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
}
server.onNotFound(notFound); server.onNotFound(notFound);
server.begin(); server.begin();
}
//================================= //=================================
} }

@ -2,9 +2,13 @@
#define STAPSK "heslo" #define STAPSK "heslo"
#define DS18B20_PIN 0 #define DS18B20_PIN 0
//jak zacházet s více čidly?
#define CORRECTION 0
#define RELAY_PIN 2 #define RELAY_PIN 2
#define METRICS_EXPORT 1 #define METRICS_EXPORT 1
#define THERMOSTAT 0 #define API 1
#define WEBAPP 1
#define CORRECTION 0 #define THERMOSTAT 1