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

mag_calibration: only allocate as much memory as needed #9312

Merged
merged 1 commit into from
Apr 16, 2018

Conversation

potaito
Copy link
Contributor

@potaito potaito commented Apr 16, 2018

PX4 has a hard-coded maximum number of magnetometers it supports, which is 4:
https://github.com/PX4/Firmware/blob/123f11fcdda9dc6c39ebd94657c5ee94ee53cc90/src/modules/commander/mag_calibration.cpp#L66

Current situation: The calibration routine always allocates the memory for four mags to be calibrated, even when the platform only has a single compass.

Suggestion: Only allocate the memory for the number of mags that the platform actually carries. In case of a single mag, the memory footprint is lowered by 75%. In my test it then allocated only 3800 instead of 15200 bytes.

@potaito
Copy link
Contributor Author

potaito commented Apr 16, 2018

Thanks, that was fast 😁

@LorenzMeier LorenzMeier merged commit c16e17f into master Apr 16, 2018
@LorenzMeier LorenzMeier deleted the pr-mag-calib-memory-footprint branch April 16, 2018 12:49
@LorenzMeier
Copy link
Member

This will help a ton, thanks!

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

Successfully merging this pull request may close these issues.

3 participants