OpenBCI / OpenBCI_Cyton_Library

Repository for OpenBCI Cyton Arduino Libraries
MIT License
87 stars 88 forks source link

Fixed ACCEL_AXIS_* defines #85

Closed terziman closed 5 years ago

terziman commented 6 years ago

The previous values were not working because 'LIS3DH_writeAxisDataForAxisSerial' and 'LIS3DH_writeAxisDataForAxisWifi' truncate values > 2, ie: if (axis > 2) axis = 0;

Therefore, the value sent was always the 'X' channel.

However, I have not builded and flashed my firmware yet, so this fix should be validated. In particular, is the accel data available at frames 0, 1 & 2? Or was the value of ACCELAXIS* specifically at 7, 8 & 9 to let the time to get accel sensor data ? Anyway, the current implementation is broken and should be fixed.

terziman commented 6 years ago

After testing, I was right to fear that accel data would not be available on frames [0:2].

The final proposed fix (that is tested and working) is to normalize the input of 'LIS3DH_writeAxisDataForAxisSerial' and 'LIS3DH_writeAxisDataForAxisWifi' to be independent of ACCELAXIS* values, as long as the 3 values are in sequence.

andrewjaykeller commented 5 years ago

Hi sorry i didnt see this PR!