Check whether the below needs to also be updated according to this: OxWearables/actipy@32fe82f
|
if (rateCode != 0) { |
|
timestampOffset = buf.getShort(26); // timestamp |
|
// offset ok |
|
// if fractional offset, then timestamp offset was |
|
// artificially |
|
// modified for backwards-compatibility ... |
|
// therefore undo this... |
|
int oldDeviceId = getUnsignedShort(buf, 4); |
|
if ((oldDeviceId & 0x8000) != 0) { |
|
sampleFreq = 3200.0 / (1 << (15 - (rateCode & 15))); |
|
if (USE_PRECISE_TIME) { |
|
// Need to undo backwards-compatible shim: |
|
// Take into account how many whole samples |
|
// the fractional part of timestamp |
|
// accounts for: |
|
// relativeOffset = fifoLength - |
|
// (short)(((unsigned long)timeFractional * |
|
// AccelFrequency()) >> 16); |
|
// nearest whole sample |
|
// whole-sec | /fifo-pos@time |
|
// | |/ |
|
// [0][1][2][3][4][5][6][7][8][9] |
|
// use 15-bits as 16-bit fractional time |
|
fractional = ((oldDeviceId & 0x7fff) << 1); |
|
// frequency is truncated to int in firmware |
|
timestampOffset += ((fractional * (int) sampleFreq) >> 16); |
|
} |
|
} |
|
} else { |
|
sampleFreq = buf.getShort(26); |
|
// very old format, where pos26 = freq |
|
} |
Check whether the below needs to also be updated according to this: OxWearables/actipy@32fe82f
biobankAccelerometerAnalysis/src/accelerometer/java/AxivityReader.java
Lines 174 to 205 in c92193b