I'm adding a temperature probe to my home-made arduino moonlite clone at the moment.

So I'm adding the command handling to the arduino for setting the temp coefficient but running into trouble.
I'm wondering if indi-moonlite really sends the correct data for this command.

Examples of setting driver values and the serial data sent:

  1. I set the temp in the driver to 1.0 and the driver sends `SC02#` over usb
  2. I set the temp in the driver to 1.2 and the driver sends `SC02#` over usb
  3. I set the temp in the driver to 1.5 and the driver sends `SC03#` over usb

Looking at the driver code here github.com/indilib/indi/blob/master/driv....cpp#L286C19-L286C63
uint8_t hex = static_cast<int8_t>(coefficient * 2) & 0xFF;
I see it doubles the value and then does a bitwise and with 0xFF to get the hex to send.

So I'm wondering, is this correct?
What is the precision of the value that gets sent over the serial bus?
Also, how do I convert the hex back to a double in arduino code?

Thanks!
Derek

Read More...