Instrument Neutral Distributed Interface INDI 2.2.5
moonlite_dro.h
Go to the documentation of this file.
1/*
2 Moonlite DRO Dual Focuser
3 Copyright (C) 2018 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
26{
27 public:
28 MoonLiteDRO(int ID);
29
31
32 const char *getDefaultName() override;
33 virtual bool initProperties() override;
34 virtual bool updateProperties() override;
35 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
36 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
37
38 void remoteDisconnect();
40 {
41 return PortFD;
42 }
43
44 protected:
45 virtual bool Connect() override;
46 virtual bool Disconnect() override;
47 virtual bool Handshake() override;
48 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
49 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
50 virtual bool AbortFocuser() override;
51 virtual void TimerHit() override;
52 virtual bool saveConfigItems(FILE *fp) override;
53 virtual bool SyncFocuser(uint32_t ticks) override;
54
55 private:
56 void GetFocusParams();
57 bool updateStepMode();
58 bool updateStepDelay();
59 bool updateTemperature();
60 bool updatePosition();
61 bool isMoving();
62 bool Ack();
63
64 bool gotoAbsPosition(uint32_t position);
65 bool setStepMode(FocusStepMode mode);
66 bool setStepDelay(uint8_t delay);
67 bool setTemperatureCalibration(double calibration);
68 bool setTemperatureCoefficient(double coefficient);
69 bool setTemperatureCompensation(bool enable);
70
71 double targetPos { 0 };
72 double lastPos { 0 };
73 double lastTemperature { 0 };
74
75 ISwitch StepModeS[2];
76 ISwitchVectorProperty StepModeSP;
77
78 INumber StepDelayN[1];
79 INumberVectorProperty StepDelayNP;
80
81 INumber TemperatureSettingN[2];
82 INumberVectorProperty TemperatureSettingNP;
83
84 INumber TemperatureN[1];
85 INumberVectorProperty TemperatureNP;
86
87 ISwitch TemperatureCompensateS[2];
88 ISwitchVectorProperty TemperatureCompensateSP;
89
90 const uint8_t m_ID;
91 static constexpr const uint8_t DRO_CMD = 16;
92 static constexpr const char *SETTINGS_TAB = "Settings";
93};
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
int getPortFD()
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool saveConfigItems(FILE *fp) override
const char * getDefaultName() override
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool Disconnect() override
Disconnect from device.
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
void remoteDisconnect()
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
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 IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
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 IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
One number descriptor.
One switch descriptor.
Number vector property descriptor.
Definition indiapi.h:317
Switch vector property descriptor.
Definition indiapi.h:365