From c915e445576b68e19efbe00136bbadcc03d70570 Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Sat, 6 Aug 2022 18:23:49 +0200 Subject: [PATCH] Removed set power limit to zero in intial case --- tools/esp8266/app.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index d19e43c4..a6c9c806 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -83,9 +83,11 @@ void app::setup(uint32_t timeout) { iv = mSys->addInverter(name, invSerial, modPwr); if(NULL != iv) { mEep->read(ADDR_INV_PWR_LIM + (i * 2),&iv->powerLimit); - iv->devControlCmd = 11; // set active power limit - iv->devControlRequest = true; // set to true to update the active power limit from setup html page - DPRINTLN(DBG_INFO, F("add inverter: ") + String(name) + ", SN: " + String(invSerial, HEX) + ", Power Limit: " + String(iv->powerLimit)); + if (iv->powerLimit != 0xffff) { // only set it, if it is changed by user. Default value in the html setup page is -1 = 0xffff + iv->devControlCmd = 11; // set active power limit + iv->devControlRequest = true; // set to true to update the active power limit from setup html page + DPRINTLN(DBG_INFO, F("add inverter: ") + String(name) + ", SN: " + String(invSerial, HEX) + ", Power Limit: " + String(iv->powerLimit)); + } for(uint8_t j = 0; j < 4; j++) { mEep->read(ADDR_INV_CH_NAME + (i * 4 * MAX_NAME_LENGTH) + j * MAX_NAME_LENGTH, iv->chName[j], MAX_NAME_LENGTH); } @@ -550,7 +552,12 @@ void app::showSetup(void) { inv += F(""); inv += F(""; @@ -928,7 +935,9 @@ void app::saveValues(bool webSend = true) { // active power limit activepowerlimit = mWeb->arg("inv" + String(i) + "ActivePowerLimit").toInt(); - mEep->write(ADDR_INV_PWR_LIM + i * 2,activepowerlimit); + if (activepowerlimit != 0xffff && activepowerlimit > 0) { + mEep->write(ADDR_INV_PWR_LIM + i * 2,activepowerlimit); + } // name mWeb->arg("inv" + String(i) + "Name").toCharArray(buf, 20);