34#define STEPMODE_FULL 1
35#define STEPMODE_HALF 2
36#define STEPMODE_QUARTER 4
37#define STEPMODE_EIGHTH 8
38#define STEPMODE_SIXTEENTH 16
39#define STEPMODE_THIRTYSECOND 32
40#define STEPMODE_SIXTYFOUR 64
41#define STEPMODE_ONEHUNDREDTWENTYEIGHT 128
42#define STEPMODE_TWOHUNDREDFIFTYSIX 256
44#define CDRIVER_VERSION_MAJOR 1
45#define CDRIVER_VERSION_MINOR 0
69 virtual bool ISNewNumber(
const char * dev,
const char * name,
double values[],
char * names[],
int n)
override;
70 virtual bool ISNewSwitch(
const char * dev,
const char * name,
ISState * states,
char * names[],
int n)
override;
127 bool sendCommand(
const char *
cmd,
char * res =
nullptr);
130 void getStartupValues();
136 bool readTempProbeAvailability();
139 bool readTemperature();
142 bool readTempCompensateEnable();
145 bool readTemperatureCoefficient();
159 bool readCoilPowerState();
161 bool readReverseDirection();
163 bool readDisplayVisible();
165 bool readBacklashInEnabled();
166 bool readBacklashOutEnabled();
168 bool readBacklashInSteps();
169 bool readBacklashOutSteps();
171 bool setBacklashInSteps(int16_t steps);
172 bool setBacklashOutSteps(int16_t steps);
174 bool setBacklashInEnabled(
bool enabled);
175 bool setBacklashOutEnabled(
bool enabled);
181 bool setSpeed(uint16_t speed);
187 bool setCoilPowerState(
CoilPower enable);
189 bool setTemperatureCelsius();
191 bool setTemperatureCalibration(
double calibration);
193 bool setTemperatureCoefficient(
double coefficient);
195 bool setTemperatureCompensation(
bool enable);
197 void timedMoveCallback();
199 double targetPos { 0 }, lastPos { 0 }, lastTemperature { 0 };
201 int msleep(
long milliseconds);
203 void clearbufferonerror();
222 INumber TemperatureSettingN[1];
226 ISwitch TemperatureCompensateS[2];
253 static const uint8_t ML_RES { 32 };
256 static const char ML_DEL {
'#' };
259 pthread_mutex_t cmdlock;
262 static const uint8_t MYFOCUSERPRO2_SERIAL_TIMEOUT { 5 };
263 static const uint8_t MYFOCUSERPRO2_TCPIP_TIMEOUT { 10 };
264 static const long MYFOCUSERPRO2_SMALL_DELAY { 50 };
265 static const long MYFOCUSERPRO2_RECOVER_DELAY { 200 };
268 static constexpr const uint8_t GET_TEMPERATURE_FREQ{ 10 };
269 uint16_t Temperature_Counter { 0 };
272 static constexpr const uint8_t GET_POSITION_FREQ{ 1 };
273 uint16_t Position_Counter { 0 };
275 static constexpr const char *SETTINGS_TAB {
"Settings"};
virtual bool saveConfigItems(FILE *fp) override
virtual ~MyFocuserPro2() override=default
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration) override
MoveFocuser Move focuser in a specific direction and speed for period of time.
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
@ TEMP_COMPENSATE_DISABLE
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Processes incoming new switch states from the client for this device. Handles updates to FocuserInter...
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set the supplied position as the current focuser position.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool SetFocuserSpeed(int speed) override
SetFocuserSpeed Set Focuser speed.
virtual bool SetFocuserMaxPosition(uint32_t ticks) override
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveRelFocuser Move focuser for a relative amount of ticks in a specific direction.
virtual bool Handshake() override
Handshake Try to communicate with Focuser and see if there is a valid response.
static void timedMoveHelper(void *context)
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
@ ONEHUNDREDTWENTYEIGHT_STEP
@ TWOHUNDREDFIFTYSIX_STEP
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveAbsFocuser Move to an absolute target position.
const char * getDefaultName() override
Number vector property descriptor.
Switch vector property descriptor.