File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,15 @@ void update_progress(uint32_t progress, uint32_t total)
120120 printf (" Update progress = %" PRIu8 " %%\n " , percent);
121121}
122122
123+ void flush_stdin_buffer (void )
124+ {
125+ FileHandle *debug_console = mbed::mbed_file_handle (STDIN_FILENO);
126+ while (debug_console->readable ()) {
127+ char buffer[1 ];
128+ debug_console->read (buffer, 1 );
129+ }
130+ }
131+
123132int main (void )
124133{
125134 int status;
@@ -237,6 +246,9 @@ int main(void)
237246 t.start (callback (&queue, &EventQueue::dispatch_forever));
238247 queue.call_every (5000 , value_increment);
239248
249+ // Flush the stdin buffer before reading from it
250+ flush_stdin_buffer ();
251+
240252 while (cloud_client_running) {
241253 int in_char = getchar ();
242254 if (in_char == ' i' ) {
Original file line number Diff line number Diff line change 288288 "storage_filesystem.blockdevice" : " SPIF" ,
289289 "storage_filesystem.external_base_address" : " (0x0)" ,
290290 "storage_filesystem.external_size" : " (1024*1024*1)" ,
291- "platform.default-serial-baud-rate" : 230400 ,
292- "platform.stdio-baud-rate" : 230400 ,
293291 "drivers.uart-serial-rxbuf-size" : 1024 ,
294292 "drivers.uart-serial-txbuf-size" : 1024 ,
295293 "lwip.ipv4-enabled" : true ,
You can’t perform that action at this time.
0 commit comments