From fb6f53252e9a55b3318d263a22f139877abff4be Mon Sep 17 00:00:00 2001 From: Julius Riegel Date: Sat, 13 Jan 2018 18:44:11 +0100 Subject: [PATCH] Change controllib Buttons instead of i in list --- .idea/workspace.xml | 20 +++++++++++++------- lib/controllib.py | 20 ++++++++++---------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c0c25ee..3d80ddc 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,6 @@ - - + + + self.pressed.remove(i) + + + self.pressed.remove(button) + + @@ -123,9 +129,9 @@ @@ -535,8 +541,8 @@ - - + + diff --git a/lib/controllib.py b/lib/controllib.py index 7268a88..e994ec6 100644 --- a/lib/controllib.py +++ b/lib/controllib.py @@ -40,9 +40,9 @@ class Joystick(): if i == c['LIGHT'] and button == 1 and button not in self.pressed: self.light.switch() - self.pressed.append(i) + self.pressed.append(button) elif i == c['LIGHT'] and button == 0 and button in self.pressed: - self.pressed.remove(i) + self.pressed.remove(button) elif i == c['MUSIC'] and button == 1 and button not in self.pressed: if self.splaying: @@ -51,27 +51,27 @@ class Joystick(): else: self.sound.play() self.splaying = True - self.pressed.append(i) + self.pressed.append(button) elif i == c['MUSIC'] and button == 0 and button in self.pressed: - self.pressed.remove(i) + self.pressed.remove(button) elif i == c['VOLIN'] and button == 1 and button not in self.pressed: self.sound.set_volume(self.sound.get_volume() + 0.1) - self.pressed.append(i) + self.pressed.append(button) elif i == c['VOLIN'] and button == 0 and button in self.pressed: self.sound.set_volume(self.sound.get_volume() - 0.1) - self.pressed.remove(i) + self.pressed.remove(button) elif i == c['VOLDE'] and button == 1 and button not in self.pressed: - self.pressed.append(i) + self.pressed.append(button) elif i == c['VOLDE'] and button == 0 and button in self.pressed: - self.pressed.remove(i) + self.pressed.remove(button) elif i == c['REC'] and button == 1 and button not in self.pressed: self._save_camimg() - self.pressed.append(i) + self.pressed.append(button) elif i == c['REC'] and button == 0 and button in self.pressed: - self.pressed.remove(i) + self.pressed.remove(button) # hats for i in range(self.joystick.get_numhats()):