-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Library works great, thanks for the pointer :)
The code would be clearer in constants.js if you did this instead of having placeholder 0x00 bytes that are later changed
eg
function getStartMeasurementCommand(channelMask) {
return [
0x18,
0xff,
0x01, (channelMask >> 0) & 0xff, (channelMask >> 8) & 0xff, (channelMask >> 16) & 0xff, (channelMask >> 24) & 0xff,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
];
}
const STOP_MEASUREMENTS = [0x19, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff];
function getMeasurementPeriodCommand(measurementPeriodInMicroseconds) {
// 32 + (161<<8) + (7<<16) + (0<<24) = 500,000 microseconds
return [
0x1b,
0xff,
0x00, (measurementPeriodInMicroseconds >> 0) & 0xff, // eg 32
(measurementPeriodInMicroseconds >> 8) & 0xff, // eg 161
(measurementPeriodInMicroseconds >> 16) & 0xff, // eg 7
(measurementPeriodInMicroseconds >> 24) & 0xff, //eg 0
0x00,
0x00,
0x00,
0x00,
];
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels