From e514ef744b6e6ce7b79be581e98fc88310b7f3c8 Mon Sep 17 00:00:00 2001 From: MalteSchm Date: Sat, 1 Apr 2023 15:34:32 +0200 Subject: [PATCH] adding data age to battery data --- include/Battery.h | 2 ++ src/PylontechCanReceiver.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/include/Battery.h b/include/Battery.h index 39328347..ab9399e8 100644 --- a/include/Battery.h +++ b/include/Battery.h @@ -5,6 +5,8 @@ class BatteryClass { public: + uint32_t lastUpdate; + float chargeVoltage; float chargeCurrentLimitation; float dischargeCurrentLimitation; diff --git a/src/PylontechCanReceiver.cpp b/src/PylontechCanReceiver.cpp index ea013627..5d574050 100644 --- a/src/PylontechCanReceiver.cpp +++ b/src/PylontechCanReceiver.cpp @@ -133,6 +133,7 @@ void PylontechCanReceiverClass::parseCanPackets() Battery.stateOfCharge = this->readUnsignedInt16(rx_message.data); Battery.stateOfChargeLastUpdate = millis(); Battery.stateOfHealth = this->readUnsignedInt16(rx_message.data + 2); + Battery.lastUpdate = millis(); #ifdef PYLONTECH_DEBUG_ENABLED MessageOutput.printf("[Pylontech] soc: %d soh: %d\n",