From 972d7f358fca964a91fc569bfa9c1c2f7c15e167 Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Fri, 26 Apr 2024 12:35:53 +0200 Subject: [PATCH] Changes --- lib/obp60task/PageBattery2.cpp | 1 - lib/obp60task/PageSolar.cpp | 24 +++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/obp60task/PageBattery2.cpp b/lib/obp60task/PageBattery2.cpp index 0af6aef..e0dfb1f 100644 --- a/lib/obp60task/PageBattery2.cpp +++ b/lib/obp60task/PageBattery2.cpp @@ -173,7 +173,6 @@ public: } // Logging voltage value - if (raw == NULL) return; LOG_DEBUG(GwLog::LOG,"Drawing at PageBattery2, Type:%s %s:=%f", batType, name1, raw); // Draw page diff --git a/lib/obp60task/PageSolar.cpp b/lib/obp60task/PageSolar.cpp index 5abaa4c..f3c9084 100644 --- a/lib/obp60task/PageSolar.cpp +++ b/lib/obp60task/PageSolar.cpp @@ -52,22 +52,31 @@ public: int solPower = config->getInt(config->solarPower); String batType = config->getString(config->batteryType); String backlightMode = config->getString(config->backlight); - String powerSensor = config->getString(config->usePowSensor1); + String powerSensor = config->getString(config->usePowSensor2); double value1 = 0; // Solar voltage double value2 = 0; // Solar current double value3 = 0; // Solar output power double valueTrend = 0; // Average over 10 values - double solPercentage = 0; // Solar load + int solPercentage = 0; // Solar load // Get voltage value String name1 = "VSol"; // Get raw value for trend indicator - value1 = commonData.data.solarVoltage; // Live data + if(powerSensor != "off"){ + value1 = commonData.data.solarVoltage; // Use voltage from external sensor + } + else{ + value1 = commonData.data.batteryVoltage; // Use internal voltage sensor + } value2 = commonData.data.solarCurrent; value3 = commonData.data.solarPower; - solPercentage = value3 * 100 / (double)solPower; // Load value + solPercentage = value3 * 100 / (double)solPower; // Load value + // Limits for battery level + if(solPercentage < 0) solPercentage = 0; + if(solPercentage > 99) solPercentage = 99; + bool valid1 = true; // Optical warning by limit violation @@ -134,7 +143,7 @@ public: if(solPower <= 999) getdisplay().print(solPower, 0); if(solPower > 999) getdisplay().print(float(solPower/1000.0), 1); getdisplay().setFont(&Ubuntu_Bold16pt7b); - if(solPower <= 999) getdisplay().print("w"); + if(solPower <= 999) getdisplay().print("W"); if(solPower > 999) getdisplay().print("kW"); // Show info @@ -154,6 +163,9 @@ public: getdisplay().print(solPercentage); getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("%"); + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(150, 235); + getdisplay().print("Load"); // Show sensor type info String i2cAddr = ""; @@ -231,8 +243,6 @@ public: getdisplay().setTextColor(textcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); if(keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); getdisplay().setCursor(130, 290); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); if(String(backlightMode) == "Control by Key"){ // Key for illumination