Meade LX200 commands Sr and Sd have extra space and wrong degree character

Bug #1272960 reported by Peter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stellarium
Fix Released
High
Peter

Bug Description

This was found from experiments with a telescope emulator supporting the Meade LX-200 protocol, using the slew command (CMD+0) from within Stellarium 0.12.4 on the Mac.

The current behaviour does not match the documented protocol,
http://www.meade.com/support/TelescopeProtocol_2010-10.pdf
http://www.meade.com/support/LX200CommandSet.pdf

This was confirmed by reading https://svn.code.sf.net/p/stellarium/code/trunk/stellarium/plugins/TelescopeControl/src/servers/Lx200Command.cpp which is quoted below with comments on three problem lines.

bool Lx200CommandSetSelectedRa::writeCommandToBuffer(char *&p, char *end)
{
 if (end-p < 13) return false;
   // set object ra:
 *p++ = ':';
 *p++ = 'S';
 *p++ = 'r';
 *p++ = ' '; // REMOVE THIS?
 int x = ra;
 p += 8;
 p[-1] = '0' + (x % 10); x /= 10;
 p[-2] = '0' + (x % 6); x /= 6;
 p[-3] = ':';
 p[-4] = '0' + (x % 10); x /= 10;
 p[-5] = '0' + (x % 6); x /= 6;
 p[-6] = ':';
 p[-7] = '0' + (x % 10); x /= 10;
 p[-8] = '0' + x;
 *p++ = '#';
 has_been_written_to_buffer = true;
 return true;
}

i.e. This sends ":Sr HH:MM:SS#" with a space after the "Sr" before the first digit. The protocol specifies sending ":SrHH:MM.T#" or ":SrHH:MM:SS#" with no space after the "Sr".

bool Lx200CommandSetSelectedDec::writeCommandToBuffer(char *&p, char *end)
{
 if (end-p < 13)
  return false;

   // set object dec:
 *p++ = ':';
 *p++ = 'S';
 *p++ = 'd';
 *p++ = ' '; // REMOVE THIS?
 int x = dec;
 if (x < 0)
 {
  *p++ = '-';
  x = -x;
 }
 else
 {
  *p++ = '+';
 }
 p += 8;
 p[-1] = '0' + (x % 10); x /= 10;
 p[-2] = '0' + (x % 6); x /= 6;
 p[-3] = ':';
 p[-4] = '0' + (x % 10); x /= 10;
 p[-5] = '0' + (x % 6); x /= 6;
 p[-6] = 223; // degree symbol <-- SHOULD BE '*' INSTEAD, i.e. chr(42)
 p[-7] = '0' + (x % 10); x /= 10;
 p[-8] = '0' + x;
 *p++ = '#';
 has_been_written_to_buffer = true;
 return true;
}

i.e. This sends ":Sd sDD?MM:SS#" with a space after the "Sd" before the first digit, where ? represents chr(223).

The protocol specifies sending ":SdsDD*MM#" or ":SdsDD*MM:SS#" where the second "s" means the sign, plus or minus. Rather than a degree symbol, it should be asterisk, chr(42).

This should be a three line fix - the hard part will be testing with a few real telescopes claiming to support the Meade LX-200 protocol.

Related branches

Changed in stellarium:
assignee: nobody → Bogdan Marinov (daggerstab)
importance: Undecided → High
Revision history for this message
Alexander Wolf (alexwolf) wrote :
Changed in stellarium:
assignee: Bogdan Marinov (daggerstab) → Peter (maubp)
milestone: none → 0.13.0
status: New → Fix Committed
Changed in stellarium:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.