Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plans for adding other hubs, maybe Mindstorms 515151? #118

Open
TravelTrader opened this issue Feb 17, 2022 · 5 comments
Open

Any plans for adding other hubs, maybe Mindstorms 515151? #118

TravelTrader opened this issue Feb 17, 2022 · 5 comments

Comments

@TravelTrader
Copy link

Are there any plans for adding other hubs,
especially Mindstorms 515151??

Thank you!

@undera
Copy link
Owner

undera commented Feb 17, 2022

Hello,
Unfortunately, I don't have access to that set, so I can't contribute such support.

Anyone with access to that hub can contribute it. It will be pretty much copying the code of MoveHub class and tailoring it to whatever onboard devices are standard for that hub.

I can be an advisor in that process.

@TravelTrader
Copy link
Author

Wow, thanks.
I’ll collect informations I have at first.

@undera
Copy link
Owner

undera commented Feb 17, 2022

Very useful is to collect whatever Hub reports itself. Here's my script to do that:

import json
import time
import unittest

from pylgbst.hub import MoveHub
from tests import log


class GeneralTest(unittest.TestCase):
    def setUp(self):
        super(GeneralTest, self).setUp()
        self.hub = MoveHub()
        time.sleep(2)
        log.debug("Created hub: %s", self.hub)
        log.warning("\n\n\n")

    def _describe(self):
        descr = {}
        for dev in self.hub.peripherals.values():
            descr[str(dev)] = dev.describe_possible_modes()

        with open("descr.json", "w") as fhd:
            json.dump(descr, fhd, indent=True)

@TravelTrader
Copy link
Author

TravelTrader commented Feb 17, 2022

What worked for me is to use screen to connect and then ^C to get into the MicroPython environment of the hub. That’s really great but only possible for a connection by USB.

If you’d help me to build up a bluetooth connection to the new Hub that creates a serial port like /dev/ttyBluetooth then it would be awesome to use the screen-method like above.

Do you know how to create a serial connection to a bluetooth connected device?

@undera
Copy link
Owner

undera commented Feb 18, 2022

Wow, that's a bit complex for me with the screen thing...

With PoweredUP hubs, usually you can take the Hub class and connect to it either using the device name, or knowing its MAC.
If you enable DEBUG level logging, the discovered devices would be printed into console, so you can find out what's the name and MAC of the hub. From there you can copy the MoveHub class and start changing it. For example, putting the DEFAULT_NAME of hubs of this kind.

Hope that helps you somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants