Skip to content

Update to new build process and turn on lint. #4

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

Merged
merged 3 commits into from
Jan 15, 2018

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Dec 8, 2017

I haven't tested these changes on device yet. Please only merge you test it or I follow up later to say its tested.

For adafruit/circuitpython#475

I haven't tested these changes on device yet. Please only merge you test it or I follow up later to say its tested.

For adafruit/circuitpython#475
@tannewt tannewt requested a review from a team December 8, 2017 22:23
Copy link
Contributor

@kattni kattni left a comment

Choose a reason for hiding this comment

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

The library doesn't work as it is - it returns all 0's for data. It doesn't work before your changes either though without the following alteration to line 179 in this section:

    def init(self, mode=NDOF_MODE):
        chip_id = self._read_register(_ID_REGISTER)
        if chip_id != _CHIP_ID:
            raise RuntimeError("bad chip id (%x != %x)" % (chip_id, _CHIP_ID))
        self.reset()
        self._write_register(_POWER_REGISTER, _POWER_NORMAL)
        self._write_register(_PAGE_REGISTER, 0x00)
        self._write_register(_TRIGGER_REGISTER, 0x00)
        time.sleep(0.01)
        self.switch_mode(mode)
        time.sleep(0.2)

Changing time.sleep to 0.2 resolves the issue and the sensor works. Basic testing on my part couldn't sort how to resolve it in the PR code. Adding @deshipu as a reviewer.

@kattni kattni requested a review from deshipu December 20, 2017 21:56
self.reset()
self._write_register(_POWER_REGISTER, _POWER_NORMAL)
self._write_register(_PAGE_REGISTER, 0x00)
self._write_register(_TRIGGER_REGISTER, 0x00)
Copy link
Contributor

Choose a reason for hiding this comment

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

The setting of mode and the delay after it are necessary for this sensor to work. Removing them breaks it.
You need to add this at the end:

        self.mode = NDOF_MODE
        time.sleep(0.2)

magnetic properties. Orientation should be standardized but its
unclear what it should be.
@tannewt
Copy link
Member Author

tannewt commented Jan 9, 2018

Please re-review. I fixed up the __init__ method.

@tannewt tannewt closed this Jan 9, 2018
@tannewt tannewt reopened this Jan 9, 2018
@tannewt
Copy link
Member Author

tannewt commented Jan 9, 2018

Oops, wrong button. :-)

Copy link
Contributor

@kattni kattni left a comment

Choose a reason for hiding this comment

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

Tested successfully! Great job!

@kattni kattni merged commit 43f54f5 into adafruit:master Jan 15, 2018
tannewt pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 16, 2018
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