Magnetometer signals are improperly being decoded from MotionSenseHRV hardware units

Description

TranslateMag.java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Some comments here static double[] getMagnetometer1(byte[] bytes, double[] sensitivity) { double[] sample = new double[3]; sample[0] = convertADCtoSI((short) ((bytes[0] & 0xff) << 8) | (bytes[1] & 0xff), sensitivity[0]); sample[1] = convertADCtoSI((short) ((bytes[4] & 0xff) << 8) | (bytes[5] & 0xff), sensitivity[1]); sample[2] = convertADCtoSI((short) ((bytes[8] & 0xff) << 8) | (bytes[9] & 0xff), sensitivity[2]); return sample; } static double[] getMagnetometer2(byte[] bytes, double[] sensitivity) { double[] sample = new double[3]; sample[0] = convertADCtoSI((short) ((bytes[2] & 0xff) << 8) | (bytes[**1**] & 0xff), sensitivity[0]); sample[1] = convertADCtoSI((short) ((bytes[6] & 0xff) << 8) | (bytes[**5**] & 0xff), sensitivity[1]); sample[2] = convertADCtoSI((short) ((bytes[**8**] & 0xff) << 8) | (bytes[**9**] & 0xff), sensitivity[2]); return sample; }

See bytes marked with **

Environment

None

Status

Assignee

Monowar Hossain

Reporter

Timothy Hnat

Labels

None

Priority

High