mirror of
https://github.com/EFeru/hoverboard-firmware-hack-FOC.git
synced 2025-08-03 17:44:27 +02:00
Fix #247
This commit is contained in:
@@ -643,8 +643,8 @@ void updateCurSpdLim(void) {
|
|||||||
void standstillHold(void) {
|
void standstillHold(void) {
|
||||||
#if defined(STANDSTILL_HOLD_ENABLE) && (CTRL_TYP_SEL == FOC_CTRL) && (CTRL_MOD_REQ != SPD_MODE)
|
#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 (!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
|
if ((input1[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
|
|| (abs(input2[inIdx].cmd) < 20 && speedAvgAbs < 5)) { // OR Throttle is small AND measured speed is very small
|
||||||
rtP_Left.n_cruiseMotTgt = 0;
|
rtP_Left.n_cruiseMotTgt = 0;
|
||||||
rtP_Right.n_cruiseMotTgt = 0;
|
rtP_Right.n_cruiseMotTgt = 0;
|
||||||
rtP_Left.b_cruiseCtrlEna = 1;
|
rtP_Left.b_cruiseCtrlEna = 1;
|
||||||
@@ -653,7 +653,7 @@ void standstillHold(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // If Stanstill is Active -> try Deactivation
|
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_Left.b_cruiseCtrlEna = 0;
|
||||||
rtP_Right.b_cruiseCtrlEna = 0;
|
rtP_Right.b_cruiseCtrlEna = 0;
|
||||||
standstillAcv = 0;
|
standstillAcv = 0;
|
||||||
|
Reference in New Issue
Block a user