diff --git a/lib/ev3/protocol/definitions.py b/lib/ev3/protocol/definitions.py index 7a8bce2ed111c2ac470c992d837154b9334b712a..c171982d58442472032fd4216dc0b123339f0165 100644 --- a/lib/ev3/protocol/definitions.py +++ b/lib/ev3/protocol/definitions.py @@ -6,7 +6,7 @@ from micropython import const HANDSHAKE_BAUDRATE = const(2400) MSG_BUFFER_SIZE = const(35) -MESSAGE_POLL_PERIOD_MS = const(10) +MESSAGE_POLL_PERIOD_MS = const(1) HEARTBEAT_PERIOD_MS = const(100) MAX_HEARTBEATS_WITHOUT_DATA = const(6) MAX_HEARTBEATS_WITHOUT_DATA_LAX = const(100) diff --git a/lib/ev3/protocol/uart_sensor.py b/lib/ev3/protocol/uart_sensor.py index cfc66120a05b97ff97aa334f2112522c1b0b03d4..689d8427a4bcdadc69f9d0ae441751e88cd07cae 100644 --- a/lib/ev3/protocol/uart_sensor.py +++ b/lib/ev3/protocol/uart_sensor.py @@ -81,11 +81,10 @@ class UartSensor: msg = self._reassembler.try_receive() while msg is not None: # skip data messages if there are more buffered ones - if not (self.handshake_finished and self._link.available_bytes() > self.data_msg_len): - if not self.handshake_finished: - self._on_handshake_message(msg) - else: - self._on_data_message(msg) + if not self.handshake_finished: + self._on_handshake_message(msg) + else: + self._on_data_message(msg) msg = self._reassembler.try_receive() if self._heartbeat.update() == SENSOR_DEAD: