Skip to content

Commit da971a0

Browse files
surfdadolukash
authored andcommitted
Reverse stop: Shorter distance and tighter target angle
The changes make reverse stop closer to how it behaved in v1.2 and earlier. Fix: Make reverse stop more beginner friendly again
1 parent cec5711 commit da971a0

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎src/reverse_stop.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717

1818
#include "reverse_stop.h"
1919

20-
#include "lib/transitions.h"
2120
#include "lib/utils.h"
2221
#include <math.h>
2322

24-
#define REVERSE_STOP_DISTANCE 0.25f
25-
#define TARGET_STOP_ANGLE 17.0f
23+
#define REVERSE_STOP_DISTANCE 0.18f
24+
#define TARGET_STOP_ANGLE 13.0f
2625
#define DISTANCE_PER_DEGREE (REVERSE_STOP_DISTANCE / TARGET_STOP_ANGLE)
2726
#define TIMER_ANGLE_THRESHOLD (TARGET_STOP_ANGLE / 2)
2827

@@ -46,13 +45,13 @@ void reverse_stop_reset(ReverseStop *rs, float distance) {
4645
}
4746

4847
void reverse_stop_configure(ReverseStop *rs, float frequency) {
49-
ema_configure(&rs->progress, 1.0f, frequency);
48+
ema_configure(&rs->progress, 3.0f, frequency);
5049
}
5150

5251
void reverse_stop_update(
5352
ReverseStop *rs, float distance, float erpm, float setpoint, const Time *time, bool enabled
5453
) {
55-
if ((!enabled || erpm > -200) && rs->progress.value >= 1.0f) {
54+
if ((!enabled || erpm > -150) && rs->progress.value >= 1.0f) {
5655
rs->start_distance = distance;
5756
return;
5857
}
@@ -107,7 +106,7 @@ void reverse_stop_update(
107106
}
108107

109108
float reverse_stop_setpoint(ReverseStop *rs) {
110-
float prog = smoothstep(rs->progress.value);
109+
float prog = clampf(rs->progress.value, 0.0f, 1.0f);
111110
return rs->start_setpoint + prog * (rs->target_setpoint - rs->start_setpoint);
112111
}
113112

0 commit comments

Comments
 (0)