Browse Source

system clock was too fast

included display builds into zip
removed 10s info from index.html
pull/487/head
lumapu 2 years ago
parent
commit
a9e4429f9f
  1. 27
      scripts/getVersion.py
  2. 2
      src/defines.h
  3. 2
      src/publisher/pubMqtt.h
  4. 5
      src/utils/scheduler.h
  5. 21
      src/web/html/index.html

27
scripts/getVersion.py

@ -51,13 +51,26 @@ def readVersion(path, infile):
os.mkdir(path + "firmware/") os.mkdir(path + "firmware/")
sha = os.getenv("SHA",default="sha") sha = os.getenv("SHA",default="sha")
versionout = version[:-1] + "_esp8266_" + sha + ".bin" versionout = version[:-1] + "_esp8266_" + sha + ".bin"
src = path + ".pio/build/esp8266-release/firmware.bin" src = path + ".pio/build/esp8266-release/firmware.bin"
dst = path + "firmware/" + versionout dst = path + "firmware/" + versionout
os.rename(src, dst) os.rename(src, dst)
gzip_bin(dst, dst + ".gz") gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp8266_1m_" + sha + ".bin" versionout = version[:-1] + "_esp8266_nokia5110_" + sha + ".bin"
src = path + ".pio/build/esp8266-nokia5110/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp8266_ssd1306_" + sha + ".bin"
src = path + ".pio/build/esp8266-ssd1306/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp8285_" + sha + ".bin"
src = path + ".pio/build/esp8285-release/firmware.bin" src = path + ".pio/build/esp8285-release/firmware.bin"
dst = path + "firmware/" + versionout dst = path + "firmware/" + versionout
os.rename(src, dst) os.rename(src, dst)
@ -69,6 +82,18 @@ def readVersion(path, infile):
os.rename(src, dst) os.rename(src, dst)
gzip_bin(dst, dst + ".gz") gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp32_nokia5110_" + sha + ".bin"
src = path + ".pio/build/esp32-wroom32-nokia5110/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp32_ssd1306_" + sha + ".bin"
src = path + ".pio/build/esp32-wroom32-ssd1306/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
# other ESP32 bin files # other ESP32 bin files
src = path + ".pio/build/esp32-wroom32-release/" src = path + ".pio/build/esp32-wroom32-release/"
dst = path + "firmware/" dst = path + "firmware/"

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 5 #define VERSION_MINOR 5
#define VERSION_PATCH 49 #define VERSION_PATCH 50
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

2
src/publisher/pubMqtt.h

@ -236,7 +236,7 @@ class PubMqtt {
publish("version", mVersion, true); publish("version", mVersion, true);
publish("device", mDevName, true); publish("device", mDevName, true);
publish("uptime", "0"); tickerMinute();
publish(mLwtTopic, mLwtOnline, true, false); publish(mLwtTopic, mLwtOnline, true, false);
subscribe("ctrl/#"); subscribe("ctrl/#");

5
src/utils/scheduler.h

@ -42,6 +42,7 @@ namespace ah {
mUptime = 0; mUptime = 0;
mTimestamp = 0; mTimestamp = 0;
mPrevMillis = millis(); mPrevMillis = millis();
mDiffFraq = 0;
} }
void loop(void) { void loop(void) {
@ -53,7 +54,8 @@ namespace ah {
return; return;
} }
mDiffSeconds = mDiff / 1000; mDiffSeconds = mDiff / 1000;
mPrevMillis += (mPrevMillis * 1000); mDiffFraq = mDiff % 1000;
mPrevMillis += (mDiffSeconds * 1000) - mDiffFraq;
checkEvery(); checkEvery();
checkAt(); checkAt();
mUptime += mDiffSeconds; mUptime += mDiffSeconds;
@ -132,6 +134,7 @@ namespace ah {
uint32_t mMillis, mPrevMillis, mDiff; uint32_t mMillis, mPrevMillis, mDiff;
uint32_t mUptime; uint32_t mUptime;
uint8_t mDiffSeconds; uint8_t mDiffSeconds;
uint16_t mDiffFraq;
}; };
} }

21
src/web/html/index.html

@ -39,12 +39,11 @@
</div> </div>
<p><span class="des">WiFi RSSI: </span><span id="wifi_rssi"></span> dBm</p> <p><span class="des">WiFi RSSI: </span><span id="wifi_rssi"></span> dBm</p>
<p> <p>
<span class="des">Statistics: </span> <span class="des">System Infos: </span>
<pre id="stat"></pre> <pre id="stat"></pre>
<pre id="iv"></pre> <pre id="iv"></pre>
<pre id="warn_info"></pre> <pre id="warn_info"></pre>
</p> </p>
<p>Every <span id="refresh"></span> seconds the values are updated</p>
<div id="note"> <div id="note">
Discuss with us on <a href="https://discord.gg/WzhxEY62mB">Discord</a><br/> Discuss with us on <a href="https://discord.gg/WzhxEY62mB">Discord</a><br/>
@ -79,6 +78,8 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var exeOnce = true; var exeOnce = true;
var tickCnt = 0;
var ts = 0;
function apiCb(obj) { function apiCb(obj) {
var e = document.getElementById("apiResult"); var e = document.getElementById("apiResult");
@ -107,6 +108,7 @@
} }
document.getElementById("wifi_rssi").innerHTML = obj["wifi_rssi"]; document.getElementById("wifi_rssi").innerHTML = obj["wifi_rssi"];
ts = obj["ts_now"];
var date = new Date(obj["ts_now"] * 1000); var date = new Date(obj["ts_now"] * 1000);
var up = obj["ts_uptime"]; var up = obj["ts_uptime"];
var days = parseInt(up / 86400) % 365; var days = parseInt(up / 86400) % 365;
@ -188,6 +190,18 @@
document.getElementById("warn_info").innerHTML = html; document.getElementById("warn_info").innerHTML = html;
} }
function tick() {
if(++tickCnt >= 10) {
tickCnt = 0;
getAjax('/api/index', parse);
}
else {
var dSpan = document.getElementById("date");
if(0 != ts)
dSpan.innerHTML = (new Date((ts+tickCnt) * 1000)).toLocaleString('de-DE');
}
}
function parse(obj) { function parse(obj) {
if(null != obj) { if(null != obj) {
if(exeOnce) if(exeOnce)
@ -196,9 +210,8 @@
parseStat(obj["statistics"]); parseStat(obj["statistics"]);
parseIv(obj["inverter"]); parseIv(obj["inverter"]);
parseWarnInfo(obj["warnings"], obj["infos"]); parseWarnInfo(obj["warnings"], obj["infos"]);
document.getElementById("refresh").innerHTML = 10;
if(exeOnce) { if(exeOnce) {
window.setInterval("getAjax('/api/index', parse)", 10000); window.setInterval("tick()", 1000);
exeOnce = false; exeOnce = false;
} }
} }

Loading…
Cancel
Save