purduesigbots / pros

Source code for PROS kernel: open source C/C++ development for the VEX V5 microcontroller
https://pros.cs.purdue.edu
Other
259 stars 76 forks source link

Color Enum does not work properly with motor gears. #508

Closed noam987 closed 1 year ago

noam987 commented 1 year ago

The pros::Color enum is currently being static casted to motor_gear enum class, but the values don't match up leading to bugs.

noam987 commented 1 year ago

Example: pros::Motor_Group left({1, 2});

left.set_gearing(pros::v5::Motor_Gear::green); left.get_gearing(); // returns 1 = green

left.set_gearing(pros::Color::green); left.get_gearing(); // returns 0x00008000

ryan-doan commented 1 year ago

I'm thinking we can have an if statement in motor_set_gearing to check if we're using pros::Color, and then a switch statement to convert the enum to pros::v5::Motor_Gear. Would that suffice?

terrapinrobotics commented 1 year ago

Looks like this functionality is going to be removed in PROS 4, so these changes may not be necessary.

noam987 commented 1 year ago

Closed in #512