Skip to content

Commit

Permalink
Fix version reporting on old NexStar mounts
Browse files Browse the repository at this point in the history
Celestron NexStar mount hand controllers have been introduced with a
number of firmware versions over the years.  Starting with the 4.xx
NexStar controllers, the minor version is a 2-digit value (currently
4.22).  The older hand controllers (while sporting fewer features) still
will talk to INDI since the basic serial communication protocol has not
changed.

For these older controllers (v1.2, v1.6, and v2.2), the minor version is
a single-digit value.  The current code in CelestronDriver::get_version
forces a two-digit minor version, so, for instance, the v2.2 controller
is recorded as "2.02".  When the version is checked against device
capabilities, 2.02 < 2.2, so it is incorrectly rejected.

This commit checks the major version of the hand controller, and uses
a 2-digit minor version for values larger than 2, and a 1-digit minor
version for earlier models.

	modified:   drivers/telescope/celestrondriver.cpp
  • Loading branch information
tbowers7 committed Jan 5, 2024
1 parent 93ef452 commit 7820b90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/telescope/celestrondriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ bool CelestronDriver::get_version(char *version, size_t size)
if (!send_command("V", 1, response, 3, true, false))
return false;

snprintf(version, size, "%d.%02d", static_cast<uint8_t>(response[0]), static_cast<uint8_t>(response[1]));
// Versions up to 2.2 have a single-digit minor version
if (static_cast<uint8_t>(response[0]) > 2)
snprintf(version, size, "%d.%02d", static_cast<uint8_t>(response[0]), static_cast<uint8_t>(response[1]));
else
snprintf(version, size, "%d.%d", static_cast<uint8_t>(response[0]), static_cast<uint8_t>(response[1]));

LOGF_INFO("Controller version: %s", version);
return true;
Expand Down

0 comments on commit 7820b90

Please sign in to comment.