mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 18:26:21 +02:00
0.7.15
* add NTP sync interval #1019 * adjusted range of contrast / luminance setting #1041 * use only ISO time format in Web-UI #913
This commit is contained in:
parent
c9d705baa4
commit
984e344f05
10 changed files with 31 additions and 13 deletions
|
@ -1,5 +1,10 @@
|
|||
# Development Changes
|
||||
|
||||
## 0.7.15 - 2023-07-23
|
||||
* add NTP sync interval #1019
|
||||
* adjusted range of contrast / luminance setting #1041
|
||||
* use only ISO time format in Web-UI #913
|
||||
|
||||
## 0.7.14 - 2023-07-23
|
||||
* fix Contrast for Nokia Display #1041
|
||||
* attempt to fix #1016 by improving inverter status
|
||||
|
|
|
@ -247,7 +247,7 @@ void app::tickNtpUpdate(void) {
|
|||
}
|
||||
}
|
||||
|
||||
nxtTrig = isOK ? 43200 : 60; // depending on NTP update success check again in 12 h or in 1 min
|
||||
nxtTrig = isOK ? (mConfig->ntp.interval * 60) : 60; // depending on NTP update success check again in 12h (depends on setting) or in 1 min
|
||||
|
||||
if ((mSunrise == 0) && (mConfig->sun.lat) && (mConfig->sun.lon)) {
|
||||
mCalculatedTimezoneOffset = (int8_t)((mConfig->sun.lon >= 0 ? mConfig->sun.lon + 7.5 : mConfig->sun.lon - 7.5) / 15) * 3600;
|
||||
|
|
|
@ -98,6 +98,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
char addr[NTP_ADDR_LEN];
|
||||
uint16_t port;
|
||||
uint16_t interval; // in minutes
|
||||
} cfgNtp_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -390,6 +391,7 @@ class settings {
|
|||
|
||||
snprintf(mCfg.ntp.addr, NTP_ADDR_LEN, "%s", DEF_NTP_SERVER_NAME);
|
||||
mCfg.ntp.port = DEF_NTP_PORT;
|
||||
mCfg.ntp.interval = 720;
|
||||
|
||||
mCfg.sun.lat = 0.0;
|
||||
mCfg.sun.lon = 0.0;
|
||||
|
@ -524,11 +526,16 @@ class settings {
|
|||
|
||||
void jsonNtp(JsonObject obj, bool set = false) {
|
||||
if(set) {
|
||||
obj[F("addr")] = mCfg.ntp.addr;
|
||||
obj[F("port")] = mCfg.ntp.port;
|
||||
obj[F("addr")] = mCfg.ntp.addr;
|
||||
obj[F("port")] = mCfg.ntp.port;
|
||||
obj[F("intvl")] = mCfg.ntp.interval;
|
||||
} else {
|
||||
getChar(obj, F("addr"), mCfg.ntp.addr, NTP_ADDR_LEN);
|
||||
getVal<uint16_t>(obj, F("port"), &mCfg.ntp.port);
|
||||
getVal<uint16_t>(obj, F("intvl"), &mCfg.ntp.interval);
|
||||
|
||||
if(mCfg.ntp.interval < 5) // minimum 5 minutes
|
||||
mCfg.ntp.interval = 720; // default -> 12 hours
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 7
|
||||
#define VERSION_PATCH 14
|
||||
#define VERSION_PATCH 15
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -44,7 +44,7 @@ class DisplayMono64X48 : public DisplayMono {
|
|||
void config(bool enPowerSafe, bool enScreenSaver, uint8_t lum) {
|
||||
mEnPowerSafe = enPowerSafe;
|
||||
mEnScreenSaver = enScreenSaver;
|
||||
mLuminance = lum * 255 / 100;
|
||||
mLuminance = lum;
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
|
|
@ -390,8 +390,9 @@ class RestApi {
|
|||
}
|
||||
|
||||
void getNtp(JsonObject obj) {
|
||||
obj[F("addr")] = String(mConfig->ntp.addr);
|
||||
obj[F("port")] = String(mConfig->ntp.port);
|
||||
obj[F("addr")] = String(mConfig->ntp.addr);
|
||||
obj[F("port")] = String(mConfig->ntp.port);
|
||||
obj[F("interval")] = String(mConfig->ntp.interval);
|
||||
}
|
||||
|
||||
void getSun(JsonObject obj) {
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
if(obj["ts_now"] < 1680000000)
|
||||
setTime();
|
||||
else
|
||||
dSpan.innerHTML = date.toLocaleString('de-DE');
|
||||
dSpan.innerHTML = date.toISOString().substring(0, 19).replace('T', ', ');
|
||||
}
|
||||
else {
|
||||
dSpan.innerHTML = "";
|
||||
|
@ -157,7 +157,7 @@
|
|||
if(false == i["is_avail"]) {
|
||||
if(i["ts_last_success"] > 0) {
|
||||
var date = new Date(i["ts_last_success"] * 1000);
|
||||
p.append(span("-> last successful transmission: " + date.toLocaleString('de-DE')), br());
|
||||
p.append(span("-> last successful transmission: " + date.toISOString().substring(0, 19).replace('T', ', ')), br());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@
|
|||
|
||||
function tick() {
|
||||
if(0 != ts)
|
||||
document.getElementById("date").innerHTML = (new Date((++ts) * 1000)).toLocaleString('de-DE');
|
||||
document.getElementById("date").innerHTML = (new Date((++ts) * 1000)).toISOString().substring(0, 19).replace('T', ', ');
|
||||
if(++tickCnt >= 10) {
|
||||
tickCnt = 0;
|
||||
getAjax('/api/index', parse);
|
||||
|
|
|
@ -195,6 +195,10 @@
|
|||
<div class="col-12 col-sm-3 my-2">NTP Port</div>
|
||||
<div class="col-12 col-sm-9"><input type="number" name="ntpPort"/></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-sm-3 my-2">NTP Intervall (in Minutes, min. 5 Minutes)</div>
|
||||
<div class="col-12 col-sm-9"><input type="number" name="ntpIntvl"/></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-sm-3 my-2">set system time</div>
|
||||
<div class="col-12 col-sm-9">
|
||||
|
@ -284,7 +288,7 @@
|
|||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-sm-3 my-2">Luminance</div>
|
||||
<div class="col-12 col-sm-9"><input type="number" name="disp_cont" min="0" max="100"></select></div>
|
||||
<div class="col-12 col-sm-9"><input type="number" name="disp_cont" min="0" max="255"></select></div>
|
||||
</div>
|
||||
<p class="des">Pinout</p>
|
||||
<div id="dispPins"></div>
|
||||
|
@ -681,7 +685,7 @@
|
|||
}
|
||||
|
||||
function parseNtp(obj) {
|
||||
for(var i of [["ntpAddr", "addr"], ["ntpPort", "port"]])
|
||||
for(var i of [["ntpAddr", "addr"], ["ntpPort", "port"], ["ntpIntvl", "interval"]])
|
||||
document.getElementsByName(i[0])[0].value = obj[i[1]];
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
var ageInfo = "Last received data requested at: ";
|
||||
if(ts > 0) {
|
||||
var date = new Date(ts * 1000);
|
||||
ageInfo += date.toLocaleString('de-DE');
|
||||
ageInfo += date.toISOString().substring(0, 19).replace('T', ', ');
|
||||
}
|
||||
else
|
||||
ageInfo += "nothing received";
|
||||
|
|
|
@ -559,6 +559,7 @@ class Web {
|
|||
if (request->arg("ntpAddr") != "") {
|
||||
request->arg("ntpAddr").toCharArray(mConfig->ntp.addr, NTP_ADDR_LEN);
|
||||
mConfig->ntp.port = request->arg("ntpPort").toInt() & 0xffff;
|
||||
mConfig->ntp.interval = request->arg("ntpIntvl").toInt() & 0xffff;
|
||||
}
|
||||
|
||||
// sun
|
||||
|
|
Loading…
Add table
Reference in a new issue