cmd-keypad: Run only once when an arg is passed

Signed-off-by: Sean Cross <xobs@kosagi.com>
This commit is contained in:
Sean Cross 2015-06-03 18:40:28 +08:00
parent f8d8454fea
commit 9c9af6ca80

View file

@ -61,6 +61,7 @@ int cmd_keypad(int argc, char **argv)
printf("Press %c on keypad or any key on serial to exit\n", printf("Press %c on keypad or any key on serial to exit\n",
key_vals[ARRAY_SIZE(key_vals) - 2]); key_vals[ARRAY_SIZE(key_vals) - 2]);
while (!end && !serial_available()) { while (!end && !serial_available()) {
int key; int key;
@ -72,6 +73,8 @@ int cmd_keypad(int argc, char **argv)
serial_putc(key_vals[key]); serial_putc(key_vals[key]);
if (key == (ARRAY_SIZE(key_vals) - 2)) if (key == (ARRAY_SIZE(key_vals) - 2))
end = 1; end = 1;
if (argc)
end = 1;
} }
key_state[key] = newstate; key_state[key] = newstate;
} }