File tree Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ void NetSIO::begin(int baud)
7272 end ();
7373 }
7474
75+ discard_timeout_ms = 0 ;
76+
7577 _baud = baud;
7678 _resume_time = 0 ;
7779
@@ -551,22 +553,24 @@ bool NetSIO::wait_for_credit(int needed)
551553 return true ;
552554}
553555
556+ #ifdef OBSOLETE
554557/* Discards anything in the input buffer
555558*/
556559void NetSIO::flush_input ()
557560{
558561 if (_initialized)
559562 _fifo.clear ();
560563}
564+ #endif /* OBSOLETE */
561565
562566/* Clears input buffer and flushes out transmit buffer waiting at most
563567 waiting MAX_FLUSH_WAIT_TICKS until all sends are completed
564568*/
565- void NetSIO::flush ()
569+ void NetSIO::flushOutput ()
566570{
567571 if (_initialized)
568572 {
569- flush_input ();
573+ discardInput ();
570574 wait_sock_writable (500 );
571575 }
572576}
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ class NetSIO : public IOChannel
7474 void end ();
7575 bool poll (int ms);
7676
77- void flushOutput () override { flush (); }
77+ void flushOutput () override ;
7878
7979 void set_baudrate (uint32_t baud);
8080 uint32_t get_baudrate ();
@@ -89,8 +89,10 @@ class NetSIO : public IOChannel
8989#ifdef OBSOLETE
9090 int available ();
9191#endif /* OBSOLETE */
92+ #ifdef OBSOLETE
9293 void flush ();
9394 void flush_input ();
95+ #endif /* OBSOLETE */
9496
9597#ifdef OBSOLETE
9698 // read single byte
Original file line number Diff line number Diff line change @@ -462,7 +462,7 @@ void systemBus::service()
462462 SYSTEM_BUS.discardInput ();
463463#else
464464 if (_port.get_sio_mode () == SioCom::sio_mode::SERIAL)
465- _port.flush_input ();
465+ _port.discardInput ();
466466#endif
467467 }
468468
@@ -536,7 +536,7 @@ void systemBus::setup()
536536 // Set the initial HSIO index
537537 setHighSpeedIndex (Config.get_general_hsioindex ());
538538
539- _port.flush_input ();
539+ _port.discardInput ();
540540#endif
541541}
542542
@@ -640,8 +640,8 @@ void systemBus::toggleBaudrate()
640640 // Debug_printf("Toggling baudrate from %d to %d\n", _sioBaud, baudrate);
641641 _sioBaud = baudrate;
642642#ifndef ESP_PLATFORM
643- _port.flush_input ();
644- _port.flush ();
643+ _port.discardInput ();
644+ _port.flushOutput ();
645645 // hmm, calling flush() may not be enough to empty TX buffer
646646 fnSystem.delay_microseconds (2000 );
647647#endif
Original file line number Diff line number Diff line change @@ -345,8 +345,8 @@ class systemBus
345345 size_t write (const void *buffer, size_t length) { return _port.write ((uint8_t *) buffer, length); }
346346 size_t write (int n) { return _port.write (n); }
347347 size_t available () { return _port.available (); }
348- void flush () { _port.flush (); }
349- void discardInput () { _port.flush_input (); }
348+ void flush () { _port.flushOutput (); }
349+ void discardInput () { _port.discardInput (); }
350350 size_t print (int n, int base = 10 ) { return _port.print (n, base); }
351351 size_t print (const char *str) { return _port.print (str); }
352352 size_t print (const std::string &str) { return _port.print (str); }
You can’t perform that action at this time.
0 commit comments