Compare commits

..

1 Commits

Author SHA1 Message Date
7539e3658a disable rapid fire 2020-09-15 18:29:48 +09:00
5 changed files with 6 additions and 460 deletions

View File

@@ -6,7 +6,6 @@
int loopCount = 0;
int state = 0;
int rapidFireTable[RapidFireTableSize];
bool rapidPressState = 0;
int index = 0;
int val = 1;
@@ -36,17 +35,14 @@ struct arrow newestArrow;
#define ButtonInfoTableSize 9
struct ButtonInfo buttonInfoTable[ButtonInfoTableSize];
Hat last = Hat::CENTER;
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;
@@ -67,8 +63,8 @@ void setup()
rapidFireTable[RapidFireTableSize/2] = 2;
SwitchControlLibrary();
MsTimer2::set(1, perms);
MsTimer2::start();
//MsTimer2::set(1, perms);
//MsTimer2::start();
setupButton(&(buttonInfoTable[0]), 3, Button::B);
setupButton(&(buttonInfoTable[1]), 4, Button::X);
@@ -104,6 +100,7 @@ void setup()
oldestArrow.arrowSymbol = Hat::CENTER;
newestArrow.older = &oldestArrow;
newestArrow.newer = NULL;
}
void handleButtonInput(ButtonInfo *but){
@@ -124,13 +121,10 @@ void loop()
val = digitalRead(2);
if(prevVal == 1 && val == 0){
SwitchControlLibrary().PressButtonA();
rapidPressState = true;
index = 1;
}
else if(prevVal == 0 && val == 1){
if(rapidPressState){
SwitchControlLibrary().ReleaseButtonA();
}
SwitchControlLibrary().ReleaseButtonA();
}
prevVal = val;
@@ -158,10 +152,8 @@ void loop()
arrowTable[i].prev = arrowTable[i].current;
}
if(newestArrow.older->arrowSymbol != last){
last = newestArrow.older->arrowSymbol;
SwitchControlLibrary().MoveHat(static_cast<uint8_t>(newestArrow.older->arrowSymbol));
}
SwitchControlLibrary().MoveHat(static_cast<uint8_t>(newestArrow.older->arrowSymbol));
}

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB