Mistake parsing duration state from telemetry protocol

Hello everyone,
i just tripped over the following lines in the estimote-telemetry.js.
See: estimote-telemetry.js

// ***** MOTION STATE DURATION
// byte 13 => "previous" motion state duration
// byte 14 => "current" motion state duration
// e.g., if the beacon is currently still, "current" will state how long
// it's been still and "previous" will state how long it's previously been
// in motion before it stopped moving
//
// motion state duration is composed of two parts:
// - lower 6 bits is a NUMBER (unsigned 6-bit integer)
// - upper 2 bits is a unit:
//     - 0b00 ("0") => seconds
//     - 0b01 ("1") => minutes
//     - 0b10 ("2") => hours
//     - 0b11 ("3") => days if NUMBER is < 32
//                     if it's >= 32, then it's "NUMBER - 32" weeks

Souldn`t it be:

//     - 0b11 ("3") => days if NUMBER is < 32
//                     if it's >= 32, then it's "NUMBER - 31" month

or sometihing similar?

I’ve actually tripped over this one two weeks ago as well, and forgot to update the parser :see_no_evil:

A patch has just landed on GitHub:

1 Like