diff --git a/data/src/js/script.ts b/data/src/js/script.ts
index 2d9ec73..bf03ca3 100644
--- a/data/src/js/script.ts
+++ b/data/src/js/script.ts
@@ -43,8 +43,8 @@ fetch('/api/settings', {
if (jsonData.useBitcoinNode)
document.getElementById('useBitcoinNode').checked = true;
-
- let nodeFields = ["rpcHost", "rpcPort", "rpcUser", "tzOffset"];
+
+ let nodeFields = ["rpcHost", "rpcPort", "rpcUser", "tzOffset"];
for (let n of nodeFields) {
document.getElementById(n).value = jsonData[n];
@@ -52,12 +52,15 @@ fetch('/api/settings', {
document.getElementById('timePerScreen').value = jsonData.timerSeconds / 60;
document.getElementById('ledBrightness').value = jsonData.ledBrightness;
+ document.getElementById('fullRefreshMin').value = jsonData.fullRefreshMin;
+ document.getElementById('wpTimeout').value = jsonData.wpTimeout;
+
if (jsonData.gitRev)
document.getElementById('gitRev').innerHTML = "Version: " + jsonData.gitRev;
if (jsonData.lastBuildTime)
- document.getElementById('lastBuildTime').innerHTML = " / " + new Date((jsonData.lastBuildTime* 1000)).toLocaleString();
+ document.getElementById('lastBuildTime').innerHTML = " / " + new Date((jsonData.lastBuildTime * 1000)).toLocaleString();
var source = document.getElementById("screens-template").innerHTML;
var template = Handlebars.compile(source);
@@ -114,7 +117,7 @@ let tzOffsetBtn = document.getElementById('getTzOffsetBtn');
if (tzOffsetBtn)
tzOffsetBtn.onclick = (event) => {
- document.getElementById("tzOffset").value = new Date(new Date().getFullYear(), 0, 1).getTimezoneOffset()*-1;
+ document.getElementById("tzOffset").value = new Date(new Date().getFullYear(), 0, 1).getTimezoneOffset() * -1;
return false;
};
diff --git a/src/lib/functions.cpp b/src/lib/functions.cpp
index 21434dc..4e7e39d 100644
--- a/src/lib/functions.cpp
+++ b/src/lib/functions.cpp
@@ -138,7 +138,7 @@ void setupWifi()
setupSoftAP();
- wm.setConfigPortalTimeout(600);
+ wm.setConfigPortalTimeout(preferences.getUInt("wpTimeout", 600));
wm.setAPCallback([&](WiFiManager *wifiManager)
{
showSetupQr(softAP_SSID, softAP_password);
diff --git a/src/lib/webserver.cpp b/src/lib/webserver.cpp
index ea6ff0d..dc4fa21 100644
--- a/src/lib/webserver.cpp
+++ b/src/lib/webserver.cpp
@@ -145,6 +145,8 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
root["bgColor"] = getBgColor();
root["timerSeconds"] = timerSeconds;
root["timerRunning"] = timerRunning;
+ root["fullRefreshMin"] = preferences.getUInt("fullRefreshMin", 30);
+ root["wpTimeout"] = preferences.getUInt("wpTimeout", 600);
root["tzOffset"] = preferences.getInt("gmtOffset", TIME_OFFSET_SECONDS) / 60;
root["useBitcoinNode"] = preferences.getBool("useNode", false);
root["rpcPort"] = preferences.getUInt("rpcPort", BITCOIND_PORT);
@@ -228,6 +230,26 @@ void onApiSettingsPost(AsyncWebServerRequest *request)
settingsChanged = true;
}
+ if (request->hasParam("fullRefreshMin", true))
+ {
+ AsyncWebParameter *fullRefreshMin = request->getParam("fullRefreshMin", true);
+
+ preferences.putUInt("fullRefreshMin", fullRefreshMin->value().toInt());
+ Serial.print("Set full refresh minutes to ");
+ Serial.println(fullRefreshMin->value().c_str());
+ settingsChanged = true;
+ }
+
+ if (request->hasParam("wpTimeout", true))
+ {
+ AsyncWebParameter *wpTimeout = request->getParam("wpTimeout", true);
+
+ preferences.putUInt("wpTimeout", wpTimeout->value().toInt());
+ Serial.print("Set WiFi portal timeout seconds to ");
+ Serial.println(wpTimeout->value().c_str());
+ settingsChanged = true;
+ }
+
for (int i = 0; i < screenNameMap.size(); i++)
{
String key = "screen[" + String(i) + "]";
@@ -335,6 +357,7 @@ void onApiShowText(AsyncWebServerRequest *request)
{
AsyncWebParameter *p = request->getParam("t");
String t = p->value();
+ t.toUpperCase(); // This is needed as long as lowercase letters are glitchy
CustomTextScreen::setSimpleText(t);
}
setCurrentScreen(SCREEN_CUSTOM);
diff --git a/src/tasks/epd.cpp b/src/tasks/epd.cpp
index 9c034cb..4ca9b0c 100644
--- a/src/tasks/epd.cpp
+++ b/src/tasks/epd.cpp
@@ -321,7 +321,7 @@ void updateDisplay(void *pvParameters)
bool updatePartial = true;
// Full Refresh every half hour
- if (!lastFullRefresh[epdIndex] || (millis() - lastFullRefresh[epdIndex]) > (30 * 60 * 1000))
+ if (!lastFullRefresh[epdIndex] || (millis() - lastFullRefresh[epdIndex]) > (preferences.getUInt("fullRefreshMin", 30) * 60 * 1000))
{
updatePartial = false;
lastFullRefresh[epdIndex] = millis();