Skip to content

Commit

Permalink
add fault states
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth10001 committed Jul 15, 2024
1 parent 9fd549f commit 9cd8961
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"memory": "cpp",
"thread": "cpp",
"tuple": "cpp",
"variant": "cpp"
"variant": "cpp",
"ios": "cpp",
"random": "cpp"
}
}
20 changes: 15 additions & 5 deletions car-bsp/DataModules/src/CustomBMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ void CustomBMSRx0::FromByteArray(uint8_t* buff) {
}

float CustomBMSRx0::GetPackVoltage() const {
return pack_voltage_ * 1e-2;
return pack_voltage_ * 1e-3;
}

float CustomBMSRx0::GetAvgCellVoltage() const {
return avg_cell_voltage_ * 1e-3;
return avg_cell_voltage_ * 1e-4;
}

float CustomBMSRx0::GetHighCellVoltage() const {
return high_cell_voltage_ * 1e-3;
return high_cell_voltage_ * 1e-4;
}

float CustomBMSRx0::GetLowCellVoltage() const {
return low_cell_voltage_ * 1e-3;
return low_cell_voltage_ * 1e-4;
}

#ifdef IS_TELEMETRY
Expand Down Expand Up @@ -216,7 +216,7 @@ bool CustomBMSRx3::GetHighChargeCurrentFault() const {

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

bool CustomBMSRx3::GetThermistorDisconnectedFault() const {
return (fault_flags_ && 0b100000);
Expand All @@ -238,6 +238,16 @@ uint16_t CustomBMSRx3::GetPackSoC() const{
void CustomBMSRx3::PostTelemetry(PythonScripts* scripts){
PythonHttp http;
http.init();
http.addData("low_cell_voltage_fault", GetLowCellVoltageFault());
http.addData("high_cell_voltage_fault", GetHighDischargeCurrentFault());
http.addData("high_charge_current_fault", GetHighChargeCurrentFault());
http.addData("high_discharge_current_fault", GetHighChargeCurrentFault());
http.addData("high_temp_fault", GetHighTempFault());
http.addData("thermistor_disconnected_fault", GetThermistorDisconnectedFault());
http.addData("current_sensor_disconnect_fault", GetCurrentSensorDisconnectedFault());
http.addData("kill_switch_pressed_fault", GetKillSwitchPressedFault());
scripts->send("bms/rx3", http.getParameters());
http.flush();
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion telemetry-collector/src/python/is_alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
send_tlm({
"model": "pi/alive"
})
time.sleep(5)
time.sleep(1)

0 comments on commit 9cd8961

Please sign in to comment.