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

AP_Mount: SWITCH statement to table reference #24992

Merged

Conversation

muramura
Copy link
Contributor

I would change to a type table with LEN values as indices.
No more decisions will be necessary.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good change, but we do not want potential invalid memory accesses.

cam_image_type = CameraImageType::MAIN_THERMAL_SUB_WIDEANGLE; // 8
break;
}
static CameraImageType cam_image_type_table[9] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static CameraImageType cam_image_type_table[9] = {
static const CameraImageType cam_image_type_table[] {

libraries/AP_Mount/AP_Mount_Siyi.cpp Show resolved Hide resolved
@peterbarker peterbarker force-pushed the AP_SWITCH_statement_to_table_reference branch from f3f25d8 to 8e89542 Compare July 10, 2024 12:45
@peterbarker peterbarker requested a review from rmackay9 July 10, 2024 12:46
@peterbarker
Copy link
Contributor

This LGTM, but Randy should have a look since he's playing with the Siyi driver ATM.

@peterbarker peterbarker merged commit 7f97e89 into ArduPilot:master Jul 25, 2024
92 checks passed
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.

2 participants