Shelve.
This commit is contained in:
parent
5f6cfd653c
commit
0317a93d38
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
[env:esp32doit-devkit-v1]
|
[env:esp32doit-devkit-v1]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
|
build_flags =
|
||||||
|
-std=gnu++11
|
||||||
board = esp32doit-devkit-v1
|
board = esp32doit-devkit-v1
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <Adafruit_BusIO_Register.h> // for DS3231
|
#include <Adafruit_BusIO_Register.h> // for DS3231
|
||||||
#include <RTClib.h> // for DS3231
|
#include <RTClib.h> // for DS3231
|
||||||
//#include <DS3232RTC.h> //for DS3231
|
//#include <DS3232RTC.h> //for DS3231
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
// download zip from https://github.com/me-no-dev/ESPAsyncWebServer and install.
|
// download zip from https://github.com/me-no-dev/ESPAsyncWebServer and install.
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
|
@ -51,7 +52,7 @@ int yourInputWPM;
|
||||||
int yourInputMsg;
|
int yourInputMsg;
|
||||||
int yourInputMsg_old; // to save previous state and check changes
|
int yourInputMsg_old; // to save previous state and check changes
|
||||||
float yourInputFloat;
|
float yourInputFloat;
|
||||||
String yourInputTime; //to keep time
|
long yourInputTime; //to keep time
|
||||||
|
|
||||||
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
||||||
const char index_html[] PROGMEM = R"rawliteral(
|
const char index_html[] PROGMEM = R"rawliteral(
|
||||||
|
@ -63,8 +64,11 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
<!--alert("Saved value to ESP SPIFFS");-->
|
<!--alert("Saved value to ESP SPIFFS");-->
|
||||||
setTimeout(function(){ document.location.reload(false); }, 500);
|
setTimeout(function(){ document.location.reload(false); }, 500);
|
||||||
}
|
}
|
||||||
|
var putDate = function(form) {
|
||||||
|
form.inputTimeUnix.value = Date.now();
|
||||||
|
};
|
||||||
</script></head><body>
|
</script></head><body>
|
||||||
<form action="/get" target="hidden-form">
|
<form action="/get" target="hidden-form" onsubmit="putDate(this);">
|
||||||
inputString (current value %inputString%): <input type="text" name="inputString" value=%inputString%><br>
|
inputString (current value %inputString%): <input type="text" name="inputString" value=%inputString%><br>
|
||||||
|
|
||||||
Sending program (cycle doesn't work yet) (current value: <b>%inputSend%</b>):
|
Sending program (cycle doesn't work yet) (current value: <b>%inputSend%</b>):
|
||||||
|
@ -86,15 +90,15 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
|
|
||||||
WPM (current value %inputWPM%): <input type="number " name="inputWPM" value = %inputWPM%> (doesn't work yet)<br>
|
WPM (current value %inputWPM%): <input type="number " name="inputWPM" value = %inputWPM%> (doesn't work yet)<br>
|
||||||
|
|
||||||
Time Unix: <input type="text" name="inputTimeUnix" id="js_time_unix"><br>
|
<input type="hidden" name="inputTimeUnix" id="js_time_unix"><br>
|
||||||
|
<script>
|
||||||
|
<!-- document.write(Date.now()); -->
|
||||||
|
</script>
|
||||||
|
|
||||||
inputFloat (current value %inputFloat%): <input type="number " name="inputFloat" value = %inputFloat%><br>
|
inputFloat (current value %inputFloat%): <input type="number " name="inputFloat" value = %inputFloat%><br>
|
||||||
<input type="submit" value="Submit" onclick="submitMessage()">
|
<input type="submit" value="Submit" onclick="submitMessage()">
|
||||||
</form>
|
</form>
|
||||||
<iframe style="display:none" name="hidden-form"></iframe>
|
<iframe style="display:none" name="hidden-form"></iframe>
|
||||||
<script>
|
|
||||||
document.getElementById("js_time_unix").value = Date.now();
|
|
||||||
</script>
|
|
||||||
</body></html>)rawliteral";
|
</body></html>)rawliteral";
|
||||||
|
|
||||||
// Auxiliary variables to store the current output state
|
// Auxiliary variables to store the current output state
|
||||||
|
@ -457,8 +461,10 @@ void setup() {
|
||||||
// GET inputTimeUnix value on <ESP_IP>/get?inputTimeUnix=<inputMessage>
|
// GET inputTimeUnix value on <ESP_IP>/get?inputTimeUnix=<inputMessage>
|
||||||
if (request->hasParam(PARAM_TIME)) {
|
if (request->hasParam(PARAM_TIME)) {
|
||||||
inputMessage = request->getParam(PARAM_TIME)->value();
|
inputMessage = request->getParam(PARAM_TIME)->value();
|
||||||
yourInputTime = inputMessage;
|
yourInputTime = std::stol(inputMessage);
|
||||||
Serial.println(yourInputTime);
|
Serial.println(yourInputTime);
|
||||||
|
// update the RTC time
|
||||||
|
rtc.adjust(DateTime(yourInputTime));
|
||||||
}
|
}
|
||||||
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
|
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
|
||||||
if (request->hasParam(PARAM_FLOAT)) {
|
if (request->hasParam(PARAM_FLOAT)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user