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 readTemperature();
139 bool readTempCompensateEnable();
142 bool readTemperatureCoefficient();
156 bool readCoilPowerState();
158 bool readReverseDirection();
160 bool readDisplayVisible();
162 bool readBacklashInEnabled();
163 bool readBacklashOutEnabled();
165 bool readBacklashInSteps();
166 bool readBacklashOutSteps();
168 bool setBacklashInSteps(int16_t steps);
169 bool setBacklashOutSteps(int16_t steps);
171 bool setBacklashInEnabled(
bool enabled);
172 bool setBacklashOutEnabled(
bool enabled);
178 bool setSpeed(uint16_t speed);
184 bool setCoilPowerState(
CoilPower enable);
186 bool setTemperatureCelsius();
188 bool setTemperatureCalibration(
double calibration);
190 bool setTemperatureCoefficient(
double coefficient);
192 bool setTemperatureCompensation(
bool enable);
194 void timedMoveCallback();
196 double targetPos { 0 }, lastPos { 0 }, lastTemperature { 0 };
198 int msleep(
long milliseconds);
200 void clearbufferonerror();
219 INumber TemperatureSettingN[1];
223 ISwitch TemperatureCompensateS[2];
250 static const uint8_t ML_RES { 32 };
253 static const char ML_DEL {
'#' };
256 pthread_mutex_t cmdlock;
259 static const uint8_t MYFOCUSERPRO2_SERIAL_TIMEOUT { 5 };
260 static const uint8_t MYFOCUSERPRO2_TCPIP_TIMEOUT { 10 };
261 static const long MYFOCUSERPRO2_SMALL_DELAY { 50 };
262 static const long MYFOCUSERPRO2_RECOVER_DELAY { 200 };
265 static constexpr
const uint8_t GET_TEMPERATURE_FREQ{ 10 };
266 uint16_t Temperature_Counter { 0 };
269 static constexpr
const uint8_t GET_POSITION_FREQ{ 1 };
270 uint16_t Position_Counter { 0 };
272 static constexpr
const char *SETTINGS_TAB {
"Settings"};
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Focuser Presets in the configuration file
virtual ~MyFocuserPro2() override=default
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
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
Process the client newNumber command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
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
Initilize properties initial state and value. The child class must implement this function.
@ 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.