19 #include "indifocuser.h"
23 INDI::Focuser::Focuser()
27 INDI::Focuser::~Focuser()
35 IUFillNumber(&FocusSpeedN[0],
"FOCUS_SPEED_VALUE",
"Focus Speed",
"%3.0f",0.0,255.0,1.0,255.0);
38 IUFillNumber(&FocusTimerN[0],
"FOCUS_TIMER_VALUE",
"Focus Timer",
"%4.0f",0.0,1000.0,10.0,1000.0);
44 IUFillSwitchVector(&FocusMotionSP,FocusMotionS,2,getDeviceName(),
"FOCUS_MOTION",
"Direction",MAIN_CONTROL_TAB,
IP_RW,
ISR_1OFMANY,60,
IPS_OK);
47 IUFillNumber(&FocusAbsPosN[0],
"FOCUS_ABSOLUTE_POSITION",
"Ticks",
"%4.0f",0.0,100000.0,1000.0,50000.0);
50 IUFillNumber(&FocusRelPosN[0],
"RELATIVE_ABSOLUTE_POSITION",
"Ticks",
"%4.0f",0.0,100000.0,1000.0,50000.0);
71 defineSwitch(&FocusMotionSP);
72 defineNumber(&FocusSpeedNP);
73 defineNumber(&FocusTimerNP);
76 deleteProperty(FocusMotionSP.name);
77 deleteProperty(FocusSpeedNP.name);
78 deleteProperty(FocusTimerNP.name);
87 if(strcmp(dev,getDeviceName())==0)
91 if(strcmp(name,
"FOCUS_TIMER")==0)
104 speed=FocusSpeedN[0].value;
105 if(FocusMotionS[0].s==
ISS_ON) dir=FOCUS_INWARD;
106 else dir=FOCUS_OUTWARD;
107 t=FocusTimerN[0].value;
109 if (Move(dir,speed,t) ==
false)
117 if(strcmp(name,
"FOCUS_SPEED")==0)
129 if(strcmp(name,
"ABS_FOCUS_POSITION")==0)
132 int newPos = (int) values[0];
135 if ( (ret = MoveAbs(newPos)) == 0)
139 IDSetNumber(&FocusAbsPosNP,
"Focuser moved to position %d", newPos);
145 IDSetNumber(&FocusAbsPosNP,
"Focuser is moving to position %d", newPos);
151 IDSetNumber(&FocusAbsPosNP,
"Focuser failed to move to new requested position.");
156 if(strcmp(name,
"REL_FOCUS_POSITION")==0)
158 int newPos = (int) values[0];
161 if ( (ret=MoveRel( (FocusMotionS[0].s ==
ISS_ON ? FOCUS_INWARD : FOCUS_OUTWARD), newPos)) == 0)
165 IDSetNumber(&FocusRelPosNP,
"Focuser moved %d steps", newPos);
172 IDSetNumber(&FocusAbsPosNP,
"Focuser is moving %d steps...", newPos);
177 IDSetNumber(&FocusRelPosNP,
"Focuser failed to move to new requested position.");
190 if(strcmp(dev,getDeviceName())==0)
193 if(strcmp(name,
"FOCUS_MOTION")==0)