From 1058892564a7c6231c95cbbb82fec935877aefa9 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 26 Sep 2020 11:27:39 +0200 Subject: [PATCH] fix float errors in _lcd_update() --- octoprint_hd44780/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/octoprint_hd44780/__init__.py b/octoprint_hd44780/__init__.py index 1a02b0a..0b7b9a6 100644 --- a/octoprint_hd44780/__init__.py +++ b/octoprint_hd44780/__init__.py @@ -113,6 +113,8 @@ class LCD_HD44780(octoprint.plugin.StartupPlugin, if self._lcd_updating: return + bytes_per_send_cycle = int(self.cols*(self.rows/2)) + self._lcd_updating = True line1 = self._line1.ljust(self.cols, ' ') @@ -122,12 +124,12 @@ class LCD_HD44780(octoprint.plugin.StartupPlugin, message = line1 + line3 self._lcd_send_byte(self._lcd_line1, self._lcd_cmd) - for i in range(self.cols*self.rows/2): + for i in range(bytes_per_send_cycle): self._lcd_send_byte(ord(message[i]), self._lcd_chr) message = line2 + line4 self._lcd_send_byte(self._lcd_line2, self._lcd_cmd) - for i in range(self.cols*self.rows/2): + for i in range(bytes_per_send_cycle): self._lcd_send_byte(ord(message[i]), self._lcd_chr) self._lcd_updating = False