From 2e94f2844137dcac147adebafe2c5acf5d6721a0 Mon Sep 17 00:00:00 2001 From: lumapu Date: Sun, 4 Feb 2024 00:24:44 +0100 Subject: [PATCH] 0.8.71 * removed "yield day" history --- src/CHANGES.md | 1 + src/plugins/history.h | 13 +++++++------ src/web/RestApi.h | 20 -------------------- src/web/html/history.html | 22 ---------------------- 4 files changed, 8 insertions(+), 48 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index b661b8d2..4a2e91f6 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -9,6 +9,7 @@ * save settings before they are exported #1395 * fix autologin bug if no password is set * translated `/serial` +* removed "yield day" history ## 0.8.70 - 2024-02-01 * prevent sending commands to inverter which isn't active #1387 diff --git a/src/plugins/history.h b/src/plugins/history.h index da57800f..7a938284 100644 --- a/src/plugins/history.h +++ b/src/plugins/history.h @@ -52,8 +52,8 @@ class HistoryData { mCurPwr.reset(); mCurPwr.refreshCycle = mConfig->inst.sendInterval; - mYieldDay.reset(); - mYieldDay.refreshCycle = 60; + //mYieldDay.reset(); + //mYieldDay.refreshCycle = 60; } void tickerSecond() { @@ -80,7 +80,7 @@ class HistoryData { mMaximumDay = roundf(maxPwr); } - if((++mYieldDay.loopCnt % mYieldDay.refreshCycle) == 0) { + /*if((++mYieldDay.loopCnt % mYieldDay.refreshCycle) == 0) { if (*mTs > mApp->getSunset()) { if ((!mDayStored) && (yldDay > 0)) { addValue(&mYieldDay, roundf(yldDay)); @@ -88,11 +88,12 @@ class HistoryData { } } else if (*mTs > mApp->getSunrise()) mDayStored = false; - } + }*/ } 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; return s->data[idx]; } @@ -119,7 +120,7 @@ class HistoryData { uint32_t *mTs; storage_t mCurPwr; - storage_t mYieldDay; + //storage_t mYieldDay; bool mDayStored = false; uint16_t mMaximumDay = 0; }; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index e6760390..240a18f2 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -107,7 +107,6 @@ class RestApi { #endif /* !defined(ETHERNET) */ else if(path == "live") getLive(request,root); else if (path == "powerHistory") getPowerHistory(request, root); - else if (path == "yieldDayHistory") getYieldDayHistory(request, root); else { if(path.substring(0, 12) == "inverter/id/") getInverter(root, request->url().substring(17).toInt()); @@ -208,7 +207,6 @@ class RestApi { ep[F("live")] = url + F("live"); #if defined(ENABLE_HISTORY) ep[F("powerHistory")] = url + F("powerHistory"); - ep[F("yieldDayHistory")] = url + F("yieldDayHistory"); #endif } @@ -832,24 +830,6 @@ class RestApi { #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) { Inverter<> *iv = mSys->getInverterByPos(jsonIn[F("id")]); bool accepted = true; diff --git a/src/web/html/history.html b/src/web/html/history.html index 975a02ed..b553a19f 100644 --- a/src/web/html/history.html +++ b/src/web/html/history.html @@ -20,14 +20,6 @@ {#MAXIMUM}: W. {#UPDATED} {#SECONDS}

-

{#TOTAL_YIELD_PER_DAY}

-
-
-

- {#MAXIMUM}: Wh
- {#UPDATED} {#SECONDS} -

-
{#HTML_FOOTER} @@ -94,20 +86,6 @@ if (pwrExeOnce) { pwrExeOnce = false; 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); } }