From 1ba01f7d4ef7877a73e3d50e4abf431bce057848 Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Sat, 13 Nov 2021 05:54:46 +0000 Subject: [PATCH] Update for 0.1 version of panel - half the buttons don't work yet. --- sc-panel/Makefile | 4 ++-- sc-panel/sc-panel.ino | 30 +++++++++++------------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/sc-panel/Makefile b/sc-panel/Makefile index a0ab417..46b5b63 100644 --- a/sc-panel/Makefile +++ b/sc-panel/Makefile @@ -1,5 +1,5 @@ -TARGET_BOARD=arduino:avr:nano -COM_PORT=/dev/ttyACM0 +TARGET_BOARD=arduino:avr:nano:cpu=atmega328old +COM_PORT=/dev/ttyUSB0 build: arduino-cli compile -b ${TARGET_BOARD} diff --git a/sc-panel/sc-panel.ino b/sc-panel/sc-panel.ino index a6409dd..3c5e229 100644 --- a/sc-panel/sc-panel.ino +++ b/sc-panel/sc-panel.ino @@ -1,13 +1,8 @@ #include -#include -using namespace admux; - -Joystick joystick; +Joystick joystick(false); void setup() { - Mux* mux = new Mux(Pin(A4, INPUT_PULLUP, PinType::Digital), Pinset(A5, A6, A7)); - // Power switches joystick.AddButton(2, BUTTON_PULSED_DOUBLE_ACTION_SPLIT); joystick.AddButton(3, BUTTON_PULSED_DOUBLE_ACTION_SPLIT); @@ -20,29 +15,26 @@ void setup() { joystick.AddButton(8, BUTTON_PASSTHRU); // Encoders - joystick.AddEncoder(9, 10, ENCODER_PULSED_SPLIT); - joystick.AddEncoder(11, 12, ENCODER_PULSED_SPLIT); + // FIXME: these seem to be wired wrong. + // joystick.AddEncoder(10, 11, ENCODER_PULSED_SPLIT); + // joystick.AddEncoder(12, 13, ENCODER_PULSED_SPLIT); // Mining Modules - joystick.AddButton(13, BUTTON_PASSTHRU); + joystick.AddButton(9, BUTTON_PASSTHRU); joystick.AddButton(A0, BUTTON_PASSTHRU); joystick.AddButton(A1, BUTTON_PASSTHRU); - // Doors & Lights + // Flight Modes joystick.AddButton(A2, BUTTON_PASSTHRU); joystick.AddButton(A3, BUTTON_PASSTHRU); - joystick.AddButton(0, BUTTON_PASSTHRU, true, mux); + joystick.AddButton(A4, BUTTON_PASSTHRU); + joystick.AddButton(A5, BUTTON_PASSTHRU); - // Flight Modes - joystick.AddButton(1, BUTTON_PASSTHRU, true, mux); - joystick.AddButton(2, BUTTON_PASSTHRU, true, mux); - joystick.AddButton(3, BUTTON_PASSTHRU, true, mux); - joystick.AddButton(4, BUTTON_PASSTHRU, true, mux); + // Doors & Lights + // TODO: Need multiplexer setup // Emergency Panel - joystick.AddButton(5, BUTTON_PASSTHRU, true, mux); - joystick.AddButton(6, BUTTON_PASSTHRU, true, mux); - joystick.AddButton(7, BUTTON_PASSTHRU, true, mux); + // TODO: Need multiplexer setup joystick.Init(); }