ev3dev / ev3dev-lang

(deprecated) language bindings for ev3dev sensors, motors, LEDs, etc.
GNU General Public License v2.0
56 stars 39 forks source link

Updating the JS binding for recent changes #118

Open WasabiFan opened 8 years ago

WasabiFan commented 8 years ago

@ddemidov Can I get a list of the changes that I need to adapt to on my Node.js side? I believe that there were changes to the LED spec, but didn't follow closely enough to fully grasp the changes that I should make. Also, what's the situation regarding supporting the various ev3dev platforms (RasPi, BB, etc)? Do we need to change the default instances?

P.S. Sorry I've been so out-of-touch :wink:

UPDATE: Current TODO list

ddemidov commented 8 years ago

Here are the changes, I hope did not miss anything. Btw, thanks for opening this, it will also be useful for C++ bindings.

Motors

Sensors

Buttons, RemoteControl

Leds

This is the biggest change in specification.

# Set left logical led to red color.
Leds.set_color(Leds.LEFT, Leds.RED)
# Set trigger for the right logical led, make it 50% bright:
Leds.set(Leds.RIGHT, trigger='timer', brightness_pct=0.5)

This also scales well onto other platforms. For example, PiStorms have two logical groups, each having Red, Blue, and Green physical leds.

Sound

The way we currently work with different platforms may change in the future, see discussion in ev3dev/ev3dev#412. Also see #115.

WasabiFan commented 8 years ago

Great! Thanks. I'll start working on these changes today.

WasabiFan commented 8 years ago

@ddemidov I noticed that the systemDeviceNameConvention uses a {0} to denote the numbers in a name. I think that was something I added as a test a while ago, and now we both replace that with a * for use. Should we just make that replacement in the spec?

WasabiFan commented 8 years ago

Oh, and what's the current status on detecting the running platform for buttons/LEDs? I saw a long discussion somewhere referencing a fair amount of Linux magic that I didn't understand... was that concluded? If not, what are you doing for C++ and Python in this area?

ddemidov commented 8 years ago

and now we both replace that with a * for use. Should we just make that replacement in the spec?

I don't see why not.

Oh, and what's the current status on detecting the running platform for buttons/LEDs?

I think that is still in the planning phase. I made rhempel/ev3dev-lang-python#90 with this in mind, but nothing besides that.