From 8a483141423aae768959e07d77351c73647e4fe2 Mon Sep 17 00:00:00 2001 From: SammyIAm Date: Sat, 26 May 2018 21:13:55 -0700 Subject: [PATCH] Squash overflow bug. --- Arduino/Moppy/MoppyConfig.h | 4 ++-- Arduino/Moppy/MoppyCore.cpp | 8 ++++++-- Arduino/Moppy/src/MoppyInstruments/ShiftRegister.cpp | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Arduino/Moppy/MoppyConfig.h b/Arduino/Moppy/MoppyConfig.h index 5f5fbec..3d53e23 100644 --- a/Arduino/Moppy/MoppyConfig.h +++ b/Arduino/Moppy/MoppyConfig.h @@ -16,12 +16,12 @@ // Device address for this Arduino (only messages sent to this address // will be processed. -#define DEVICE_ADDRESS 0x01 +#define DEVICE_ADDRESS 0x02 // Minimum and maximum sub-addresses that messages will be processed for. // E.g. if you have 8 drives this would be 1 and 8. If you have 16, 1 and 16. #define MIN_SUB_ADDRESS 1 -#define MAX_SUB_ADDRESS 8 +#define MAX_SUB_ADDRESS 1 #endif /* SRC_MOPPYCONFIG_H_ */ diff --git a/Arduino/Moppy/MoppyCore.cpp b/Arduino/Moppy/MoppyCore.cpp index 92dca03..fcd05b5 100644 --- a/Arduino/Moppy/MoppyCore.cpp +++ b/Arduino/Moppy/MoppyCore.cpp @@ -9,8 +9,8 @@ */ // Floppy drives directly connected to the Arduino's digital pins -#include "src/MoppyInstruments/FloppyDrives.h" -FloppyDrives instrument = FloppyDrives(); +//#include "src/MoppyInstruments/FloppyDrives.h" +//FloppyDrives instrument = FloppyDrives(); //Uncomment the 2 next lines and comment the 2 lines above this comment to switch to L298N mode @@ -18,6 +18,10 @@ FloppyDrives instrument = FloppyDrives(); //L298N instrument = L298N(); // please see src/MoppyInstruments/L298N.h for pinout and additionnal info +// A single device (e.g. xylophone, drums, etc.) connected to shift registers +#include "src/MoppyInstruments/ShiftRegister.h" +ShiftRegister instrument = ShiftRegister(); + /********** * MoppyNetwork classes receive messages sent by the Controller application, * parse them, and use the data to call the appropriate handler as implemented diff --git a/Arduino/Moppy/src/MoppyInstruments/ShiftRegister.cpp b/Arduino/Moppy/src/MoppyInstruments/ShiftRegister.cpp index c3ea9b7..b77a5cd 100644 --- a/Arduino/Moppy/src/MoppyInstruments/ShiftRegister.cpp +++ b/Arduino/Moppy/src/MoppyInstruments/ShiftRegister.cpp @@ -18,8 +18,8 @@ // First and last supported notes (any notes outside this range will be ignored, first note will be // indexed as zero for shifting #define NUM_NOTES 24 -const uint8_t FIRST_NOTE = 48; -const uint8_t LAST_NOTE = FIRST_NOTE + NUM_NOTES; +const uint8_t FIRST_NOTE = 79; +const uint8_t LAST_NOTE = FIRST_NOTE + (NUM_NOTES-1); #define SHIFT_TIMER_RESOLUTION 1000 //Microsecond resolution for starting and ending notes