Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for the :GC# command for Moonlite focuser #2004

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
knro marked this conversation as resolved.
Show resolved Hide resolved
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
Loading