Skip to content

Bug in setMode() function #3

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

Closed
tealbrains opened this issue Jun 15, 2020 · 2 comments · Fixed by #4
Closed

Bug in setMode() function #3

tealbrains opened this issue Jun 15, 2020 · 2 comments · Fixed by #4

Comments

@tealbrains
Copy link

Subject of the issue

The mode seems to be locked to HR because of the if statement in setMode():

  if (mode > LIS2DH12_HR_12bit)
    mode = LIS2DH12_HR_12bit; //Default to 12 bit

see the enum:


typedef enum {
  LIS2DH12_HR_12bit   = 0,
  LIS2DH12_NM_10bit   = 1,
  LIS2DH12_LP_8bit    = 2,
} lis2dh12_op_md_t;

Proposed fix:

  if (mode > LIS2DH12_LP_8bit)
    mode = LIS2DH12_HR_12bit; //Default to 12 bit
@tealbrains tealbrains changed the title Bug on setMode() function Bug in setMode() function Jun 15, 2020
@nseidle
Copy link
Member

nseidle commented Jun 15, 2020

Nice find! Thanks for reporting. Indeed. Feel like fixing it with a PR or do you need me to?

@tealbrains
Copy link
Author

No worries, I will issue a PR later today

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 a pull request may close this issue.

2 participants