Skip to content

Commit

Permalink
0.7.20
Browse files Browse the repository at this point in the history
* merge PR #1048 version and hash in API, fixes #1045
* fix: no yield day update if yield day reads `0` after inverter reboot (mostly on evening) #848
* try to fix Wifi override #1047
* added information after NTP sync to WebUI #1040
  • Loading branch information
lumapu committed Jul 28, 2023
1 parent a893ae1 commit 53ff04b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 14 deletions.
6 changes: 6 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Development Changes

## 0.7.20 - 2023-07-28
* merge PR #1048 version and hash in API, fixes #1045
* fix: no yield day update if yield day reads `0` after inverter reboot (mostly on evening) #848
* try to fix Wifi override #1047
* added information after NTP sync to WebUI #1040

## 0.7.19 - 2023-07-27
* next attempt to fix yield day for multiple inverters #1016
* reduced threshold for inverter state machine from 60min to 15min to go from state `WAS_ON` to `OFF`
Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 7
#define VERSION_PATCH 19
#define VERSION_PATCH 20

//-------------------------------------
typedef struct {
Expand Down
14 changes: 10 additions & 4 deletions src/publisher/pubMqttIvData.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class PubMqttIvData {
void stateStart() {
mLastIvId = 0;
mTotalFound = false;
mSendTotalYd = true;
mAllTotalFound = true;
if(!mSendList->empty()) {
mCmd = mSendList->front().cmd;
Expand Down Expand Up @@ -136,9 +137,14 @@ class PubMqttIvData {
case FLD_YT:
mTotal[1] += mIv->getValue(mPos, rec);
break;
case FLD_YD:
mTotal[2] += mIv->getValue(mPos, rec);
case FLD_YD: {
uint8_t val = mIv->getValue(mPos, rec);
if(0 == val) // inverter restarted during day
mSendTotalYd = false;
else
mTotal[2] += val;
break;
}
case FLD_PDC:
mTotal[3] += mIv->getValue(mPos, rec);
break;
Expand Down Expand Up @@ -180,7 +186,7 @@ class PubMqttIvData {
fieldId = FLD_YT;
break;
case 2:
if(!mAllTotalFound) {
if((!mAllTotalFound) || (!mSendTotalYd)) {
mPos++;
return;
}
Expand Down Expand Up @@ -210,7 +216,7 @@ class PubMqttIvData {

uint8_t mCmd;
uint8_t mLastIvId;
bool mSendTotals, mTotalFound, mAllTotalFound;
bool mSendTotals, mTotalFound, mAllTotalFound, mSendTotalYd;
float mTotal[4];

Inverter<> *mIv, *mIvSend;
Expand Down
1 change: 1 addition & 0 deletions src/web/RestApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class RestApi {
void getGeneric(AsyncWebServerRequest *request, JsonObject obj) {
obj[F("wifi_rssi")] = (WiFi.status() != WL_CONNECTED) ? 0 : WiFi.RSSI();
obj[F("ts_uptime")] = mApp->getUptime();
obj[F("ts_now")] = mApp->getTimestamp();
obj[F("version")] = String(mApp->getVersion());
obj[F("build")] = String(AUTO_GIT_HASH);
obj[F("menu_prot")] = mApp->getProtection(request);
Expand Down
26 changes: 23 additions & 3 deletions src/web/html/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,17 @@
<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-3 my-2">set System time</div>
<div class="col-12 col-sm-9">
<input type="button" name="ntpBtn" id="ntpBtn" class="btn" value="from browser" onclick="setTime()"/>
<input type="button" name="ntpSync" id="ntpSync" class="btn" value="sync NTP" onclick="syncTime()"/>
<input type="button" name="ntpSync" id="ntpSync" class="btn" value="sync NTP" onclick="syncTime()"/><br/>
<span id="apiResultNtp"></span>
</div>
</div>
<div class="row mb-3">
<div class="col-12 col-sm-3 my-2">System Time</div>
<div class="col-12 col-sm-9 my-2"><span id="date"></span></div>
</div>
</fieldset>
</div>

Expand Down Expand Up @@ -333,6 +337,7 @@
<script type="text/javascript">
var highestId = 0;
var maxInv = 0;
var ts = 0;

var esp8266pins = [
[255, "off / default"],
Expand Down Expand Up @@ -474,11 +479,17 @@
function apiCbNtp(obj) {
var e = document.getElementById("apiResultNtp");
if(obj["success"])
e.innerHTML = "command excuted";
e.innerHTML = "command excuted, set new time ...";
else
e.innerHTML = "Error: " + obj["error"];
}

function apiCbNtp2(obj) {
var e = document.getElementById("apiResultNtp");
var date = new Date(obj["ts_now"] * 1000);
e.innerHTML = "synced at: " + toIsoDateStr(date) + ", difference: " + (ts - obj["ts_now"]) + "ms";
}

function apiCbMqtt(obj) {
var e = document.getElementById("apiResultMqtt");
if(obj["success"])
Expand All @@ -493,6 +504,7 @@
obj.cmd = "set_time";
obj.val = parseInt(date.getTime() / 1000);
getAjax("/api/setup", apiCbNtp, "POST", JSON.stringify(obj));
setTimeout(function() {getAjax('/api/index', apiCbNtp2)}, 2000);
}

function scan() {
Expand All @@ -506,6 +518,7 @@
var obj = new Object();
obj.cmd = "sync_ntp";
getAjax("/api/setup", apiCbNtp, "POST", JSON.stringify(obj));
setTimeout(function() {getAjax('/api/index', apiCbNtp2)}, 2000);
}

function sendDiscoveryConfig() {
Expand Down Expand Up @@ -664,6 +677,9 @@
parseNav(obj);
parseESP(obj);
parseRssi(obj);

ts = obj["ts_now"];
window.setInterval("tick()", 1000);
}

function parseStaticIp(obj) {
Expand Down Expand Up @@ -869,6 +885,10 @@
}
}

function tick() {
document.getElementById("date").innerHTML = toIsoDateStr((new Date((++ts) * 1000)));
}

function parse(root) {
if(null != root) {
parseSys(root["system"]);
Expand Down
14 changes: 8 additions & 6 deletions src/wifi/ahoywifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ void ahoywifi::setupWifi(bool startAP = false) {
}
#endif
#if !defined(AP_ONLY)
if(mConfig->valid) {
#if !defined(FB_WIFI_OVERRIDDEN)
#if defined(FB_WIFI_OVERRIDDEN)
snprintf(mConfig->sys.stationSsid, SSID_LEN, "%s", FB_WIFI_SSID);
snprintf(mConfig->sys.stationPwd, PWD_LEN, "%s", FB_WIFI_PWD);
setupStation();
#else
if(mConfig->valid) {
if(strncmp(mConfig->sys.stationSsid, FB_WIFI_SSID, 14) != 0)
setupStation();
#else
setupStation();
#endif
}
}
#endif
#endif
}

Expand Down

0 comments on commit 53ff04b

Please sign in to comment.