Skip to content

Get platform-specific features fully implemented in spec #141

Description

@WasabiFan

So far, we have had some discussions on platform uniformity and such in various issues (e.g. #115 and ev3dev/ev3dev#412). I think we should get the rest of the platform functionality figured out now to make sure that all platforms are supported.

@dlech said in #115

I would like the same program to run on any platform without having to make any changes.

So, keeping that as a goal, how can we get our API updated?

LEDs

For LEDs, we still need to allow specific control of just single LEDs and colors. However, I imagine that if we could get some default common actions/states implemented cross-platform we could allow programs to run cross-platform without modification (at least until they need more fine-grained control). I am imagining utility methods like this:

Possible name Meaning EV3 action BrickPi action PiStorms action
success Success green both on solid green
warning Warning/danger amber or red both flashing (rapidly) amber or red
progress Indicate specified % Fade from red to green special (see below) Fade from red to green

I'm imagining the "special" case above to be:

  • From 0% to 50%, increasing blink rate of 1st LED while 2nd off
  • From 50% to 95%, Increasing blink rate of 2nd LED while 1st is ON
  • 95% both on

...But that depends on how triggers react to being repeatedly set (we may need to group it in 25% increments).

With a scheme such as this, programs could use these interfaces for simple tasks and wouldn't need to break platform compatibility in the process.

Buttons

I think that it is important to accept up-front that the buttons can't be very universal. Only the EV3 has 6 buttons; the others have 0 and 1. So, I think this just needs to stay separate, unfortunately.

PowerSupply

I think that it's best if we just have the PowerSupply default to using whichever platform device it finds first. That would be legoev3-battery, brickpi-battery, or pistorms-battery.

Ports

Although EV3 and BrickPi are uniform, PiStorms has 4 ports with different labeling. Optimally, we would use OUTPUT_A, INPUT_1, etc. for all platforms, so I think we should use some sort of mapping: Declare that BAS1 is port 1, for example, and handle the internal naming differences with extra code (which would depend on the platform).

Display/sound

Platform-agnostic by default, so doesn't matter.


So, what are your thoughts? @ddemidov @rhempel
CC @dlech

And is this something that we want to add before our (hopefully upcoming) release or wait for a subsequent one?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions