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

Always substract offset regardless of calLevel #8

Merged
merged 1 commit into from Jun 6, 2023

Conversation

lgtrombetta
Copy link
Contributor

This patch fixes calibration of the magnetometer. Previously, the subtraction of the offset was being done only when calLevel was not 3, or any of the offset components needed to be updated. However, even if calibration (i.e. the process of computing the right offsets) is finished, the subtraction must always be done as new raw data keeps going through the filter.

This has been tested a while back on the OG PinePhone running Ubuntu Touch 16.04 and it was proposed as part of a PR to the ubports fork of sensorfw. It was suggested there that this is instead sent upstream.

@pvuorela
Copy link
Contributor

@mlehtima or @spiiroin maybe you guys could have an idea if this is good.

Copy link
Contributor

@spiiroin spiiroin left a comment

Choose a reason for hiding this comment

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

Explanation makes sense -> so does the change.

The class has bunch related member variables that are not explicitly initialized, but at least on a quick glance calLevel != 3 gets all of them assigned. And calLevel is zero initialized. So I guess it is all right too.

@mlehtima mlehtima merged commit f4e1d4b into sailfishos:master Jun 6, 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
4 participants