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

Copter: Change enum values to int type #28413

Closed

Conversation

muramura
Copy link
Contributor

AP_Enum is an ENUM variable.
The FLOAT type is incorrect.
Change it to the INT type.

@IamPete1
Copy link
Member

All defaults are stored as floats.

const float def_value;

@muramura
Copy link
Contributor Author

@IamPete1 san. Comments thanks.
All the values are floating-point numbers, aren't they?
I think it would be better if the parameter definitions matched the type of AP_XXXX.
Enums are integer values.

@peterbarker
Copy link
Contributor

@muramura as @IamPete1 points out, the underlying type in the structure is float, not integer. The cast to float would have been added to fix the compilation error which said pretty much exactly that.

Casting it to an integer first won't prevent the cast to float but will (a) make the code more ugly and (b) hide the fact that the value is stored as a float.

Sorry, closing this one.

@peterbarker peterbarker closed this Nov 8, 2024
@muramura
Copy link
Contributor Author

muramura commented Nov 8, 2024

I understand that the parameter values are float values.

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 this pull request may close these issues.

3 participants