From 6c74a02c184e67fda5a8a958a7dde6d746413b53 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 19 Nov 2024 13:11:02 -0800 Subject: [PATCH] Add serial port baudrate setter Allow serial port code to set the baud rate as well as query. Avoid re-setting the baud rate to the current value as QtSerial seems to do two baud rate settings, first to 4Mbaud and then to the target rate in this case. Signed-off-by: Keith Packard --- mu/modes/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mu/modes/base.py b/mu/modes/base.py index 99b76f0c8..a642c23f2 100644 --- a/mu/modes/base.py +++ b/mu/modes/base.py @@ -106,6 +106,13 @@ def baudrate(self): else: return None + @baudrate.setter + def baudrate(self, value): + if value != self._baudrate: + self._baudrate = value + if self.serial: + self.serial.setBaudRate(value) + def open(self): """ Open the serial link