diff -r c7b712056146 -r c6806d24468b src/eric7/MicroPython/MicroPythonSerialPort.py --- a/src/eric7/MicroPython/MicroPythonSerialPort.py Sat Feb 18 09:21:42 2023 +0100 +++ b/src/eric7/MicroPython/MicroPythonSerialPort.py Sat Feb 18 10:11:44 2023 +0100 @@ -92,21 +92,27 @@ """ return self.__timedOut - def readUntil(self, expected=b"\n", size=None): + def readUntil(self, expected=b"\n", size=None, timeout=0): r""" Public method to read data until an expected sequence is found (default: \n) or a specific size is exceeded. @param expected expected bytes sequence @type bytes - @param size maximum data to be read - @type int + @param size maximum data to be read (defaults to None) + @type int (optional) + @param timeout timeout in milliseconds (0 for configured default) + (defaults to 0) + @type int (optional) @return bytes read from the device including the expected sequence @rtype bytes """ data = bytearray() self.__timedOut = False + if timeout == 0: + timeout = self.__timeout + t = QTime.currentTime() while True: QCoreApplication.processEvents( @@ -119,7 +125,7 @@ break if size is not None and len(data) >= size: break - if t.msecsTo(QTime.currentTime()) > self.__timeout: + if t.msecsTo(QTime.currentTime()) > timeout: self.__timedOut = True break