Instrument Neutral Distributed Interface INDI 2.2.5
robofocus.h
Go to the documentation of this file.
1/*
2 RoboFocus
3 Copyright (C) 2006 Markus Wildi ([email protected])
4 2011 Jasem Mutlaq ([email protected])
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22#pragma once
23
24#include "indifocuser.h"
25
27{
28 public:
29 RoboFocus();
30 virtual ~RoboFocus() override = default;
31
32 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
33 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
34
35 protected:
36 virtual bool Handshake() override;
37 const char *getDefaultName() override;
38 virtual bool initProperties() override;
39 virtual bool updateProperties() override;
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 virtual bool saveConfigItems(FILE *fp) override;
45 virtual bool SyncFocuser(uint32_t ticks) override;
46 virtual bool SetFocuserBacklash(int32_t steps) override;
47
48 private:
49 unsigned char CheckSum(char *rf_cmd);
50 unsigned char CalculateSum(const char *rf_cmd);
51 int SendCommand(char *rf_cmd);
52 int ReadResponse(char *buf);
53 void GetFocusParams();
54
55 int updateRFPosition(double *value);
56 int updateRFTemperature(double *value);
57 int updateRFBacklash(double *value);
58 int updateRFFirmware(char *rf_cmd);
59 int updateRFMotorSettings(double *duty, double *delay, double *ticks);
60 int updateRFPositionRelativeInward(double value);
61 int updateRFPositionRelativeOutward(double value);
62 int updateRFPositionAbsolute(double value);
63 int updateRFPowerSwitches(int s, int new_sn, int *cur_s1LL, int *cur_s2LR, int *cur_s3RL, int *cur_s4RR);
64 int updateRFMaxPosition(double *value);
65 int updateRFSetPosition(const double *value);
66
67 int ReadUntilComplete(char *buf, int timeout);
68
69 int timerID { -1 };
70 double targetPos { 0 };
71 double simulatedTemperature { 0 };
72 double simulatedPosition { 0 };
73
74 INumber TemperatureN[1];
75 INumberVectorProperty TemperatureNP;
76
77 INumber SettingsN[3];
78 INumberVectorProperty SettingsNP;
79
80 ISwitch PowerSwitchesS[4];
81 ISwitchVectorProperty PowerSwitchesSP;
82
83 INumber MinMaxPositionN[2];
84 INumberVectorProperty MinMaxPositionNP;
85
86 INumber MaxTravelN[1];
87 INumberVectorProperty MaxTravelNP;
88
89 INumber SetRegisterPositionN[1];
90 INumberVectorProperty SetRegisterPositionNP;
91
92 INumber RelMovementN[1];
93 INumberVectorProperty RelMovementNP;
94
95 INumber AbsMovementN[1];
96 INumberVectorProperty AbsMovementNP;
97
98 // INumber SetBacklashN[1];
99 // INumberVectorProperty SetBacklashNP;
100};
virtual bool saveConfigItems(FILE *fp) override
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
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 SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
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....
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Definition robofocus.cpp:54
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
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 ~RoboFocus() override=default
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
const char * getDefaultName() override
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