diff --git a/README.md b/README.md index d8d245b2..07556d2f 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,14 @@ This fork adds the following features: ### Added chart to Display128x64 ### Added a History menu -This menu displays a bar-chart of the last 256 total power values -and a bar chart of the last 256 Yield-Day values. - +This menu displays +- a bar-chart of the last 256 Total-Power values +- a bar chart of the last 256 Yield-Day values. Note: The history of the values gets lost after rebbot! ### Changed WiFi reconnect behaviour For me the original reconnect did not work. I always lost connection after some time. -Now it is much more stable. \ No newline at end of file +Now it is more stable. + +### Reduced frequency channels +Removed frequencies 2461, 2475MHz. Now the transfers are much more stable \ No newline at end of file diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index 07bb8c00..a9f24776 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -48,6 +48,9 @@ class HmRadio { mRfChLst[2] = 40; mRfChLst[3] = 61; mRfChLst[4] = 75; + // VArt: Overwriting 61/75 so I got much more stable responses + mRfChLst[3] = 23; + mRfChLst[4] = 40; // default channels mTxChIdx = 2; // Start TX with 40 @@ -134,10 +137,10 @@ class HmRadio { mNrf24.setChannel(mRfChLst[mRxChIdx]); mNrf24.startListening(); - uint32_t startMicros = micros(); uint32_t loopMillis = millis(); while (millis()-loopMillis < 400) { - while (micros()-startMicros < 5110) { // listen (4088us or?) 5110us to each channel + uint32_t startMicros = micros(); + while (micros()-startMicros < 5111) { // listen (4088us or?) 5110us to each channel if (mIrqRcvd) { mIrqRcvd = false; if (getReceived()) { // everything received @@ -147,7 +150,6 @@ class HmRadio { yield(); } // switch to next RX channel - startMicros = micros(); if(++mRxChIdx >= RF_CHANNELS) mRxChIdx = 0; mNrf24.setChannel(mRfChLst[mRxChIdx]); diff --git a/src/plugins/history.cpp b/src/plugins/history.cpp index 720d5689..ad7cac77 100644 --- a/src/plugins/history.cpp +++ b/src/plugins/history.cpp @@ -11,6 +11,7 @@ void TotalPowerHistory::setup(IApp *app, HmSystemType *sys, settings_t *config) mConfig = config; mRefreshCycle = 0; mRefreshCycle = mConfig->nrf.sendInterval; + mMaximumDay = 0; } void TotalPowerHistory::tickerSecond() { @@ -18,7 +19,8 @@ void TotalPowerHistory::tickerSecond() { if ((mLoopCnt % mRefreshCycle) == 0) { //DPRINTLN(DBG_DEBUG,F("TotalPowerHistory::tickerSecond > refreshCycle" + String(mRefreshCycle) + "|" + String(mLoopCnt) + "|" + String(mRefreshCycle % mLoopCnt)); mLoopCnt = 0; - float totalPower = -0.1; + float totalPower = 0; + float totalPowerDay = 0; Inverter<> *iv; record_t<> *rec; for (uint8_t i = 0; i < mSys->getNumInverters(); i++) { @@ -27,12 +29,16 @@ void TotalPowerHistory::tickerSecond() { if (iv == NULL) continue; totalPower += iv->getChannelFieldValue(CH0, FLD_PAC, rec); + totalPowerDay += iv->getChannelFieldValue(CH0, FLD_MP, rec); } if (totalPower > 0) { uint16_t iTotalPower = roundf(totalPower); DPRINTLN(DBG_DEBUG, F("addValue(iTotalPower)=") + String(iTotalPower)); addValue(iTotalPower); } + if (totalPowerDay > 0) { + mMaximumDay = roundf(totalPowerDay); + } } } diff --git a/src/plugins/history.h b/src/plugins/history.h index 46a8d7b9..27bfe0f5 100644 --- a/src/plugins/history.h +++ b/src/plugins/history.h @@ -52,6 +52,7 @@ class TotalPowerHistory : public HistoryData { void setup(IApp *app, HmSystemType *sys, settings_t *config); void tickerSecond(); + uint16_t getMaximumDay() { return mMaximumDay; } private: IApp *mApp; @@ -60,6 +61,8 @@ class TotalPowerHistory : public HistoryData { settings_t *mConfig; uint16_t mRefreshCycle; uint16_t mLoopCnt; + + uint16_t mMaximumDay; }; class YieldDayHistory : public HistoryData { diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 9ea3511d..6e48c401 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -608,9 +608,10 @@ class RestApi { obj[F("value")][fld] = value; if (value > maximum) maximum = value; - } - obj[F("maximum")] = maximum; - obj[F("dispIndex")] = p->getDisplIdx(); + } + obj[F("maximum")] = maximum; + obj[F("maximumDay")] = p->getMaximumDay(); + obj[F("dispIndex")] = p->getDisplIdx(); } void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) { diff --git a/src/web/html/history.html b/src/web/html/history.html index a182b4c0..4466f430 100644 --- a/src/web/html/history.html +++ b/src/web/html/history.html @@ -17,15 +17,15 @@
- Maximum value: Watt
- Updated every seconds
- Maximum value: Watt
+ Maximum value: Wh
Updated every seconds