Skip to content

Commit

Permalink
added support for the :GC# command for Moonlite focuser (#2004)
Browse files Browse the repository at this point in the history
* Added the :GC# command to retreive the stored temperature coefficient from my focuser

* Added the :GC# command to retreive the stored temperature coefficient from my focuser
  • Loading branch information
hbwtrs authored Feb 23, 2024
1 parent 1d5d6e2 commit 4ddd745
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/focuser/moonlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@ bool MoonLite::readTemperature()
return true;
}

bool MoonLite::readTemperatureCoefficient()
{
char res[ML_RES] = {0};

if (sendCommand(":GC#", res) == false)
return false;

uint8_t coefficient = 0;
int rc = sscanf(res, "%hhX", &coefficient);
if (rc > 0)
// Signed HEX of two digits
TemperatureSettingNP[1].setValue(static_cast<int8_t>(coefficient) / 2.0);
else
{
LOGF_ERROR("Unknown error: focuser temperature coefficient value (%s)", res);
return false;
}

return true;
}

bool MoonLite::readPosition()
{
char res[ML_RES] = {0};
Expand Down Expand Up @@ -425,6 +446,9 @@ void MoonLite::GetFocusParams()
if (readTemperature())
TemperatureNP.apply();

if (readTemperatureCoefficient())
TemperatureSettingNP.apply();

if (readSpeed())
IDSetNumber(&FocusSpeedNP, nullptr);

Expand Down
2 changes: 2 additions & 0 deletions drivers/focuser/moonlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class MoonLite : public INDI::Focuser
bool readStepMode();
// Read and update Temperature
bool readTemperature();
// Read and update Temperature Coefficient
bool readTemperatureCoefficient();
// Read and update Position
bool readPosition();
// Read and update speed
Expand Down

0 comments on commit 4ddd745

Please sign in to comment.