Skip to content

Commit

Permalink
adding frames
Browse files Browse the repository at this point in the history
  • Loading branch information
yashtheboss committed Jul 14, 2024
1 parent 4e21b83 commit 378558a
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion car-bsp/DataModules/src/CustomBMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,46 @@ uint16_t CustomBMSRx2::GetInternalTemp() const {
scripts->send("bms/rx2", http.getParameters());
}
#endif
}


//BMSFrame3: Implementation
CustomBMSRx3::CustomBMSRx3(uint32_t can_id) : DataModule(can_id, 0, this->Size, 0, false) {}

void CustomBMSRx3::FromByteArray(uint8_t* buff){
fault_flags_ = buff[0];
status_flags_ = buff[1];
pack_soc_ = (static_cast<uint16_t>(buff[3]) << 8) | buff[4];
}

bool CustomBMSRx3::GetLowCellVoltageFault() const {
return (fault_flags_ && 0b1);
}

bool CustomBMSRx3::GetHighCellVoltageFault() const {
return (fault_flags_ && 0b10);
}

bool CustomBMSRx3::GetHighDischargeCurrentFault() const {
return (fault_flags_ && 0b100);
}

bool CustomBMSRx3::GetHighChargeCurrentFault() const {
return (fault_flags_ && 0b1000);
}

bool CustomBMSRx3::GetHighTempFault() const {
return (fault_flags_ && 0b10000);
}

bool CustomBMSRx3::GetThermistorDisconnectedFault() const {
return (fault_flags_ && 0b100000);
}

bool CustomBMSRx3::GetCurrentSensorDisconnectedFault() const {
return (fault_flags_ && 0b1000000);
}

bool CustomBMSRx3::GetKillSwitchPressedFault() const {
return (fault_flags_ && 0b10000000);
}

0 comments on commit 378558a

Please sign in to comment.