Skip to content

Commit

Permalink
Over temp fault code
Browse files Browse the repository at this point in the history
  • Loading branch information
vedderb committed Jan 22, 2015
1 parent 3b2703b commit b7e5692
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ typedef enum {
FAULT_CODE_OVER_VOLTAGE,
FAULT_CODE_UNDER_VOLTAGE,
FAULT_CODE_DRV8302,
FAULT_CODE_ABS_OVER_CURRENT
FAULT_CODE_ABS_OVER_CURRENT,
FAULT_CODE_OVER_TEMP_FET,
FAULT_CODE_OVER_TEMP_MOTOR
} mc_fault_code;

typedef enum {
Expand Down
3 changes: 3 additions & 0 deletions mcpwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ static void update_override_limits(volatile mc_configuration *conf) {
} else if (temp > conf->l_temp_fet_end) {
conf->lo_current_min = 0.0;
conf->lo_current_max = 0.0;
fault_stop(FAULT_CODE_OVER_TEMP_FET);
} else {
float maxc = fabsf(conf->l_current_max);
if (fabsf(conf->l_current_min) > maxc) {
Expand Down Expand Up @@ -719,6 +720,8 @@ const char* mcpwm_fault_to_string(mc_fault_code fault) {
case FAULT_CODE_UNDER_VOLTAGE: return "FAULT_CODE_UNDER_VOLTAGE"; break;
case FAULT_CODE_DRV8302: return "FAULT_CODE_DRV8302"; break;
case FAULT_CODE_ABS_OVER_CURRENT: return "FAULT_CODE_ABS_OVER_CURRENT"; break;
case FAULT_CODE_OVER_TEMP_FET: return "FAULT_CODE_OVER_TEMP_FET"; break;
case FAULT_CODE_OVER_TEMP_MOTOR: return "FAULT_CODE_OVER_TEMP_MOTOR"; break;
default: return "FAULT_UNKNOWN"; break;
}
}
Expand Down

0 comments on commit b7e5692

Please sign in to comment.