diff --git a/Src/util.c b/Src/util.c index 733ab02..67002a9 100644 --- a/Src/util.c +++ b/Src/util.c @@ -643,8 +643,8 @@ void updateCurSpdLim(void) { void standstillHold(void) { #if defined(STANDSTILL_HOLD_ENABLE) && (CTRL_TYP_SEL == FOC_CTRL) && (CTRL_MOD_REQ != SPD_MODE) if (!rtP_Left.b_cruiseCtrlEna) { // If Stanstill in NOT Active -> try Activation - if (((input1[inIdx].cmd > 50 || input2[inIdx].cmd < -50) && speedAvgAbs < 30) // Check if Brake is pressed AND measured speed is small - || (input2[inIdx].cmd < 20 && speedAvgAbs < 5)) { // OR Throttle is small AND measured speed is very small + if ((input1[inIdx].cmd > 50 && speedAvgAbs < 30) // Check if Brake is pressed AND measured speed is small + || (abs(input2[inIdx].cmd) < 20 && speedAvgAbs < 5)) { // OR Throttle is small AND measured speed is very small rtP_Left.n_cruiseMotTgt = 0; rtP_Right.n_cruiseMotTgt = 0; rtP_Left.b_cruiseCtrlEna = 1; @@ -653,7 +653,7 @@ void standstillHold(void) { } } else { // If Stanstill is Active -> try Deactivation - if (input1[inIdx].cmd < 20 && input2[inIdx].cmd > 50 && !cruiseCtrlAcv) { // Check if Brake is released AND Throttle is pressed AND no Cruise Control + if (input1[inIdx].cmd < 20 && abs(input2[inIdx].cmd) > 50 && !cruiseCtrlAcv) { // Check if Brake is released AND Throttle is pressed AND no Cruise Control rtP_Left.b_cruiseCtrlEna = 0; rtP_Right.b_cruiseCtrlEna = 0; standstillAcv = 0;