ev3dev / ev3dev-lang

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

Standardizing PowerSupply #131

Open WasabiFan opened 8 years ago

WasabiFan commented 8 years ago

Looking through the python library, I can't quite tell what the standard behavior in the PowerSupply is (it takes a port parameter, and it seems like if the port is specified it might try to read from a nonexistent attribute... but I'm not sure). Whatever the case, I am pretty sure that our docs are now wrong:

Uses the built-in legoev3-battery if none is specified.

Should we completely remove this line from the docs? Or add a platform-specific version of this class which defaults to the current platform's power supply? Or maybe just use a wildcard by default for the device name so that it selects the first device it finds?

I'd vote for the last one, but open to suggestions (both based on opinions and current implementation).

dlech commented 8 years ago

Rather than making platform specific power supplies, I would suggest utilizing the scope attribute (same as the POWER_SUPPLY_SCOPE property) to find the "System" power supply.

ddemidov commented 8 years ago

it takes a port parameter, and it seems like if the port is specified it might try to read from a nonexistent attribute

This is a leftover of mass-conversion to pure python I guess. We should change PowerSupply's constructor to a custom one.