aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/buttons.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-09-04 19:33:04 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-09-04 19:33:04 -0400
commit166ce06aea0cf5c51e95ed1994cceb33f76d1454 (patch)
tree5bc45377634f019f68e5896dc6ddf27523dc52a4 /klippy/extras/buttons.py
parent5cce7f4d55b3522e780df0d40be3a16862b88d75 (diff)
downloadkutter-166ce06aea0cf5c51e95ed1994cceb33f76d1454.tar.gz
kutter-166ce06aea0cf5c51e95ed1994cceb33f76d1454.tar.xz
kutter-166ce06aea0cf5c51e95ed1994cceb33f76d1454.zip
buttons: Improve python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/buttons.py')
-rw-r--r--klippy/extras/buttons.py6
1 files 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