File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,7 @@ int32_t termios_write(linux_serial_t * restrict const this,
381381 }
382382
383383 const int ret = write (this -> linux_specific .ttys , src , src_siz );
384+ tcdrain (this -> linux_specific .ttys );
384385 /***
385386 * todo: seems read flush can cause problems sometimes,
386387 * need to be checked
Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ uint8_t flag_check(uint8_t ch)
389389/**
390390 * Read chip response
391391 * 1. If nothing is received in 100ms, it will return 0
392- * 2. If anything is received and run into flags it will keep trying for 100ms for further response
392+ * 2. If anything is received and run into flags it will keep trying for 320ms for further response
393393 *
394394*/
395395int chip_read (uint8_t * recv )
@@ -412,7 +412,7 @@ int chip_read(uint8_t *recv)
412412 flag = flag_check (* (rx_p + i ));
413413 if (flag > 0 )
414414 {
415- tickdown = 10 ;
415+ tickdown = 32 ;
416416 if ((flag == 5 || flag == 6 ) && content_flag == 1 )
417417 {
418418 * (recv + (size ++ )) = * (rx_p + i );
@@ -427,6 +427,18 @@ int chip_read(uint8_t *recv)
427427 content_flag = 0 ;
428428 }
429429 }
430+ if (flag == 9 )
431+ {
432+ /**
433+ * Read completed so return immediately, otherwise baudrate_set()
434+ * will fail for not being invoked in the short window.
435+ */
436+ break ;
437+ }
438+ }
439+ else
440+ {
441+ DEBUG_PRINTF ("." );
430442 }
431443 usleep (10000 );
432444 } while (tickdown -- && size < BUF_SIZE && flag > 0 );
You can’t perform that action at this time.
0 commit comments