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] Make RM3100 module frequency variable #2901

Merged
merged 4 commits into from
Sep 22, 2022

Conversation

matteobarbera
Copy link
Contributor

@matteobarbera matteobarbera commented Sep 19, 2022

This is a pull request addressing issue #2788. The module frequency is turned into a variable to allow the user to change it as they see fit to make use of the high polling frequency the RM3100 mag sensor is capable of.

With this change, the variable MODULE_RM3100_RATE can be defined in the airframe to change the default module frequency of 60 Hz.

<module name="mag" type="rm3100">
      <configure name="MODULE_RM3100_RATE" value="150"/>
</module>

I tested the PR by defining MODULE_RM3100_RATE and setting it to 60, 150, 300 to check that the frequency change works as intended.

rm3100_freq_pr

@matteobarbera
Copy link
Contributor Author

I wanted to also add a check for frequencies less than 1 in mag_rm3100.c, but for some reason this does not cause an error in compilation.

#if (MODULE_RM3100_RATE < 1)
#error "Module frequency cannot be less than 1 Hz"
#endif

@fvantienen
Copy link
Member

The plot of 60Hz shows clearly that you read the same sensor measurement twice. I haven't looked at the code, butthis seems to me like there is an error in the implementation of the driver.

conf/modules/mag_rm3100.xml Outdated Show resolved Hide resolved
conf/modules/mag_rm3100.xml Outdated Show resolved Hide resolved
@gautierhattenberger
Copy link
Member

Check this module to see how to make a configurable period with default value: https://github.com/paparazzi/paparazzi/blob/master/conf/modules/baro_ms5611_i2c.xml#L23

@gautierhattenberger gautierhattenberger merged commit c716819 into paparazzi:master Sep 22, 2022
FlorianSan pushed a commit to enacuavlab/paparazzi that referenced this pull request May 30, 2023
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