From 406e7fdb8f2746525ff587ba671c6bb84483a88b Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Mon, 8 Aug 2022 10:38:12 +0200 Subject: [PATCH] handling of reactive power limit --- tools/esp8266/app.cpp | 5 +++-- tools/esp8266/hmRadio.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 3b81dd65..e804553d 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -295,14 +295,15 @@ void app::loop(void) { iv->devControlRequest = false; switch (p->packet[12]){ case ActivePowerContr: - if (iv->devControlCmd == ActivePowerContr){ // ok inverter accepted the set point copy it to dtu eeprom + if (iv->devControlCmd >= ActivePowerContr && iv->devControlCmd <= PFSet){ // ok inverter accepted the set point copy it to dtu eeprom if (iv->powerLimit[1]>0){ // User want to have it persistent mEep->write(ADDR_INV_PWR_LIM + iv->id * 2,iv->powerLimit[0]); updateCrc(); mEep->commit(); DPRINTLN(DBG_INFO, F("Inverter has accepted power limit set point, written to dtu eeprom")); + } else { + DPRINTLN(DBG_INFO, F("Inverter has accepted power limit set point")); } - DPRINTLN(DBG_INFO, F("Inverter has accepted power limit set point")); iv->devControlCmd = Init; } break; diff --git a/tools/esp8266/hmRadio.h b/tools/esp8266/hmRadio.h index b64591ad..a08b662d 100644 --- a/tools/esp8266/hmRadio.h +++ b/tools/esp8266/hmRadio.h @@ -169,7 +169,7 @@ class HmRadio { int cnt = 0; mTxBuf[10] = cmd; // cmd --> 0x0b => Type_ActivePowerContr, 0 on, 1 off, 2 restart, 12 reactive power, 13 power factor mTxBuf[10 + (++cnt)] = 0x00; - if (cmd == ActivePowerContr){ + if (cmd >= ActivePowerContr && cmd <= PFSet){ // 4 bytes control data // Power Limit fix point 10 eg. 30 W --> 0d300 = 0x012c // -1 = 0xffff --> no limit