Optimize master behavior for reset
This commit is contained in:
parent
c2b5331bbd
commit
d3f10ea70b
@ -71,6 +71,7 @@ ISR(PCINT1_vect)
|
||||
lastState = state;
|
||||
}
|
||||
uint8_t inputPattern = 0;
|
||||
uint8_t secretPattern = 0b10101010;
|
||||
void handleEncoderMovement()
|
||||
{
|
||||
long diff = encoderPostion - lastClickPosition;
|
||||
@ -88,7 +89,8 @@ void handleEncoderMovement()
|
||||
selectedIndex = (selectedIndex + 7) % 8;
|
||||
inputPattern = ((inputPattern << 1) | 0) & 0xFF;
|
||||
}
|
||||
resetPuzzles(inputPattern == 0b10101010);
|
||||
bool reset = inputPattern == secretPattern;
|
||||
resetPuzzles(reset);
|
||||
setDrawerLight(selectedIndex);
|
||||
lastClickPosition = encoderPostion;
|
||||
}
|
||||
@ -144,7 +146,11 @@ void resetPuzzles(bool easy)
|
||||
digitalWrite(puzzleResetPins[i], HIGH);
|
||||
puzzlesSolved[i] = false;
|
||||
}
|
||||
delay(30 * (easy * 10)); //delay 30 or 300ms
|
||||
if (easy)
|
||||
delay(20);
|
||||
else
|
||||
delay(400);
|
||||
|
||||
for (size_t i = 0; i < 3; i++)
|
||||
{
|
||||
digitalWrite(puzzleResetPins[i], LOW);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user