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