Skip to content

Commit b4a85a2

Browse files
committed
Code cleanup and memory optimization
1 parent e074933 commit b4a85a2

File tree

4 files changed

+153
-240
lines changed

4 files changed

+153
-240
lines changed

Joystick/examples/JoystickTest/JoystickTest.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "Joystick.h"
1414

15+
// Create Joystick
1516
Joystick_ Joystick;
1617

1718
// Set to true to test "Auto Send" mode or false to test "Manual Send" mode.
@@ -168,6 +169,7 @@ void testXYZAxisRotation(unsigned int degree)
168169

169170
void setup() {
170171

172+
// Set Range Values
171173
Joystick.setXAxisRange(-127, 127);
172174
Joystick.setYAxisRange(-127, 127);
173175
Joystick.setZAxisRange(-127, 127);
@@ -255,4 +257,3 @@ void loop() {
255257
}
256258
}
257259
}
258-

Joystick/examples/MultipleJoystickTest/MultipleJoystickTest.ino

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// to create multiple Joystick objects on a single Arduino
33
// Leonardo or Arduino Micro.
44
//
5+
// Each joystick has a unique configuration.
6+
//
57
// Matthew Heironimus
68
// 2016-05-13
79
//------------------------------------------------------------
@@ -10,10 +12,10 @@
1012
#define JOYSTICK_COUNT 4
1113

1214
Joystick_ Joystick[JOYSTICK_COUNT] = {
13-
Joystick_(0x03, 4, true, true, false, false, false, false),
14-
Joystick_(0x04, 8, true, true, true, true, false, false),
15-
Joystick_(0x05, 16, false, true, false, true, false, false),
16-
Joystick_(0x06, 32)
15+
Joystick_(0x03, 4, 2, true, true, false, false, false, false, false, false, false, false, false),
16+
Joystick_(0x04, 8, 1, true, true, true, true, false, false, false, false, false, false, false),
17+
Joystick_(0x05, 16, 0, false, true, false, true, false, false, true, true, false, false, false),
18+
Joystick_(0x06, 32, 1, true, true, false, true, true, false, false, false, true, true, true)
1719
};
1820

1921
// Set to true to test "Auto Send" mode or false to test "Manual Send" mode.
@@ -98,13 +100,6 @@ void testXYAxis(int joystickId, unsigned int currentStep)
98100

99101
void setup() {
100102

101-
/* Uncomment this out for debugging...
102-
Serial.begin(9600);
103-
while (!Serial) {
104-
; // wait for serial port to connect. Needed for native USB
105-
}
106-
*/
107-
108103
for (int index = 0; index < JOYSTICK_COUNT; index++)
109104
{
110105
Joystick[index].setXAxisRange(-127, 127);

0 commit comments

Comments
 (0)