Browse Source

projects/riscv_usb: Fixup command prompt

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Sylvain Munaut 5 years ago
parent
commit
9e815d5bb4
1 changed files with 7 additions and 4 deletions
  1. 7 4
      projects/riscv_usb/fw/firmware.c

+ 7 - 4
projects/riscv_usb/fw/firmware.c

@@ -32,16 +32,21 @@
 void main()
 {
 	bool usb_active = false;
+	int cmd = 0;
 
 	/* Init console IO */
 	console_init();
 	puts("Booting..\n");
-	puts("Command> ");
 
+	/* Main loop */
 	while (1)
 	{
+		/* Prompt ? */
+		if (cmd >= 0)
+			puts("\nCommand> ");
+
 		/* Poll for command */
-		int cmd = getchar_nowait();
+		cmd = getchar_nowait();
 
 		if (cmd >= 0) {
 			if (cmd > 32 && cmd < 127)
@@ -59,8 +64,6 @@ void main()
 			default:
 				break;
 			}
-
-			puts("\nCommand> ");
 		}
 
 		/* USB poll */