diff --git a/XRPLib/gamepad.py b/XRPLib/gamepad.py index f3f08de..6422836 100644 --- a/XRPLib/gamepad.py +++ b/XRPLib/gamepad.py @@ -88,6 +88,18 @@ def start(self): Signals the remote computer to begin sending gamepad data packets. Subscribes to all gamepad variables at a high rate (50 Hz). """ + + # Initialize all the variables to start with. + + for idx in [self.X1, self.Y1, self.X2, self.Y2]: + var_name = self._VAR_NAMES[idx] + self._puppet.set_variable(var_name, 0.0) + + # Buttons are integers (1 or 0) + for idx in range(4, 18): + var_name = self._VAR_NAMES[idx] + self._puppet.set_variable(var_name, 0) + self._puppet.start() self._puppet.send_program_start() diff --git a/XRPLib/resetbot.py b/XRPLib/resetbot.py index 727c9ff..d3f1b2d 100644 --- a/XRPLib/resetbot.py +++ b/XRPLib/resetbot.py @@ -29,9 +29,9 @@ def reset_led(): pass def reset_buzzer(): - from XRPLib.buzzer import Buzzer - # Turn off the buzzer + # Turn off the buzzer, buzzer code is only loaded with the Nano board, so we need to put it in the try/except block try: + from XRPLib.buzzer import Buzzer # Turn off the Buzzer if the board has one Buzzer.get_default_buzzer().reset_buzzer() except: