Skip to content

Commit dfe1f6f

Browse files
author
Jason Duncan
committed
Added an option to invert the brake axis.
1 parent 06f899a commit dfe1f6f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

G27_Pedals_and_Shifter.ino

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
// red for brake, green for gas, blue for clutch
2222
//#define PEDAL_COLORS true
2323

24+
// for load-cell users and Australians
25+
//#define INVERT_BRAKE true
26+
2427
// use static thresholds rather than on-the-fly calibration
25-
#define STATIC_THRESHOLDS true
28+
//#define STATIC_THRESHOLDS true
2629

2730
// LED PINS
2831
#define RED_PIN 3
@@ -395,6 +398,11 @@ void loop() {
395398
processPedal(brakePedal);
396399
processPedal(clutchPedal);
397400

401+
#if defined(INVERT_BRAKE)
402+
Pedal* brake = (Pedal*)brakePedal;
403+
brake->axis = map(brake->axis, 0, MAX_AXIS, MAX_AXIS, 0);
404+
#endif
405+
398406
#if defined(DEBUG_PEDALS)
399407
describePedal("GAS", "X", gasPedal);
400408
describePedal("BRAKE", "Y", brakePedal);

0 commit comments

Comments
 (0)