From 11ef87666ff67028c908f53628652293d73cd2b9 Mon Sep 17 00:00:00 2001 From: Huib Wouters Date: Thu, 22 Feb 2024 16:47:56 +0100 Subject: [PATCH 1/2] Added the :GC# command to retreive the stored temperature coefficient from my focuser --- drivers/focuser/moonlite.cpp | 24 ++++++++++++++++++++++++ drivers/focuser/moonlite.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/focuser/moonlite.cpp b/drivers/focuser/moonlite.cpp index f12274289b..60822fabd4 100644 --- a/drivers/focuser/moonlite.cpp +++ b/drivers/focuser/moonlite.cpp @@ -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 two digits + TemperatureSettingNP[1].setValue(static_cast(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}; @@ -425,6 +446,9 @@ void MoonLite::GetFocusParams() if (readTemperature()) TemperatureNP.apply(); + if (readTemperatureCoefficient()) + TemperatureSettingNP.apply(); + if (readSpeed()) IDSetNumber(&FocusSpeedNP, nullptr); diff --git a/drivers/focuser/moonlite.h b/drivers/focuser/moonlite.h index 0b709b8b95..4a70419255 100644 --- a/drivers/focuser/moonlite.h +++ b/drivers/focuser/moonlite.h @@ -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 From 1bcd6269dde102a789be1a712582179db478b947 Mon Sep 17 00:00:00 2001 From: Huib Wouters Date: Thu, 22 Feb 2024 17:03:19 +0100 Subject: [PATCH 2/2] Added the :GC# command to retreive the stored temperature coefficient from my focuser --- drivers/focuser/moonlite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/focuser/moonlite.cpp b/drivers/focuser/moonlite.cpp index 60822fabd4..1f574ddefb 100644 --- a/drivers/focuser/moonlite.cpp +++ b/drivers/focuser/moonlite.cpp @@ -215,7 +215,7 @@ bool MoonLite::readTemperatureCoefficient() uint8_t coefficient = 0; int rc = sscanf(res, "%hhX", &coefficient); if (rc > 0) - // Signed HEX two digits + // Signed HEX of two digits TemperatureSettingNP[1].setValue(static_cast(coefficient) / 2.0); else {