Skip to content

Commit 047290f

Browse files
author
Jason Duncan
committed
Adjusted shifter axes a bit. Added some preprocessor directives to allow disabling of either pedals or shifter.
1 parent dfe1f6f commit 047290f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

G27_Pedals_and_Shifter.ino

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include <HID.h>
88
#include "./lib/G27PedalsShifter.h"
99

10+
// comment either out to disable
11+
#define USE_PEDALS
12+
#define USE_SHIFTER
13+
1014
// for debugging, gives serial output rather than working as a joystick
1115
//#define DEBUG true
1216

@@ -94,10 +98,10 @@
9498
#define OUTPUT_RED_RIGHT 18
9599

96100
// SHIFTER AXIS THRESHOLDS
97-
#define SHIFTER_XAXIS_12 295 //Gears 1,2
101+
#define SHIFTER_XAXIS_12 290 //Gears 1,2
98102
#define SHIFTER_XAXIS_56 600 //Gears 5,6, R
99103
#define SHIFTER_YAXIS_135 750 //Gears 1,3,5
100-
#define SHIFTER_YAXIS_246 200 //Gears 2,4,6, R
104+
#define SHIFTER_YAXIS_246 290 //Gears 2,4,6, R
101105

102106
// PEDAL AXIS THRESHOLDS
103107
#define MIN_GAS 27
@@ -407,7 +411,7 @@ void loop() {
407411
describePedal("GAS", "X", gasPedal);
408412
describePedal("BRAKE", "Y", brakePedal);
409413
describePedal("CLUTCH", "Z", clutchPedal);
410-
#else
414+
#elif defined(USE_PEDALS)
411415
setXAxis(gasPedal);
412416
setYAxis(brakePedal);
413417
setZAxis(clutchPedal);
@@ -426,8 +430,11 @@ void loop() {
426430

427431
#if defined(DEBUG_SHIFTER)
428432
describeButtonStates(buttonStates, shifterPosition, gear);
429-
#else
433+
#elif defined(USE_SHIFTER)
430434
setButtonStates(buttonStates, gear);
435+
#endif
436+
437+
#if !defined(DEBUG_SHIFTER) || !defined(DEBUG_PEDALS)
431438
G27.sendState();
432439
#endif
433440

0 commit comments

Comments
 (0)