adafruit / Adafruit_CircuitPython_BNO055

CircuitPython driver for BNO055 absolute orientation sensor
MIT License
85 stars 51 forks source link

Fixed the operation mode reading issue #80

Closed GuenterQ closed 3 years ago

GuenterQ commented 3 years ago

This pull request will fix the issue https://github.com/adafruit/Adafruit_CircuitPython_BNO055/issues/79.

Only translate the lower 4 bits of the register OPR_MODE to the operation mode of the sensor.

ladyada commented 3 years ago

thats a hex number

GuenterQ commented 3 years ago

thats a hex number

Hello ladyada, sorry, I can't understand what you said. Could you please explain why all checks have failed?

Thank you.

jposada202020 commented 3 years ago

@GuenterQ Checks failed as black is used to verify python code. You can use this guide https://learn.adafruit.com/improve-your-code-with-pylint

Black failed as you are using unnecessary parenthesis here: https://github.com/adafruit/Adafruit_CircuitPython_BNO055/blob/0010961e5df95743423ed7f62d9e0677289f448e/adafruit_bno055.py#L302 and Black is reformatting the file to remove them. On doing that the CI will fail.

What Ladyada is referring to is that this 0x00001111 number looks more like an Hex number that a Binary number.

GuenterQ commented 3 years ago

@GuenterQ Checks failed as black is used to verify python code. You can use this guide https://learn.adafruit.com/improve-your-code-with-pylint

Black failed as you are using unnecessary parenthesis here: https://github.com/adafruit/Adafruit_CircuitPython_BNO055/blob/0010961e5df95743423ed7f62d9e0677289f448e/adafruit_bno055.py#L302

and Black is reformatting the file to remove them. On doing that the CI will fail. What Ladyada is referring to is that this 0x00001111 number looks more like an Hex number that a Binary number.

Hello jposada202020! Thanks a lot!

I noticed the mistake I made. It has been modified.

jposada202020 commented 3 years ago

@GuenterQ just modify your line to

return self._read_register(_MODE_REGISTER) & 0b00001111  # Datasheet Table 4-2

It will pass the CI, at least black 😃

evaherrada commented 3 years ago

@GuenterQ If you'd like to have this done automatically for you, we've got a guide on running black locally. https://learn.adafruit.com/improve-your-code-with-pylint/black

jposada202020 commented 3 years ago

@dherrada Changes were made by @GuenterQ could you take a look again . thanks :)