adafruit / Adafruit_CircuitPython_Crickit

Convenience library for Adafruit Crickit robotics boards
MIT License
12 stars 12 forks source link

Evaluating crickit in repl causes dc_motor_1 only to spin. #39

Open tyeth opened 2 months ago

tyeth commented 2 months ago

I'm playing with a 2wheel dc motor rover project.

Pressing tab in the REPL to evaluate available things off of crickit causes dc_motor_1 to fire but not dc_motor_2.

Why is that, maybe while evaluating it's initialising stepper which causes stepper "poles" to be setup on the pins for dc_motor_1 that would be opposite to dc_motor_2's poles?

Turning off and on the motors individually works as expected.

I guess this is both a question to ask why it happens, and secondly a feature request to ask that it doesn't

ladyada commented 2 months ago

you could run the cricket.py code and add pauses/prints to figure out where exactly its happening

tyeth commented 2 months ago

Good shout, aided by the AI overlords for liberal prints+delays, I saw it was indeed the stepper initialisation which came after the dc motors were initialised

484.160: DEBUG - Accessing stepper_motor
485.166: DEBUG - Creating motor on terminals (22, 23, 19, 18)
***Motor 1 fires

Now I'll ponder what to do about it 😁

tyeth commented 2 months ago

So it turns out this is a "feature" / wish-list item in micropython "dir() executes properties. It shouldn't." https://github.com/micropython/micropython/issues/4546 Thanks to @jepler for pointing it out.

tyeth commented 2 months ago

Cleaning up my open tabs, so wont be revisiting this anytime soon, but this tracks the issue in circuitpython

Blocked by https://github.com/adafruit/circuitpython/issues/2179