bool NFocus::GetFocusParams() { int ret = -1; currentInOutScalar = INOUTSCALAR_READOUT; if ((ret = updateNFInOutScalar(¤tInOutScalar)) < 0) { InOutScalarNP.s = IPS_ALERT; IDSetNumber(&InOutScalarNP, "Unknown error while reading Nfocus direction tick scalar"); return false; } InOutScalarNP.s = IPS_OK; IDSetNumber(&InOutScalarNP, nullptr); if ((ret = updateNFTemperature(¤tTemperature)) < 0) { TemperatureNP.s = IPS_ALERT; IDSetNumber(&TemperatureNP, "Unknown error while reading Nfocus temperature"); return false; } TemperatureNP.s = IPS_OK; IDSetNumber(&TemperatureNP, nullptr); currentOnTime = currentOffTime = currentFastDelay = 0; if ((ret = updateNFMotorSettings(¤tOnTime, ¤tOffTime, ¤tFastDelay)) < 0) { SettingsNP.s = IPS_ALERT; IDSetNumber(&SettingsNP, "Unknown error while reading Nfocus motor settings"); return false; } SettingsNP.s = IPS_OK; IDSetNumber(&SettingsNP, nullptr); currentMaxTravel = MAXTRAVEL_READOUT; if ((ret = setNFMaxPosition(¤tMaxTravel)) < 0) { MaxTravelNP.s = IPS_ALERT; IDSetNumber(&MaxTravelNP, "Unknown error while reading Nfocus maximum travel"); return false; } MaxTravelNP.s = IPS_OK; IDSetNumber(&MaxTravelNP, nullptr); return true; }
void NFocus::GetFocusParams () { int ret = -1 ; int cur_s1LL=0 ; int cur_s2LR=0 ; int cur_s3RL=0 ; int cur_s4RR=0 ; if((ret= updateNFPosition(¤tPosition)) < 0) { FocusAbsPosNP.s = IPS_ALERT; IDSetNumber(&FocusAbsPosNP, "Unknown error while reading Nfocus position: %d", ret); return; } FocusAbsPosNP.s = IPS_OK; IDSetNumber(&FocusAbsPosNP, NULL); FocusAbsPosN[0].value = currentPosition; IDSetNumber(&FocusAbsPosNP, NULL); currentInOutScalar= INOUTSCALAR_READOUT ; if(( ret= updateNFInOutScalar(¤tInOutScalar)) < 0) { InOutScalarNP.s = IPS_ALERT; IDSetNumber(&InOutScalarNP, "Unknown error while reading Nfocus direction tick scalar"); return; } InOutScalarNP.s = IPS_OK; IDSetNumber(&InOutScalarNP, NULL); if(( ret= updateNFTemperature(¤tTemperature)) < 0) { TemperatureNP.s = IPS_ALERT; IDSetNumber(&TemperatureNP, "Unknown error while reading Nfocus temperature"); return; } TemperatureNP.s = IPS_OK; IDSetNumber(&TemperatureNP, NULL); currentBacklash= BACKLASH_READOUT ; if(( ret= updateNFBacklash(¤tBacklash)) < 0) { SetBacklashNP.s = IPS_ALERT; IDSetNumber(&SetBacklashNP, "Unknown error while reading Nfocus backlash"); return; } SetBacklashNP.s = IPS_OK; IDSetNumber(&SetBacklashNP, NULL); currentOnTime= currentOffTime= currentFastDelay=0 ; if(( ret= updateNFMotorSettings(¤tOnTime, ¤tOffTime, ¤tFastDelay )) < 0) { SettingsNP.s = IPS_ALERT; IDSetNumber(&SettingsNP, "Unknown error while reading Nfocus motor settings"); return; } SettingsNP.s = IPS_OK; IDSetNumber(&SettingsNP, NULL); currentMaxTravel= MAXTRAVEL_READOUT ; if(( ret= updateNFMaxPosition(¤tMaxTravel)) < 0) { MaxTravelNP.s = IPS_ALERT; IDSetNumber(&MaxTravelNP, "Unknown error while reading Nfocus maximum travel"); return; } MaxTravelNP.s = IPS_OK; IDSetNumber(&MaxTravelNP, NULL); }