Skip to content

Commit

Permalink
0.8.3
Browse files Browse the repository at this point in the history
* fix yield day reset during day #848
* add total AC Max Power to WebUI
* fix opendtufusion build (GxEPD patch)
  • Loading branch information
lumapu committed Nov 9, 2023
1 parent 975f692 commit 56a1f3b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 17 deletions.
11 changes: 5 additions & 6 deletions patches/GxEPD2_SW_SPI.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ index 1588444..592869b 100644
{
_initial_write = true;
_initial_refresh = true;
@@ -67,27 +67,30 @@ void GxEPD2_EPD::init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset
@@ -71,27 +71,30 @@ void GxEPD2_EPD::init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset
{
pinMode(_busy, INPUT);
}
Expand Down Expand Up @@ -58,7 +58,7 @@ index 1588444..592869b 100644
}

void GxEPD2_EPD::setBusyCallback(void (*busyCallback)(const void*), const void* busy_callback_parameter)
@@ -96,12 +99,6 @@ void GxEPD2_EPD::setBusyCallback(void (*busyCallback)(const void*), const void*
@@ -100,12 +103,6 @@ void GxEPD2_EPD::setBusyCallback(void (*busyCallback)(const void*), const void*
_busy_callback_parameter = busy_callback_parameter;
}

Expand All @@ -71,7 +71,7 @@ index 1588444..592869b 100644
void GxEPD2_EPD::_reset()
{
if (_rst >= 0)
@@ -168,115 +165,201 @@ void GxEPD2_EPD::_waitWhileBusy(const char* comment, uint16_t busy_time)
@@ -174,115 +169,201 @@ void GxEPD2_EPD::_waitWhileBusy(const char* comment, uint16_t busy_time)

void GxEPD2_EPD::_writeCommand(uint8_t c)
{
Expand Down Expand Up @@ -334,7 +334,7 @@ index ef2318f..50aa961 100644
protected:
void _reset();
void _waitWhileBusy(const char* comment = 0, uint16_t busy_time = 5000);
@@ -111,16 +115,21 @@ class GxEPD2_EPD
@@ -111,9 +115,14 @@ class GxEPD2_EPD
void _startTransfer();
void _transfer(uint8_t value);
void _endTransfer();
Expand All @@ -351,8 +351,7 @@ index ef2318f..50aa961 100644
bool _diag_enabled, _pulldown_rst_mode;
- SPIClass* _pSPIx;
SPISettings _spi_settings;
bool _initial_write, _initial_refresh;
bool _power_is_on, _using_partial_mode, _hibernating;
@@ -123,5 +124,5 @@ class GxEPD2_EPD
uint16_t _reset_duration;
- void (*_busy_callback)(const void*);
+ void (*_busy_callback)(const void*);
Expand Down
5 changes: 5 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Development Changes

## 0.8.3 - 2023-11-09
* fix yield day reset during day #848
* add total AC Max Power to WebUI
* fix opendtufusion build (GxEPD patch)

## 0.8.2 - 2023-11-08
* beautified inverter settings in `setup` (preperation for future, settings become more inverter dependent)

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 8
#define VERSION_PATCH 2
#define VERSION_PATCH 3

//-------------------------------------
typedef struct {
Expand Down
17 changes: 15 additions & 2 deletions src/hm/hmInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ class Inverter {
rssi = -127;
memset(&radioStatistics, 0, sizeof(statistics_t));
memset(txRfQuality, -6, 5);

memset(mOffYD, 0, sizeof(float) * 6);
memset(mLastYD, 0, sizeof(float) * 6);
}

void tickSend(std::function<void(uint8_t cmd, bool isDevControl)> cb) {
Expand Down Expand Up @@ -266,7 +269,12 @@ class Inverter {
} else if (FLD_YT == rec->assign[pos].fieldId) {
rec->record[pos] = ((REC_TYP)(val) / (REC_TYP)(div) * generalConfig->yieldEffiency) + ((REC_TYP)config->yieldCor[rec->assign[pos].ch-1]);
} else if (FLD_YD == rec->assign[pos].fieldId) {
rec->record[pos] = (REC_TYP)(val) / (REC_TYP)(div) * generalConfig->yieldEffiency;
float actYD = (REC_TYP)(val) / (REC_TYP)(div) * generalConfig->yieldEffiency;
uint8_t idx = rec->assign[pos].ch - 1;
if (mLastYD[idx] > actYD)
mOffYD[idx] += mLastYD[idx];
mLastYD[idx] = actYD;
rec->record[pos] = mOffYD[idx] + actYD;
} else {
if ((REC_TYP)(div) > 1)
rec->record[pos] = (REC_TYP)(val) / (REC_TYP)(div);
Expand Down Expand Up @@ -540,6 +548,9 @@ class Inverter {
alarmNxtWrPos = 0;
alarmCnt = 0;
alarmLastId = 0;

memset(mOffYD, 0, sizeof(float) * 6);
memset(mLastYD, 0, sizeof(float) * 6);
}

uint16_t parseAlarmLog(uint8_t id, uint8_t pyld[], uint8_t len) {
Expand Down Expand Up @@ -662,7 +673,9 @@ class Inverter {
radioId.b[0] = 0x01;
}

bool mDevControlRequest; // true if change needed
private:
float mOffYD[6], mLastYD[6];
bool mDevControlRequest; // true if change needed
};

template <class REC_TYP>
Expand Down
4 changes: 2 additions & 2 deletions src/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ lib_deps =
https://github.com/bertmelis/espMqttClient#v1.4.5
bblanchon/ArduinoJson @ ^6.21.3
https://github.com/JChristensen/Timezone @ ^1.2.4
olikraus/U8g2 @ ^2.34.17
olikraus/U8g2 @ ^2.35.7
https://github.com/zinggjm/GxEPD2 @ ^1.5.2
build_flags =
-std=c++17
Expand Down Expand Up @@ -98,7 +98,7 @@ lib_deps =
https://github.com/bertmelis/espMqttClient#v1.4.4
bblanchon/ArduinoJson @ ^6.21.3
https://github.com/JChristensen/Timezone @ ^1.2.4
olikraus/U8g2 @ ^2.34.17
olikraus/U8g2 @ ^2.35.7
zinggjm/GxEPD2 @ ^1.5.2
build_flags = ${env.build_flags}
-D ETHERNET
Expand Down
14 changes: 8 additions & 6 deletions src/web/html/visualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
var units, ivEn;
var mIvHtml = [];
var mNum = 0;
var total = Array(5).fill(0);
var total = Array(6).fill(0);
var tPwrAck;

function parseGeneric(obj) {
Expand Down Expand Up @@ -61,7 +61,7 @@
}

function totals() {
for(var i = 0; i < 5; i++) {
for(var i = 0; i < 6; i++) {
total[i] = Math.round(total[i] * 100) / 100;
}

Expand All @@ -80,8 +80,9 @@
]),
ml("div", {class: "hr"}),
ml("div", {class: "row"}, [
numMid(total[3], "W", "DC Power"),
numMid(total[4], "var", "Reactive Power")
numMid(total[3], "W", "Max Power"),
numMid(total[4], "W", "DC Power"),
numMid(total[5], "var", "Reactive Power")
])
])
])
Expand All @@ -90,8 +91,9 @@
function ivHead(obj) {
if(0 != obj.status) { // only add totals if inverter is online
total[0] += obj.ch[0][2]; // P_AC
total[3] += obj.ch[0][8]; // P_DC
total[4] += obj.ch[0][10]; // Q_AC
total[3] += obj.ch[0][11]; // MAX P_AC
total[4] += obj.ch[0][8]; // P_DC
total[5] += obj.ch[0][10]; // Q_AC
}
total[1] += obj.ch[0][7]; // YieldDay
total[2] += obj.ch[0][6]; // YieldTotal
Expand Down

0 comments on commit 56a1f3b

Please sign in to comment.