Fixing imports and adding Encoder printouts to the ivp#7
Fixing imports and adding Encoder printouts to the ivp#7
Conversation
SampleCode/sample_miscellaneous.py
Outdated
| time.sleep(0.1) | ||
| while (buttons.is_GP20_pressed() or buttons.is_GP21_pressed()): | ||
| time.sleep(.01) | ||
| wait_for_button() |
There was a problem hiding this comment.
This waits for press + released now, is that intentional?
There was a problem hiding this comment.
It was intentional originally, but upon thinking about it a little more, I realized the initial implementation was correct. I've reverted that change and added comments for clarity
WPILib/WPILib.py
Outdated
| from _servo import Servo | ||
| from _buttons import Buttons | ||
| from _led import RGBLED | ||
| from . import _drivetrain |
There was a problem hiding this comment.
Why not do the following and avoid needing to change the code below? Is it a limitation of circuitpython?
from ._drivetrain import Drivetrain
Local imports: https://peps.python.org/pep-0008/#imports
There was a problem hiding this comment.
There's nothing wrong with your recommendation, just that I'm not a primary python developer so I didn't know the exact syntax, and thus reverted to what I did know.
I've implemented your suggestion
There was a problem hiding this comment.
👍 both options work, I was just curious.
code.py
Outdated
| # | ||
| # Your Code Here! | ||
| # | ||
| pass |
There was a problem hiding this comment.
Should this default to ivp() until the user edits it?
There was a problem hiding this comment.
Yes, it should. I've fixed it in one of the recent commits.
|
I sped up the LED testing code that runs during the IVP as it was taking 6 seconds to cycle through a couple different color/brightness combinations, which is a lot of time to spend on testing a non-essential function of the board. I've reduced this time to 2 seconds. |
In the code currently stored on main, importing from WPILib.py fails due to an import failure. This pull request fixes that and also adds the encoder printouts to the installation verification program, which will enable users to test if their motors are oriented properly.