mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 07:14:22 +08:00
add psu brownout check to do_checks
This commit is contained in:
@@ -1324,16 +1324,13 @@ bool check_DRV_fault(Motor_t* motor) {
|
||||
|
||||
//Returns true if everything is OK (no fault)
|
||||
bool check_PSU_brownout(Motor_t* motor) {
|
||||
if(vbus_voltage < motor->dc_bus_brownout_trip_level) {
|
||||
motor->error = ERROR_DC_BUS_BROWNOUT;
|
||||
if(vbus_voltage < motor->dc_bus_brownout_trip_level)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true if everything is ok. Sets motor->error and returns false otherwise.
|
||||
bool do_checks(Motor_t* motor) {
|
||||
// Checks
|
||||
if (!check_DRV_fault(motor)) {
|
||||
motor->error = ERROR_DRV_FAULT;
|
||||
// Update DRV Fault Code
|
||||
@@ -1344,6 +1341,10 @@ bool do_checks(Motor_t* motor) {
|
||||
DRV8301_readData(&motor->gate_driver, local_regs);
|
||||
return false;
|
||||
}
|
||||
if (!check_PSU_brownout(motor)) {
|
||||
motor->error = ERROR_DC_BUS_BROWNOUT;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user