From a09124d7fab5deac1c51ae00752099ff5f7111cc Mon Sep 17 00:00:00 2001
From: "Edgar P. BURKHART" <ed.pi.burkhart@gmail.com>
Date: Sat, 30 Jan 2021 15:10:31 +0100
Subject: [PATCH] Bug fixes

---
 controlbox.ino                        |  15 +++++++--------
 data/ArduinoJoystickLibrary-2.0.7.zip | Bin 0 -> 31355 bytes
 2 files changed, 7 insertions(+), 8 deletions(-)
 create mode 100644 data/ArduinoJoystickLibrary-2.0.7.zip

diff --git a/controlbox.ino b/controlbox.ino
index 75c9ab0..393c548 100644
--- a/controlbox.ino
+++ b/controlbox.ino
@@ -5,23 +5,22 @@ Joystick_ Joystick;
 const byte BR[3] = {1,2,3}; // Button array rows
 const byte BC[3] = {4,5,6}; // Button array columns
 const byte BK[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; // Buttons controller keys
-const bool Bstate[3][3] = {{0,0,0},{0,0,0},{0,0,0}}; // Buttons state
+bool Bstate[3][3] = {{0,0,0},{0,0,0},{0,0,0}}; // Buttons state
 
 const byte RE[6][2] = {{7,8},{9,10},{11,12},{13,14},{15,16},{17,18}}; // Rotary encoders pins {A,B}
 const byte REK[6][2] = {{10,11},{12,13},{14,15},{16,17},{18,19},{20,21}}; // Rotary encoders keys {-,+}
-const bool REstate[6][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; // Rotary encoders state
+bool REstate[6][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; // Rotary encoders state
 
 void setup() {
-	for(int i=0; i<6; i++) {
-		pinMode(REl[i], INPUT_PULLUP);
-		pinMode(REr[i], INPUT_PULLUP);
+	for(int i=0; i<12; i++) {
+		pinMode(RE[i/2][i%2], INPUT_PULLUP);
 	}
-	for(int i=0; i<6; i++) {
+	for(int i=0; i<3; i++) {
 		pinMode(BR[i], INPUT);
 		pinMode(BC[i], INPUT_PULLUP);
 	}
 	
-	Joystick.begin()
+	Joystick.begin();
 }
 
 void readMatrix() {
@@ -49,4 +48,4 @@ void readEncoders() {
 
 void loop() {
 	readMatrix();
-}
\ No newline at end of file
+}
diff --git a/data/ArduinoJoystickLibrary-2.0.7.zip b/data/ArduinoJoystickLibrary-2.0.7.zip
new file mode 100644
index 0000000000000000000000000000000000000000..9bbb3c68df8a4da828a415786d263a8171ede6b6
GIT binary patch
