From 166ce06aea0cf5c51e95ed1994cceb33f76d1454 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 4 Sep 2020 19:33:04 -0400 Subject: [PATCH] buttons: Improve python3 compatibility Signed-off-by: Kevin O'Connor --- klippy/extras/buttons.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/klippy/extras/buttons.py b/klippy/extras/buttons.py index 3e61b981..4a23b60d 100644 --- a/klippy/extras/buttons.py +++ b/klippy/extras/buttons.py @@ -62,7 +62,7 @@ class MCU_buttons: ack_diff -= 0x100 msg_ack_count = ack_count - ack_diff # Determine new buttons - buttons = params['state'] + buttons = bytearray(params['state']) new_count = msg_ack_count + len(buttons) - self.ack_count if new_count <= 0: return @@ -71,9 +71,9 @@ class MCU_buttons: self.ack_cmd.send([self.oid, new_count]) self.ack_count += new_count # Call self.handle_button() with this event in main thread - for b in new_buttons: + for nb in new_buttons: self.reactor.register_async_callback( - (lambda e, s=self, b=ord(b): s.handle_button(e, b))) + (lambda e, s=self, b=nb: s.handle_button(e, b))) def handle_button(self, eventtime, button): button ^= self.invert changed = button ^ self.last_button