fix: Reversed digitalRead to activate button press on DOWN

master
phga 2 years ago
parent 224a10fd88
commit bf6d7b9635
Signed by: phga
GPG Key ID: 5249548AA705F019

@ -43,7 +43,7 @@ void startupAnimation();
void resetPlayer();
void setup() {
// Serial.begin(9600);
Serial.begin(9600);
// init pins
for (int i = 3; i <= LMAX; ++i) {
@ -94,10 +94,10 @@ void loop() {
// Setzt Status des Playerbuttons
void anticheat(int l) {
if (digitalRead(p1.id) && l != LMAX) {
if (digitalRead(p1.id) == 0 && l != LMAX) {
p1.pressed = 1;
}
if (digitalRead(p2.id) && l != LMIN) {
if (digitalRead(p2.id) == 0 && l != LMIN) {
p2.pressed = 1;
}
}
@ -149,6 +149,11 @@ void ledActive(int l, dir d) {
// ret 1 wenn in zeit gedrückt, 0 sonst
int pressLoop(player *p) {
// Falls gecheated wurde, aussetzen
Serial.print("\nPressed: (");
Serial.print(p->id);
Serial.print(", ");
Serial.print(p->pressed);
Serial.print(")");
if (p->pressed) {
delay(speed);
return 0;
@ -156,7 +161,7 @@ int pressLoop(player *p) {
// Abfrageloop
for (int i = 0; i < speed; ++i) {
if (digitalRead(p->id)) {
if (digitalRead(p->id) == 0) {
return 1;
}
delay(1);

Loading…
Cancel
Save