Instrument Neutral Distributed Interface INDI 2.2.5
dmfc.h
Go to the documentation of this file.
1/*
2 Pegasus DMFC Focuser
3 Copyright (C) 2017 Jasem Mutlaq ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21#pragma once
22
23#include "indifocuser.h"
24
25class DMFC : public INDI::Focuser
26{
27 public:
28 DMFC();
29 virtual ~DMFC() override = default;
30
31 virtual bool Handshake() override;
32 const char *getDefaultName() override;
33 virtual void ISGetProperties(const char *dev) override;
34 virtual bool initProperties() override;
35 virtual bool updateProperties() override;
36 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
37 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
38
39 protected:
40 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
41 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
42 virtual bool AbortFocuser() override;
43 virtual void TimerHit() override;
44
45 virtual bool SyncFocuser(uint32_t ticks) override;
46 virtual bool ReverseFocuser(bool enabled) override;
47 virtual bool SetFocuserBacklash(int32_t steps) override;
48 virtual bool SetFocuserBacklashEnabled(bool enabled) override;
49 virtual bool saveConfigItems(FILE *fp) override;
50
51 private:
52 bool updateFocusParams();
53 bool moveAbsolute(uint32_t newPosition);
54 bool moveRelative(int relativePosition);
55 bool setMaxSpeed(uint16_t speed);
56 bool setLedEnabled(bool enable);
57 bool setEncodersEnabled(bool enable);
58 bool setMotorType(uint8_t type);
59 bool ack();
60 void ignoreResponse();
61
62 uint32_t currentPosition { 0 };
63 uint32_t targetPosition { 0 };
64 bool isMoving = false;
65
66 // Temperature probe
67 INDI::PropertyNumber TemperatureNP {1};
68
69 // Motor Mode
70 INDI::PropertySwitch MotorTypeSP {2};
71 enum { MOTOR_DC, MOTOR_STEPPER };
72
73 // Rotator Encoders
74 INDI::PropertySwitch EncoderSP {2};
75 enum { ENCODERS_ON, ENCODERS_OFF };
76
77 // LED
78 INDI::PropertySwitch LEDSP {2};
79 enum { LED_OFF, LED_ON };
80
81 // Maximum Speed
82 INDI::PropertyNumber MaxSpeedNP {1};
83
84 // Firmware Version
85 INDI::PropertyText FirmwareVersionTP {1};
86};
Definition dmfc.h:26
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
Definition dmfc.cpp:230
virtual ~DMFC() override=default
virtual bool SetFocuserBacklashEnabled(bool enabled) override
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
Definition dmfc.cpp:738
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition dmfc.cpp:796
virtual void ISGetProperties(const char *dev) override
Handles client requests for property definitions for this device or all devices. Delegates to the bas...
Definition dmfc.cpp:115
virtual bool saveConfigItems(FILE *fp) override
Definition dmfc.cpp:842
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition dmfc.cpp:790
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
Definition dmfc.cpp:637
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
Definition dmfc.cpp:776
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition dmfc.cpp:824
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
Definition dmfc.cpp:138
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
Definition dmfc.cpp:162
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...
Definition dmfc.cpp:352
DMFC()
Definition dmfc.cpp:39
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...
Definition dmfc.cpp:302
const char * getDefaultName() override
Definition dmfc.cpp:180
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
Definition dmfc.cpp:713
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Definition dmfc.cpp:52
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
uint16_t type
Definition pwc-ioctl.h:0