×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

INID Moonlite serial commands for temp coefficient

  • Posts: 456
  • Thank you received: 76
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
3 months 3 days ago #98431

Please Log in or Create an account to join the conversation.

  • Posts: 456
  • Thank you received: 76
OK I found the serial documentation indilib.org/media/kunena/attachments/1/H...sSteppermotor107.pdf
Looks like the commands sent are correct but the protocol uses two-digit, signed (2’s complement) hex number.
So I think it can only support int values from -128 to +127. However the driver UI allows entry of decimal values.
3 months 3 days ago #98433

Please Log in or Create an account to join the conversation.

Time to create page: 0.178 seconds