Skip to content

Commit

Permalink
Fix: SBS CAN Receiver was not using the correct way to provide discha…
Browse files Browse the repository at this point in the history
…rge current limit
  • Loading branch information
AndreasBoehm committed Oct 23, 2024
1 parent 8bb5ac5 commit fa7f2ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion include/BatteryStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ class SBSBatteryStats : public BatteryStats {

float _chargeVoltage;
float _chargeCurrentLimitation;
float _dischargeCurrentLimitation;
uint16_t _stateOfHealth;
float _current;
float _temperature;
Expand Down
2 changes: 0 additions & 2 deletions src/BatteryStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ void SBSBatteryStats::getLiveViewData(JsonVariant& root) const
// values go into the "Status" card of the web application
addLiveViewValue(root, "chargeVoltage", _chargeVoltage, "V", 1);
addLiveViewValue(root, "chargeCurrentLimitation", _chargeCurrentLimitation, "A", 1);
addLiveViewValue(root, "dischargeCurrentLimitation", _dischargeCurrentLimitation, "A", 1);
addLiveViewValue(root, "stateOfHealth", _stateOfHealth, "%", 0);
addLiveViewValue(root, "current", _current, "A", 1);
addLiveViewValue(root, "temperature", _temperature, "°C", 1);
Expand Down Expand Up @@ -419,7 +418,6 @@ void SBSBatteryStats::mqttPublish() const

MqttSettings.publish("battery/settings/chargeVoltage", String(_chargeVoltage));
MqttSettings.publish("battery/settings/chargeCurrentLimitation", String(_chargeCurrentLimitation));
MqttSettings.publish("battery/settings/dischargeCurrentLimitation", String(_dischargeCurrentLimitation));
MqttSettings.publish("battery/stateOfHealth", String(_stateOfHealth));
MqttSettings.publish("battery/current", String(_current));
MqttSettings.publish("battery/temperature", String(_temperature));
Expand Down
6 changes: 3 additions & 3 deletions src/SBSCanReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ void SBSCanReceiver::onMessage(twai_message_t rx_message)

case 0x640: {
_stats->_chargeCurrentLimitation = (this->readSignedInt24(rx_message.data + 3) * 0.001);
_stats->_dischargeCurrentLimitation = (this->readSignedInt24(rx_message.data)) * 0.001;
_stats->setDischargeCurrentLimit(this->readSignedInt24(rx_message.data) * 0.001, millis());

if (_verboseLogging) {
MessageOutput.printf("[SBS Unipower] 1600 Currents %f, %f \r\n", _stats->_chargeCurrentLimitation, _stats->_dischargeCurrentLimitation);
MessageOutput.printf("[SBS Unipower] 1600 Currents %f, %f \r\n", _stats->_chargeCurrentLimitation, _stats->getDischargeCurrentLimit());
}
break;
}
Expand Down Expand Up @@ -144,7 +144,7 @@ void SBSCanReceiver::dummyData()
_stats->setSoC(42, 0/*precision*/, millis());
_stats->_chargeVoltage = dummyFloat(50);
_stats->_chargeCurrentLimitation = dummyFloat(33);
_stats->_dischargeCurrentLimitation = dummyFloat(12);
_stats->setDischargeCurrentLimit(dummyFloat(12), millis());
_stats->_stateOfHealth = 99;
_stats->setVoltage(48.67, millis());
_stats->_current = dummyFloat(-1);
Expand Down

0 comments on commit fa7f2ef

Please sign in to comment.