RickP / lego_mario_controller

A small python script that connects to a Lego Mario figurine via BLuetooth LE and emits keystrokes for different actions.
98 stars 19 forks source link

New Firmware changes? #1

Open triple-it opened 3 years ago

triple-it commented 3 years ago

Hi, I could not get it to work on name check. Only with address check. (But that could be my environment related)

          #if d.name.lower().startswith("lego mario"):
            if d.address == LEGO_CHARACTERISTIC_UUID:

The Mario connects, but is not happy with the IMU? You hear the 'upswing' Mario sound, immediately followd by a 'downswing' Mario sound, that it is not happy.

diff --git a/src/mario.py b/src/mario.py
index bddee31..e95ede2 100644
--- a/src/mario.py
+++ b/src/mario.py
@@ -17,7 +17,8 @@ BUTTON_TIME_DEFAULT = 0.1
 BUTTON_TIME_JUMP = 1.5

 # BLE stuff
-LEGO_CHARACTERISTIC_UUID = "00001624-1212-efde-1623-785feabcd123"
+#LEGO_CHARACTERISTIC_UUID = "00001624-1212-efde-1623-785feabcd123"
+LEGO_CHARACTERISTIC_UUID = "C30C5B5B-9B73-41B1-99C3-3E1AAFC7053E"
 SUBSCRIBE_IMU_COMMAND = bytearray([0x0A, 0x00, 0x41, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01])
 SUBSCRIBE_RGB_COMMAND = bytearray([0x0A, 0x00, 0x41, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01])

@@ -105,6 +106,7 @@ class MarioController:

     def notification_handler(self, sender, data):
+        printf("Notify_handler")
         # Camera sensor data
         if data[0] == 8:

@@ -148,7 +150,8 @@ class MarioController:
             self.gui.accel_field.SetLabel("")
             devices = await BleakScanner.discover()
             for d in devices:
-                if d.name.lower().startswith("lego mario"):
+                #if d.name.lower().startswith("lego mario"):
+                if d.address == LEGO_CHARACTERISTIC_UUID:
                     self.gui.status_field.SetLabel("Found Mario!")
                     try:
                         async with BleakClient(d.address) as client:
Galogalo commented 3 years ago

Hi,

I had the same problem in pyhton3 on windows, but I solved changing only

if d.name.lower().startswith("lego"):

Now I've got problem connecting the movement with the emulator.

Which emu have u used?

Thanks

Sithdown commented 3 years ago

I have the same problem. I hear the 'upswing' Mario sound, then a 'downswing'. The connection is not fulfilled.

Any ideas?