printf("----------------------------------------------------------------------\n");
printf("init done - press key to start\n");
char c = getchar();
- getchar(); // remove line feed from stdin
+ if (c != '\n') {
+ getchar(); // remove line feed from stdin
+ }
printf("----------------------------------------------------------------------\n");
switch (c) {
}
if (!onlyOnChange || nextLedL != ledL) {
ledL = nextLedL;
- snprintf(s, size, "LED L = %c", ledL ? 'X' : '.');
+ snprintf(s, size, "LED L = %c", ledL == 1 ? 'X' : '.');
rv = true;
}
break;
if (!onlyOnChange || change) {
int n = snprintf(s, size, "LED PA[3210] =");
for (int i = 3; i >= 0; i--) {
- n += snprintf(s + n, size - n, " %c", led[i] ? 'X' : '.');
+ n += snprintf(s + n, size - n, " %c", led[i] == 1 ? 'X' : '.');
}
rv = true;
}
}
if (!onlyOnChange || nextLed != led) {
led = nextLed;
- snprintf(s, size, "LED1 (PB0) = %c", led ? 'X' : '.');
+ snprintf(s, size, "LED1 (PB0) = %c", led == 1 ? 'X' : '.');
rv = true;
}
break;