Skip to content
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

🐛[BUG] - Negative port reversed motors do not work with is_installed. #736

Open
theguy20phi opened this issue Dec 30, 2024 · 1 comment · May be fixed by #741
Open

🐛[BUG] - Negative port reversed motors do not work with is_installed. #736

theguy20phi opened this issue Dec 30, 2024 · 1 comment · May be fixed by #741

Comments

@theguy20phi
Copy link

Expected Behavior:

The is_installed motor method should return true whenever it is reversed by constructing it with a negative port value.

Actual Behavior:

It returns false.

Steps to reproduce:

motor_works_and_is_reversed_but_apparently_not_installed

System information:

Platform: V5
PROS Kernel Version: 4.1.1

Additional Information

I think it has to do with the constructor called for the Device parent class taking an unsigned integer for its port whereas the Motor class takes a signed integer. I say this because whenever the motor is reversed by set_reversed it works as expected.
also_works

@theguy20phi theguy20phi changed the title Negative port reversed motors do not work with is_installed. 🐛[BUG] - Negative port reversed motors do not work with is_installed. Dec 30, 2024
@thiccaxe
Copy link

probably can be solved like this

Motor::Motor(const std::int8_t port, const pros::v5::MotorGears gearset, const pros::v5::MotorUnits encoder_units)
    : Device(abs(port), DeviceType::motor), _port(port) {...}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants