refactoring and little fix rapid fire tabie
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
#include <MsTimer2.h>
|
#include <MsTimer2.h>
|
||||||
#include <SwitchControlLibrary.h>
|
#include <SwitchControlLibrary.h>
|
||||||
|
|
||||||
#define tableSize 40
|
#define RapidFireTableSize 40
|
||||||
|
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
int table[tableSize];
|
int rapidFireTable[RapidFireTableSize];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
int val = 1;
|
int val = 1;
|
||||||
@@ -30,14 +30,14 @@ struct ButtonInfo buttonInfoTable[ButtonInfoTableSize];
|
|||||||
|
|
||||||
void perms() {
|
void perms() {
|
||||||
if(val == 0){
|
if(val == 0){
|
||||||
if (table[index] == 1){
|
if (rapidFireTable[index] == 1){
|
||||||
SwitchControlLibrary().PressButtonA();
|
SwitchControlLibrary().PressButtonA();
|
||||||
}
|
}
|
||||||
if (table[index] == 2){
|
if (rapidFireTable[index] == 2){
|
||||||
SwitchControlLibrary().ReleaseButtonA();
|
SwitchControlLibrary().ReleaseButtonA();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
index = (index + 1) % 40;
|
index = (index + 1) % RapidFireTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ void setupButton(ButtonInfo *but, int pinNumber, Button buttonSymbol) {
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
table[0] = 1;
|
rapidFireTable[0] = 1;
|
||||||
table[tableSize/2] = 2;
|
rapidFireTable[RapidFireTableSize/2] = 2;
|
||||||
SwitchControlLibrary();
|
SwitchControlLibrary();
|
||||||
|
|
||||||
MsTimer2::set(1, perms);
|
MsTimer2::set(1, perms);
|
||||||
|
|||||||
Reference in New Issue
Block a user