Skip to content

check if we need to update as in https://github.com/OxWearables/actipy/commit/32fe82f63142bf60fa243f0f486287f599e987e0 #267

@chanshing

Description

@chanshing

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
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions