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

1. Solved the problem of temperature not refreshing; 2. Modified the upper limit of FocusMaxPos to 2e6. #904

Merged
merged 1 commit into from
Mar 8, 2024
Merged
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: 18 additions & 6 deletions indi-qhy/qhy_focuser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ bool QFocuser::initProperties()
FocusAbsPosN[0].value = 0;
FocusAbsPosN[0].step = 1000;

FocusMaxPosN[0].max = 2e6;

FocusSpeedMin = 0;
FocusSpeedMax = 8;

Expand Down Expand Up @@ -268,7 +270,7 @@ int QFocuser::ReadResponse(char *buf)
}
else if (cmd_id == 1)
{
LOGF_INFO("<RES> %s", cmd_json.dump().c_str());
LOGF_DEBUG("<RES> %s", cmd_json.dump().c_str());
if (cmd_json.find("id") != cmd_json.end() && cmd_json.find("version") != cmd_json.end() && cmd_json.find("bv") != cmd_json.end())
{
cmd_version = cmd_json["version"];
Expand Down Expand Up @@ -381,15 +383,15 @@ bool QFocuser::Handshake()
FOCUSVersionNP[0].setValue(cmd_version);
BOARDVersionNP[0].setValue(cmd_version_board);

LOGF_INFO("FOCUSVersionNP: %d", FOCUSVersionNP[0].getValue());
LOGF_INFO("BOARDVersionNP: %d", BOARDVersionNP[0].getValue());
LOGF_DEBUG("FOCUSVersionNP: %d", FOCUSVersionNP[0].getValue());
LOGF_DEBUG("BOARDVersionNP: %d", BOARDVersionNP[0].getValue());

updateTemperature();

if(cmd_voltage == 0)
{
std::string command_ = create_cmd(16, true, 0);
LOGF_INFO("<CMD> %s", command_.c_str());
LOGF_DEBUG("<CMD> %s", command_.c_str());
ret_chk = SendCommand(const_cast<char *>(command_.c_str()));

if (ret_chk < 0)
Expand Down Expand Up @@ -741,14 +743,14 @@ int QFocuser::updateTemperature()
auto ret_chk = SendCommand(const_cast<char *>(command.c_str()));
if (ret_chk < 0)
{
LOGF_ERROR("updateTemperature error %d", ret_chk);
LOGF_ERROR("updateTemperature Send error %d", ret_chk);
return false;
}

ret_chk = ReadResponse(ret_cmd);
if (ret_chk < 0)
{
LOGF_ERROR("updateTemperature error %d", ret_chk);
LOGF_ERROR("updateTemperature Read error %d", ret_chk);
return false;
}

Expand Down Expand Up @@ -826,6 +828,16 @@ void QFocuser::GetFocusParams()
return;
}

if ((ret = updateTemperature()) < 0)
{
TemperatureNP.setState(IPS_ALERT);
TemperatureChipNP.setState(IPS_ALERT);
LOG_ERROR("Unknown error while reading temperature.");
TemperatureNP.apply();
TemperatureChipNP.apply();
return;
}

FocusAbsPosNP.s = IPS_OK;
IDSetNumber(&FocusAbsPosNP, nullptr);

Expand Down
Loading