diff --git a/ESPtermostat.ino b/ESPtermostat.ino index 172710c..8d7a27c 100644 --- a/ESPtermostat.ino +++ b/ESPtermostat.ino @@ -83,31 +83,39 @@ void setup() { } server.on("/set", HTTP_GET, [](AsyncWebServerRequest *request){ //nutno nastavit maxima a minima + + String repply; + if(THERMOSTAT){ if (request->hasParam("increasereqtemp")) { reqTemp += request->getParam("increasereqtemp")->value().toFloat(); - request->send(200, "text/plain; charset=utf-8", String(reqTemp)); + repply = String(reqTemp); }else if (request->hasParam("decreasereqtemp")) { reqTemp -= request->getParam("decreasereqtemp")->value().toFloat(); - request->send(200, "text/plain; charset=utf-8", String(reqTemp)); + repply = String(reqTemp); }else if (request->hasParam("increaseoffset")) { offset += request->getParam("increaseoffset")->value().toFloat(); - request->send(200, "text/plain; charset=utf-8", String(offset)); + repply = String(offset); }else if (request->hasParam("decreaseoffset")) { offset -= request->getParam("decreaseoffset")->value().toFloat(); - request->send(200, "text/plain; charset=utf-8", String(offset)); + repply = String(offset); }else{ - request->send(200, "text/plain; charset=utf-8", "no known parameter"); + repply = "no known parameter"; } }else{ if (request->hasParam("relay")) { boolean state = request->getParam("relay")->value() == "1"; digitalWrite(RELAY_PIN, state); - request->send(200, "text/plain; charset=utf-8", "success"); + repply = "success"; }else{ - request->send(200, "text/plain; charset=utf-8", "no known parameter"); + repply = "no known parameter"; } } + + AsyncWebServerResponse *response = request->beginResponse(200, "text/plain; charset=utf-8", repply); + response->addHeader("Access-Control-Allow-Origin", "*"); + request->send(response); + //request->send(200, "text/plain; charset=utf-8", repply); }); server.on("/get", HTTP_GET, [](AsyncWebServerRequest *request){ //nutno vyřešit dotazy na více parametrů najednou @@ -124,8 +132,11 @@ void setup() { }else{ repply = "no known parameter"; } - - request->send(200, "text/plain; charset=utf-8", repply); + + AsyncWebServerResponse *response = request->beginResponse(200, "text/plain; charset=utf-8", repply); + response->addHeader("Access-Control-Allow-Origin", "*"); + request->send(response); + //request->send(200, "text/plain; charset=utf-8", repply); }); server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(200, "text/plain; charset=utf-8", "ESP termostat, tady se bude posílat aplikace z flash paměti"); diff --git a/jsapp/img/topi.svg b/jsapp/img/topi.svg new file mode 100644 index 0000000..01b0f03 --- /dev/null +++ b/jsapp/img/topi.svg @@ -0,0 +1,60 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/jsapp/index.html b/jsapp/index.html index 7b8292a..1290a3e 100644 --- a/jsapp/index.html +++ b/jsapp/index.html @@ -19,30 +19,105 @@
Aktuální stav -
- Netopí - Stav - netopí +
+ Netopí + Stav - netopí

Požadovaná teplota

- Zvýšit požadovanou teplotu -
27.1
- Snížit požadovanou teplotu + Zvýšit požadovanou teplotu +
0
+ Snížit požadovanou teplotu Offset - Zvýšit offset -
0.3
- Snížit offset + Zvýšit offset +
0
+ Snížit offset
+ \ No newline at end of file diff --git a/jsapp/style.css b/jsapp/style.css index e420eaa..39c0c20 100644 --- a/jsapp/style.css +++ b/jsapp/style.css @@ -1,6 +1,6 @@ @font-face { font-family: bebas; - src: url(BebasNeue-Regular.ttf); + src: url(font/BebasNeue-Regular.ttf); } body, @@ -56,6 +56,9 @@ header { text-align: right; align-self: center; } +#actual-state.topi { + color: #31B907; +} #actual-state { color: #e10000; } @@ -85,12 +88,12 @@ section h2 { ". tempDown offsetDown ."; } -.inputs .tempUp { +.inputs #tempUp { grid-area: tempUp; height: 3.2rem; } -.inputs .tempDown { +.inputs #tempDown { grid-area: tempDown; height: 3.2rem; } @@ -108,7 +111,7 @@ section h2 { margin-bottom: -2.5rem; } -.inputs .offsetUp { +.inputs #offsetUp { grid-area: offsetUp; height: 2.5rem; margin-bottom: -1.5rem; @@ -120,7 +123,7 @@ section h2 { color: #9a9a9a; } -.inputs .offsetDown { +.inputs #offsetDown { grid-area: offsetDown; height: 2.5rem; margin-top: -1.5rem; @@ -154,8 +157,9 @@ a { right: 0.3rem; text-decoration: none; font-size: 0.8rem; + color: #c1c1c1; } a:visited { - color: white; + color: #c1c1c1; } \ No newline at end of file