mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-23 19:27:13 +02:00
0.8.71
* removed "yield day" history
This commit is contained in:
parent
80d07ae6fe
commit
2e94f28441
4 changed files with 8 additions and 48 deletions
|
@ -9,6 +9,7 @@
|
||||||
* save settings before they are exported #1395
|
* save settings before they are exported #1395
|
||||||
* fix autologin bug if no password is set
|
* fix autologin bug if no password is set
|
||||||
* translated `/serial`
|
* translated `/serial`
|
||||||
|
* removed "yield day" history
|
||||||
|
|
||||||
## 0.8.70 - 2024-02-01
|
## 0.8.70 - 2024-02-01
|
||||||
* prevent sending commands to inverter which isn't active #1387
|
* prevent sending commands to inverter which isn't active #1387
|
||||||
|
|
|
@ -52,8 +52,8 @@ class HistoryData {
|
||||||
|
|
||||||
mCurPwr.reset();
|
mCurPwr.reset();
|
||||||
mCurPwr.refreshCycle = mConfig->inst.sendInterval;
|
mCurPwr.refreshCycle = mConfig->inst.sendInterval;
|
||||||
mYieldDay.reset();
|
//mYieldDay.reset();
|
||||||
mYieldDay.refreshCycle = 60;
|
//mYieldDay.refreshCycle = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tickerSecond() {
|
void tickerSecond() {
|
||||||
|
@ -80,7 +80,7 @@ class HistoryData {
|
||||||
mMaximumDay = roundf(maxPwr);
|
mMaximumDay = roundf(maxPwr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((++mYieldDay.loopCnt % mYieldDay.refreshCycle) == 0) {
|
/*if((++mYieldDay.loopCnt % mYieldDay.refreshCycle) == 0) {
|
||||||
if (*mTs > mApp->getSunset()) {
|
if (*mTs > mApp->getSunset()) {
|
||||||
if ((!mDayStored) && (yldDay > 0)) {
|
if ((!mDayStored) && (yldDay > 0)) {
|
||||||
addValue(&mYieldDay, roundf(yldDay));
|
addValue(&mYieldDay, roundf(yldDay));
|
||||||
|
@ -88,11 +88,12 @@ class HistoryData {
|
||||||
}
|
}
|
||||||
} else if (*mTs > mApp->getSunrise())
|
} else if (*mTs > mApp->getSunrise())
|
||||||
mDayStored = false;
|
mDayStored = false;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t valueAt(HistoryStorageType type, uint16_t i) {
|
uint16_t valueAt(HistoryStorageType type, uint16_t i) {
|
||||||
storage_t *s = (HistoryStorageType::POWER == type) ? &mCurPwr : &mYieldDay;
|
//storage_t *s = (HistoryStorageType::POWER == type) ? &mCurPwr : &mYieldDay;
|
||||||
|
storage_t *s = &mCurPwr;
|
||||||
uint16_t idx = (s->dispIdx + i) % HISTORY_DATA_ARR_LENGTH;
|
uint16_t idx = (s->dispIdx + i) % HISTORY_DATA_ARR_LENGTH;
|
||||||
return s->data[idx];
|
return s->data[idx];
|
||||||
}
|
}
|
||||||
|
@ -119,7 +120,7 @@ class HistoryData {
|
||||||
uint32_t *mTs;
|
uint32_t *mTs;
|
||||||
|
|
||||||
storage_t mCurPwr;
|
storage_t mCurPwr;
|
||||||
storage_t mYieldDay;
|
//storage_t mYieldDay;
|
||||||
bool mDayStored = false;
|
bool mDayStored = false;
|
||||||
uint16_t mMaximumDay = 0;
|
uint16_t mMaximumDay = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,7 +107,6 @@ class RestApi {
|
||||||
#endif /* !defined(ETHERNET) */
|
#endif /* !defined(ETHERNET) */
|
||||||
else if(path == "live") getLive(request,root);
|
else if(path == "live") getLive(request,root);
|
||||||
else if (path == "powerHistory") getPowerHistory(request, root);
|
else if (path == "powerHistory") getPowerHistory(request, root);
|
||||||
else if (path == "yieldDayHistory") getYieldDayHistory(request, root);
|
|
||||||
else {
|
else {
|
||||||
if(path.substring(0, 12) == "inverter/id/")
|
if(path.substring(0, 12) == "inverter/id/")
|
||||||
getInverter(root, request->url().substring(17).toInt());
|
getInverter(root, request->url().substring(17).toInt());
|
||||||
|
@ -208,7 +207,6 @@ class RestApi {
|
||||||
ep[F("live")] = url + F("live");
|
ep[F("live")] = url + F("live");
|
||||||
#if defined(ENABLE_HISTORY)
|
#if defined(ENABLE_HISTORY)
|
||||||
ep[F("powerHistory")] = url + F("powerHistory");
|
ep[F("powerHistory")] = url + F("powerHistory");
|
||||||
ep[F("yieldDayHistory")] = url + F("yieldDayHistory");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,24 +830,6 @@ class RestApi {
|
||||||
#endif /*ENABLE_HISTORY*/
|
#endif /*ENABLE_HISTORY*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) {
|
|
||||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
|
||||||
#if defined(ENABLE_HISTORY)
|
|
||||||
obj[F("refresh")] = 86400; // 1 day
|
|
||||||
uint16_t max = 0;
|
|
||||||
for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) {
|
|
||||||
uint16_t value = mApp->getHistoryValue((uint8_t)HistoryStorageType::YIELD, fld);
|
|
||||||
obj[F("value")][fld] = value;
|
|
||||||
if (value > max)
|
|
||||||
max = value;
|
|
||||||
}
|
|
||||||
obj[F("max")] = max;
|
|
||||||
#else
|
|
||||||
obj[F("refresh")] = 86400; // 1 day
|
|
||||||
#endif /*ENABLE_HISTORY*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool setCtrl(JsonObject jsonIn, JsonObject jsonOut, const char *clientIP) {
|
bool setCtrl(JsonObject jsonIn, JsonObject jsonOut, const char *clientIP) {
|
||||||
Inverter<> *iv = mSys->getInverterByPos(jsonIn[F("id")]);
|
Inverter<> *iv = mSys->getInverterByPos(jsonIn[F("id")]);
|
||||||
bool accepted = true;
|
bool accepted = true;
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
{#MAXIMUM}: <span id="pwrMax"></span> W. {#UPDATED} <span id="pwrRefresh"></span> {#SECONDS}
|
{#MAXIMUM}: <span id="pwrMax"></span> W. {#UPDATED} <span id="pwrRefresh"></span> {#SECONDS}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<h3>{#TOTAL_YIELD_PER_DAY}</h3>
|
|
||||||
<div>
|
|
||||||
<div class="chartDiv" id="ydChart"> </div>
|
|
||||||
<p>
|
|
||||||
{#MAXIMUM}: <span id="ydMax"></span> Wh<br />
|
|
||||||
{#UPDATED} <span id="ydRefresh"></span> {#SECONDS}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#HTML_FOOTER}
|
{#HTML_FOOTER}
|
||||||
|
@ -94,20 +86,6 @@
|
||||||
if (pwrExeOnce) {
|
if (pwrExeOnce) {
|
||||||
pwrExeOnce = false;
|
pwrExeOnce = false;
|
||||||
window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", mRefresh * 1000);
|
window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", mRefresh * 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
getAjax("/api/yieldDayHistory", parseYieldDayHistory);
|
|
||||||
} , 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function parseYieldDayHistory(obj) {
|
|
||||||
if (null != obj) {
|
|
||||||
parseNav(obj.generic);
|
|
||||||
parseHistory(obj, "yd", ydExeOnce)
|
|
||||||
}
|
|
||||||
if (ydExeOnce) {
|
|
||||||
ydExeOnce = false;
|
|
||||||
window.setInterval("getAjax('/api/yieldDayHistory', parseYieldDayHistory)", mRefresh * 500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue