can set idle_pwm from webserver, but not working properly
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user