This commit is contained in:
crinq
2017-10-16 02:05:26 +02:00
parent b001610bbf
commit 561eefe499
3 changed files with 17 additions and 6 deletions
+2 -1
View File
@@ -20,7 +20,8 @@ typedef enum {
JOINT_FB_ERROR,
POS_ERROR,
SAT_ERROR,
HV_ERROR,
HV_CRC_ERROR,
HV_TIMEOUT_ERROR,
HV_TEMP_ERROR,
HV_VOLT_ERROR,
MOT_TEMP_ERROR,
+13 -3
View File
@@ -163,8 +163,14 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
}
if(err_filter(&(ctx->hv_error), 3.0, 0.001, PIN(hv_error) > 0.0)) {
ctx->fault = HV_ERROR;
if(PIN(hv_error) > 1.0){
ctx->fault = HV_TIMEOUT_ERROR;
}
else{
ctx->fault = HV_CRC_ERROR;
}
ctx->state = SOFT_FAULT;
}
if(ABS(PIN(pos_error)) > PIN(max_pos_error)) {
@@ -321,8 +327,12 @@ static void nrt_func(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
printf("saturation error\n");
break;
case HV_ERROR:
printf("HV error\n");
case HV_CRC_ERROR:
printf("HV crc error\n");
break;
case HV_TIMEOUT_ERROR:
printf("HV timeout error\n");
break;
case HV_TEMP_ERROR:
+2 -2
View File
@@ -211,10 +211,10 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
}
}
if(ctx->timeout > 5) {
if(ctx->timeout > 3) {
PIN(timeout)
++;
PIN(com_error) = 1.0;
PIN(com_error) = 2.0;
}
ctx->timeout++;