From 8de073049e1899a0c75affde84efcc6b6df505c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= <linuxtardis@gmail.com> Date: Wed, 6 Nov 2024 08:20:29 +0100 Subject: [PATCH] Fix the reconnection sequence of EV3 color sensor after calibration I have missed that the sensor enters the "STATE_CALIBRATE_DONE" state after the calibration. From the reverse-engineered sources it seems to me that in this mode, the sensor will no longer process CMD-SELECT messages. This commit should fix this by cutting off NACKs to the sensor and letting it reboot. --- lib/ev3/color.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ev3/color.py b/lib/ev3/color.py index a1786f3..c0efc24 100644 --- a/lib/ev3/color.py +++ b/lib/ev3/color.py @@ -223,5 +223,8 @@ class ColorSensor(EV3UartSensor): while items[0] == 0: items = self.read_raw_mode(ColorSensor.MODE_COL_CAL) - # switch the sensor back to a mode where it will not time out + # restart the sensor (after the calibration it will be stuck in the COL-CAL mode) + self.start_reset() + + # wait for reconnect self.reflection() -- GitLab