diff --git a/vulpes/platformio.ini b/vulpes/platformio.ini index ce3e1cb..14981de 100644 --- a/vulpes/platformio.ini +++ b/vulpes/platformio.ini @@ -10,6 +10,8 @@ [env:esp32doit-devkit-v1] platform = espressif32 +build_flags = + -std=gnu++11 board = esp32doit-devkit-v1 framework = arduino monitor_speed = 115200 diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 8184420..d49f0ea 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -25,6 +25,7 @@ #include // for DS3231 #include // for DS3231 //#include //for DS3231 +#include // download zip from https://github.com/me-no-dev/ESPAsyncWebServer and install. #include @@ -51,7 +52,7 @@ int yourInputWPM; int yourInputMsg; int yourInputMsg_old; // to save previous state and check changes float yourInputFloat; -String yourInputTime; //to keep time +long yourInputTime; //to keep time // HTML web page to handle 3 input fields (inputString, inputSend, inputFloat) const char index_html[] PROGMEM = R"rawliteral( @@ -63,8 +64,11 @@ const char index_html[] PROGMEM = R"rawliteral( setTimeout(function(){ document.location.reload(false); }, 500); } + var putDate = function(form) { + form.inputTimeUnix.value = Date.now(); + }; -
+ inputString (current value %inputString%):
Sending program (cycle doesn't work yet) (current value: %inputSend%): @@ -86,15 +90,15 @@ const char index_html[] PROGMEM = R"rawliteral( WPM (current value %inputWPM%): (doesn't work yet)
- Time Unix:
+
+ inputFloat (current value %inputFloat%):
- )rawliteral"; // Auxiliary variables to store the current output state @@ -457,8 +461,10 @@ void setup() { // GET inputTimeUnix value on /get?inputTimeUnix= if (request->hasParam(PARAM_TIME)) { inputMessage = request->getParam(PARAM_TIME)->value(); - yourInputTime = inputMessage; + yourInputTime = std::stol(inputMessage); Serial.println(yourInputTime); + // update the RTC time + rtc.adjust(DateTime(yourInputTime)); } // GET inputFloat value on /get?inputFloat= if (request->hasParam(PARAM_FLOAT)) {