Skip to content

Commit

Permalink
modified: src/BatteryCanReceiver.cpp
Browse files Browse the repository at this point in the history
	modified:   src/SBSCanReceiver.cpp
  • Loading branch information
Snoopy-HSS committed Sep 4, 2024
1 parent 36d917c commit 795a493
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/BatteryCanReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 7 additions & 11 deletions src/SBSCanReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 795a493

Please sign in to comment.