can set idle_pwm from webserver, but not working properly

This commit is contained in:
2021-07-05 19:51:55 +02:00
parent 2754bd5247
commit 66d220cdb0
7 changed files with 43 additions and 24 deletions
+7 -3
View File
@@ -60,9 +60,13 @@ void HTTPServer::start_apps() {
// application handler
this->on("/update", HTTP_POST, [this]() {
// Serial.printf("got /update with args()=%d\n", args());
for(int i=0; i<args(); i++) {
Serial.printf("%s=%s\n", argName(i).c_str(), arg(i).c_str());
if(args()) {
for(int i=0; i<args()-1; i++) {
Serial.printf("%s=%s\n", argName(i).c_str(), arg(i).c_str());
if(argName(i).equals("range_idl_pwm")) {
treppe->set_idle_prozent(arg(i).toInt());
}
}
}
send(200, "text/plain", "accepted");
});
+4 -2
View File
@@ -5,6 +5,7 @@
#include <ESP8266WebServer.h>
#include <stdarg.h>
#include "filesys.h"
#include "treppe.h"
// debug log <ESP8266WebServer.h>
// #define DEBUGV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
@@ -24,10 +25,11 @@ private:
void listRoot() {
ls(rootDir);
}
Treppe* treppe;
public:
HTTPServer(const int _port, const char* _rootDir) :
ESP8266WebServer(_port), rootDir(_rootDir)
HTTPServer(const int _port, const char* _rootDir, Treppe* _treppe) :
ESP8266WebServer(_port), rootDir(_rootDir), treppe(_treppe)
{ }
~HTTPServer()
{