keep pressing state for rapid fire button
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
int loopCount = 0;
|
||||
int state = 0;
|
||||
int rapidFireTable[RapidFireTableSize];
|
||||
bool rapidPressState = 0;
|
||||
int index = 0;
|
||||
|
||||
int val = 1;
|
||||
@@ -40,9 +41,11 @@ void perms() {
|
||||
if(val == 0){
|
||||
if (rapidFireTable[index] == 1){
|
||||
SwitchControlLibrary().PressButtonA();
|
||||
rapidPressState = true;
|
||||
}
|
||||
if (rapidFireTable[index] == 2){
|
||||
SwitchControlLibrary().ReleaseButtonA();
|
||||
rapidPressState = false;
|
||||
}
|
||||
}
|
||||
index = (index + 1) % RapidFireTableSize;
|
||||
@@ -121,10 +124,13 @@ void loop()
|
||||
val = digitalRead(2);
|
||||
if(prevVal == 1 && val == 0){
|
||||
SwitchControlLibrary().PressButtonA();
|
||||
rapidPressState = true;
|
||||
index = 1;
|
||||
}
|
||||
else if(prevVal == 0 && val == 1){
|
||||
SwitchControlLibrary().ReleaseButtonA();
|
||||
if(rapidPressState){
|
||||
SwitchControlLibrary().ReleaseButtonA();
|
||||
}
|
||||
}
|
||||
prevVal = val;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user