• I'm not 100% sure the docs you found are for the UUID 0x1809 that's being used though

    GATT docs list that as:

    Health Thermometer	org.bluetooth.service.health_thermometer­	0x1809

    It matches your example in docs. From what I can tell 0x2A1C is a code for "temperature measurement", while 0x1809 is the code for the "health thermometer" service as a whole. Not sure if the NRF library we're using even has a notion of those formats, or is it up for us to provide an implementation.

    The issue is with the EspruinoHub's decoding. It's doing something pretty simple right now - 8 bit is interpreted as-is, and 16 bit is the temperature x100

    Hmm... it seems that you're bitshifting the second value ((((a[1]<<8)+a[0])/100)), which makes it hard for me to reverse it.

    How would you encode a 16 bit float to this that would work on puck (i'm assuming its BE)?

    function encodeFloat(num) {
      const dec = Math.round(n);
      const fractional = Math.round(n % 1 * 100);
      return [ dec, fractional >> 8 ]; // ???

Avatar for Thinkscape @Thinkscape started