-
Notifications
You must be signed in to change notification settings - Fork 9
Change placeholder python code (OpMode, etc) to match Peter's API #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added upgrade code to rename 'update' to 'opmode_periodic' in mechanism modules.
Removed staticFunctionName and mrcStaticFunctionName.
Changed code that generates the type decorator to use the full decorator name (including the module blocks_base_class) so the Teleop decorator doesn't collide with the Teleop class. Generate code that was in robot_base.py, but is not in wpilib.OpModeRobot. Generate code that was in opmode.py, but is not in wpilib.PeriodicOpMode.
|
I found a problem when I ran through the testing checklist, so I changed this to a draft pr. Feel free to start reviewing the code. |
alan412
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question I have, but if it was intentional I am fine with it merging. It just seems unrelated to everything else being changed
| const body = mechanisms + components; | ||
| if (body) { | ||
| code += body; | ||
| generator.addClassMethodDefinition('define_hardware', code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changed to always create define_hardware even if there is no hardware?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was intentional. Previously, we had blocks_base_classes.RobotBase that declared the define_hardware method and called it from its init method. I figured it was easier to always generate the define_hardware method declaration and always generate the call to it from the init method, than it was to conditionally generate the define_hardware method declaration (if body isn't empty) and then conditionally generate the call to it from the init method.
Change placeholder python code (OpMode, etc) to match Peter's API.
Fixes #347