Skip to content
This repository was archived by the owner on Oct 29, 2019. It is now read-only.

Reorder mag return values from XZY order to XYZ. #7

Merged
merged 1 commit into from
Oct 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion adafruit_lsm303.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def raw_magnetic(self):
"""
self._read_bytes(self._mag_device, _REG_MAG_OUT_X_H_M, 6, self._BUFFER)
raw_values = struct.unpack_from('>hhh', self._BUFFER[0:6])
return tuple([n >> 4 for n in raw_values])
values = tuple([n >> 4 for n in raw_values])
return (values[0], values[2], values[1])

Choose a reason for hiding this comment

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

Given the discussion along with they PR I suggest that the shifts be removed and this simply use:

return (raw_values[0],raw_values[2],raw_values[1])

Copy link
Contributor

Choose a reason for hiding this comment

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

Or defer that to another issue/PR. We've kind of hijacked this one. The PR fixes what it was meant to fix.

Choose a reason for hiding this comment

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

fine with me -- I have no objection to merging this PR.

@property
def magnetic(self):
Expand Down