ev3dev-lang icon indicating copy to clipboard operation
ev3dev-lang copied to clipboard

Standardizing PowerSupply

Open WasabiFan opened this issue 9 years ago • 2 comments

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).

WasabiFan avatar Dec 09 '15 14:12 WasabiFan

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.

dlech avatar Dec 09 '15 17:12 dlech

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.

ddemidov avatar Dec 09 '15 17:12 ddemidov