From 5857a35724818f7addb0552164888f5848294100 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 15 Mar 2024 16:54:26 +0100 Subject: [PATCH] Floating point speed. --- uc8151.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uc8151.py b/uc8151.py index dd23613..b24c15b 100644 --- a/uc8151.py +++ b/uc8151.py @@ -413,8 +413,8 @@ class UC8151: hperiod = period//2 # Num. of frames for back-and-forth change. # Actual period is scaled by the speed factor - period = max(period >> (self.speed-1), 1) - hperiod = max(hperiod >> (self.speed-1), 1) + period = int(max(period / (2**(self.speed-1)), 1)) + hperiod = int(max(hperiod / (2**(self.speed-1)), 1)) # Setup three (or two) steps. # For all the steps, VCOM is just taken at VCOM_DC,