DRY
This commit is contained in:
parent
bdc9720ca6
commit
f6f94fc078
|
@ -69,36 +69,25 @@ void loop() {
|
|||
screen = screen < 3? screen + 1 : 0;
|
||||
}
|
||||
|
||||
if (increaseValue == 0 && increaseButtonLast == 1) {
|
||||
if ((decreaseValue == 0 && decreaseButtonLast == 1) || increaseValue == 0 && increaseButtonLast == 1) {
|
||||
switch (screen) {
|
||||
case 0:
|
||||
mode = 1;
|
||||
mode = !mode;
|
||||
break;
|
||||
case 1:
|
||||
if (decreaseValue == 0 && decreaseButtonLast == 1)
|
||||
address = address > 0? address - 1 : 127;
|
||||
else
|
||||
address = address < 127? address + 1 : 0;
|
||||
break;
|
||||
case 2:
|
||||
if (decreaseValue == 0 && decreaseButtonLast == 1)
|
||||
key --;
|
||||
else
|
||||
key ++;
|
||||
break;
|
||||
case 3:
|
||||
encryption = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (decreaseValue == 0 && decreaseButtonLast == 1) {
|
||||
switch (screen) {
|
||||
case 0:
|
||||
mode = 0;
|
||||
break;
|
||||
case 1:
|
||||
address = address > 0? address - 1 : 127;
|
||||
break;
|
||||
case 2:
|
||||
key --;
|
||||
break;
|
||||
case 3:
|
||||
encryption = 0;
|
||||
encryption = !encryption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue