Giter Club home page Giter Club logo

Comments (6)

cuernodegazpacho avatar cuernodegazpacho commented on July 18, 2024 1

Thanks, @cpseager , that did it! I got both button sets working. I will clean up my branch and make a pull request.

from pylgbst.

cpseager avatar cpseager commented on July 18, 2024

Remote buttons are a unique sensor type (id 55) so you need to add a new peripheral class (not Button) to handle this type of sensor.

from pylgbst.

cuernodegazpacho avatar cuernodegazpacho commented on July 18, 2024

@cpseager thanks for the hint! I noticed that Button differs from other sensors by lacking its own implementation of _decode_port_data. So I created a subclass of Peripheral named RemoteButton, where I implement the subscribe and unsubscribe methods, and I added a bare _decode_port_data that, for initial debugging, just prints its parameter. No difference with what I had before. The subscription mechanism works, but the only button that sends callback notifications is the green hub button, which is not even mapped in the class. I can trace the internals of the bluetooth messaging in the computer, and see that nothing seems to come out of the remote buttons when they are pressed. I checked it with two remotes, so it's not a defect in the hardware. I am at loss on what is going on.

from pylgbst.

cpseager avatar cpseager commented on July 18, 2024

On the remote the two buttons are configured as ‘external’ sensors (id 55) on ‘internal’ ports 0 and 1. This makes sense, as in this case you cannot configure them as two dedicated ‘internal’ ports (like Voltage or Button ports) as they would both need to use the same port id number.

Therefore a quick scan of your dev branch shows you have appeared to try to configure the RemoteButton as an internal port (like Button) rather than external (like VisionSensor). In particular your subscribe will need to be something along the lines of

def subscribe(self,callback, mode=0, granularity=1):
super().subscribe(callback, mode, granularity)

from pylgbst.

cuernodegazpacho avatar cuernodegazpacho commented on July 18, 2024

I created PR #132 to implement the remote (cc @undera )

from pylgbst.

undera avatar undera commented on July 18, 2024

I have added some comments on the code, please address those.

from pylgbst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.