From 795a4930e4756947bbbff0bdbf29a35d2d6eaabb Mon Sep 17 00:00:00 2001 From: Snoopy-HSS Date: Wed, 4 Sep 2024 20:34:34 +0200 Subject: [PATCH] modified: src/BatteryCanReceiver.cpp modified: src/SBSCanReceiver.cpp --- src/BatteryCanReceiver.cpp | 2 +- src/SBSCanReceiver.cpp | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/BatteryCanReceiver.cpp b/src/BatteryCanReceiver.cpp index e6c6d13b2..f153185ea 100644 --- a/src/BatteryCanReceiver.cpp +++ b/src/BatteryCanReceiver.cpp @@ -170,7 +170,7 @@ int16_t BatteryCanReceiver::readSignedInt16(uint8_t *data) int32_t BatteryCanReceiver::readSignedInt24(uint8_t *data) { -return data[0] | data[1] << 8 | data[2] << 16 ; + return data[0] | data[1] << 8 | data[2] << 16 ; } uint32_t BatteryCanReceiver::readUnsignedInt32(uint8_t *data) diff --git a/src/SBSCanReceiver.cpp b/src/SBSCanReceiver.cpp index 67fe986fc..bd70fcf00 100644 --- a/src/SBSCanReceiver.cpp +++ b/src/SBSCanReceiver.cpp @@ -27,33 +27,29 @@ void SBSCanReceiver::onMessage(twai_message_t rx_message) } case 0x630: { - String state = ""; - int clusterstate = rx_message.data[0]; switch (clusterstate) { case 0: - state = "Inactive"; + _stats->_dischargeEnabled = 0; break; - case 1: { - state = "Discharge"; + case 1: _stats->_chargeEnabled = 1; _stats->_dischargeEnabled = 1; break; - } - case 2: { - state = "Charge"; + case 2: _stats->_chargeEnabled = 1; break; - } case 4: - state = "Fault"; + _stats->_chargeEnabled = 0; + _stats->_dischargeEnabled = 0; break; case 8: - state = "Deepsleep"; + _stats->_chargeEnabled = 0; + _stats->_dischargeEnabled = 0; break; default: