mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-23 03:07:12 +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
|
||||
* 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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -20,14 +20,6 @@
|
|||
{#MAXIMUM}: <span id="pwrMax"></span> W. {#UPDATED} <span id="pwrRefresh"></span> {#SECONDS}
|
||||
</p>
|
||||
</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>
|
||||
{#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue