But I think it must be getting it from the wrong place in the data string (eg getUint16(1, true) should be something other than 1) because that's the same place wheelRevs comes from.
Actually I think what's happened is the original app was designed thinking that if the crank speed bit was set, the whole advertising packet only did the crank. But what it really means is that there's wheel and crank data.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
No problem! Yes, it could be quite a good project. It seems the code is there:
https://github.com/espruino/BangleApps/blob/master/apps/cscsensor/cscsensor.app.js#L158-L159
But I think it must be getting it from the wrong place in the data string (eg
getUint16(1, true)
should be something other than 1) because that's the same placewheelRevs
comes from.https://learn.adafruit.com/bluetooth-bicycle-speed-cadence-sensor-display-with-clue?view=all might be handy as a primer
Actually I think what's happened is the original app was designed thinking that if the crank speed bit was set, the whole advertising packet only did the crank. But what it really means is that there's wheel and crank data.
It's really hard to read, but here's the spec: https://github.com/oesmith/gatt-xml/blob/master/org.bluetooth.characteristic.csc_measurement.xml
So I think just changing to:
might fix it