From 35a09bb538224401e52ea15e90f1f266437a6ec9 Mon Sep 17 00:00:00 2001 From: Raphael Pertl Date: Sat, 22 Feb 2020 22:21:11 +0100 Subject: [PATCH] add qpiri as a configurable value --- sources/inverter-cli/inverter.conf | 2 ++ sources/inverter-cli/inverter.cpp | 2 +- sources/inverter-cli/inverter.h | 2 ++ sources/inverter-cli/main.cpp | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sources/inverter-cli/inverter.conf b/sources/inverter-cli/inverter.conf index 5d45fb4..e90ba86 100644 --- a/sources/inverter-cli/inverter.conf +++ b/sources/inverter-cli/inverter.conf @@ -21,3 +21,5 @@ amperage_factor=1.0 # This allos you to modify the wattage in case the inverter is giving an incorrect # reading compared to measurement tools. Normally this will remain '1' watt_factor=1.01 + +qpiri=97 diff --git a/sources/inverter-cli/inverter.cpp b/sources/inverter-cli/inverter.cpp index 97a5ebc..cb553b2 100644 --- a/sources/inverter-cli/inverter.cpp +++ b/sources/inverter-cli/inverter.cpp @@ -176,7 +176,7 @@ void cInverter::poll() { // Reading QPIRI status if (!ups_qpiri_changed) { - if (query("QPIRI", 97)) { + if (query("QPIRI", qpiri)) { m.lock(); strcpy(status2, (const char*)buf+1); m.unlock(); diff --git a/sources/inverter-cli/inverter.h b/sources/inverter-cli/inverter.h index 8e3d52b..a978a4f 100644 --- a/sources/inverter-cli/inverter.h +++ b/sources/inverter-cli/inverter.h @@ -34,6 +34,8 @@ class cInverter { string *GetQpigsStatus(); string *GetWarnings(); + int qpiri; + int GetMode(); void ExecuteCmd(const std::string cmd); }; diff --git a/sources/inverter-cli/main.cpp b/sources/inverter-cli/main.cpp index 8802e87..4cb0b04 100644 --- a/sources/inverter-cli/main.cpp +++ b/sources/inverter-cli/main.cpp @@ -43,6 +43,7 @@ string devicename; int runinterval; float ampfactor; float wattfactor; +int qpiri; // --------------------------------------- @@ -90,6 +91,8 @@ void getSettingsFile(string filename) { attemptAddSetting(&wattfactor, linepart2); else if(linepart1 == "watt_factor") attemptAddSetting(&wattfactor, linepart2); + else if(linepart1 == "qpiri") + attemptAddSetting(&qpiri, linepart2); else continue; }