diff --git a/controller_teensy/include/definitions.h b/controller_teensy/include/definitions.h index e1fb9e2..2c8bdf6 100644 --- a/controller_teensy/include/definitions.h +++ b/controller_teensy/include/definitions.h @@ -95,7 +95,7 @@ bool error_sdfile_unavailable=false; #define NORMAL_MAX_ACCELERATION_RATE 10000 -#define SLOW_MAX_ACCELERATION_RATE 500 +#define SLOW_MAX_ACCELERATION_RATE 250 int16_t max_acceleration_rate=NORMAL_MAX_ACCELERATION_RATE; //maximum cmd send increase per second diff --git a/controller_teensy/src/main.cpp b/controller_teensy/src/main.cpp index ef9e149..a0384d5 100644 --- a/controller_teensy/src/main.cpp +++ b/controller_teensy/src/main.cpp @@ -520,7 +520,7 @@ void calculateSetSpeed(unsigned long timediff){ } //acceleration - cmd_send += constrain(adjusted_throttle_pos-cmd_send,0,(int16_t)(max_acceleration_rate*(timediff/1000.0)) ); //if throttle higher than last applied value, apply throttle directly + cmd_send += constrain(adjusted_throttle_pos-cmd_send,0,(int16_t)(max_acceleration_rate*(timediff/1000.0)) ); //if throttle higher than last applied value, apply throttle directly with rate limit cmd_send=constrain(cmd_send,0,throttle_max); @@ -603,12 +603,15 @@ void readButtons() { if (control_buttonA) { //button A is held down during start button press throttle_max=1000; reverse_speed=0.25; + max_acceleration_rate=NORMAL_MAX_ACCELERATION_RATE; }else if (control_buttonB) { //button B is held down during start button press throttle_max=750; reverse_speed=0.25; + max_acceleration_rate=SLOW_MAX_ACCELERATION_RATE; }else { //no control button pressed during start throttle_max=250; reverse_speed=0.15; + max_acceleration_rate=SLOW_MAX_ACCELERATION_RATE; } }else{