Instrument Neutral Distributed Interface INDI 2.2.5
integra.h
Go to the documentation of this file.
1/*
2 Gemini Telescope Design Integra85 Focusing Rotator.
3 Copyright (C) 2017 Hans Lambermont
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#pragma once
21
22#include "indifocuser.h"
24
26{
27 public:
28
30
32
33 // these are used for sanity checks only
34 const int wellKnownIntegra85FocusMax = 188600;
35 const int wellKnownIntegra85RotateMax = 61802;
36
44
45 Integra();
46 virtual ~Integra() = default;
47
48 virtual bool Handshake() override;
49 const char * getDefaultName() override;
50 virtual bool initProperties() override;
51 virtual bool updateProperties() override;
52 virtual bool ISNewNumber (const char * dev, const char * name, double values[], char * names[], int n) override;
53 virtual bool ISNewSwitch (const char * dev, const char * name, ISState * states, char * names[], int n) override;
54
55 protected:
56 // Focuser
57 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
58 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
59 virtual bool AbortFocuser() override;
60
61 // Rotator
62 virtual IPState MoveRotator(double angle) override;
63 virtual bool AbortRotator() override;
64 virtual bool SyncRotator(double angle) override;
65 virtual bool ReverseRotator(bool enabled) override;
66
67 // Misc.
68 virtual bool saveConfigItems(FILE *fp) override;
69 virtual void TimerHit() override;
70
71 private:
72 bool genericIntegraCommand(const char *name, const char *cmd, const char *expectStart, char *returnValueString);
73 bool integraGetCommand(const char *name, int command, char *returnValueString );
74 bool integraMotorGetCommand(const char *name, int command, MotorType motor, char *returnValueString);
75 bool integraMotorSetCommand(const char *name, int command, MotorType motor, int value, char *returnValueString);
76 bool getFirmware();
77 bool getFocuserType();
78 bool gotoMotor(MotorType type, int32_t position);
79 bool relativeGotoMotor(MotorType type, int32_t relativePosition);
80 bool getPosition(MotorType type);
81 bool stopMotor(MotorType type);
82 bool isMotorMoving(MotorType type);
83 bool getTemperature();
84 bool findHome();
85 bool abortHome();
86 bool isHomingComplete();
87 void cleanPrint(const char *cmd, char *cleancmd);
88 bool saveToEEPROM();
89 bool getMaxPosition(MotorType type);
90 uint32_t rotatorDegreesToTicks(double angle);
91 double rotatorTicksToDegrees(uint32_t ticks);
92
93 // INumber MaxPositionN[2];
94 INDI::PropertyNumber MaxPositionNP {2};
95 enum
96 {
97 FOCUSER,
98 ROTATOR
99 };
100
101 INDI::PropertyNumber SensorNP {1};
102 enum { SENSOR_TEMPERATURE };
103
104 INDI::PropertySwitch FindHomeSP {3};
105
106 INDI::PropertyNumber RotatorAbsPosNP {1};
107
108 double lastTemperature { 0 };
109 int timeToReadTemperature = 0;
110 double rotatorTicksPerDegree { 0 };
111 double rotatorDegreesPerTick = 0.0;
112 uint32_t lastFocuserPosition { 0 };
113 bool haveReadFocusPositionAtLeastOnce = false;
114 uint32_t lastRotatorPosition { 0 };
115 bool haveReadRotatorPositionAtLeastOnce = false;
116 uint32_t targetPosition { 0 };
117 FirmwareVersion firmwareVersion { VERSION_20170125 };
118};
Integra()
Definition integra.cpp:80
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Definition integra.cpp:89
const char * getDefaultName() override
Definition integra.cpp:194
virtual bool AbortRotator() override
AbortRotator Abort all motion.
Definition integra.cpp:848
virtual bool ReverseRotator(bool enabled) override
ReverseRotator Reverse the direction of the rotator. CW is usually the normal direction,...
Definition integra.cpp:895
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 integra.cpp:481
INTEGRA_HOMING_STATE
Definition integra.h:38
@ HOMING_START
Definition integra.h:40
@ HOMING_ABORT
Definition integra.h:41
@ HOMING_COUNT
Definition integra.h:42
@ HOMING_IDLE
Definition integra.h:39
FirmwareVersion
Definition integra.h:31
@ VERSION_20171220
Definition integra.h:31
@ VERSION_20170125
Definition integra.h:31
virtual IPState MoveRotator(double angle) override
MoveRotator Go to specific angle.
Definition integra.cpp:830
const int wellKnownIntegra85RotateMax
Definition integra.h:35
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 integra.cpp:418
virtual bool SyncRotator(double angle) override
SyncRotator Set current angle as the supplied angle without moving the rotator.
Definition integra.cpp:884
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition integra.cpp:539
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
Definition integra.cpp:503
virtual bool saveConfigItems(FILE *fp) override
Definition integra.cpp:820
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition integra.cpp:518
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
Definition integra.cpp:179
MotorType
Definition integra.h:29
@ MOTOR_FOCUS
Definition integra.h:29
@ MOTOR_ROTATOR
Definition integra.h:29
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
Definition integra.cpp:147
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition integra.cpp:689
virtual ~Integra()=default
const int wellKnownIntegra85FocusMax
Definition integra.h:34
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
uint16_t type
Definition pwc-ioctl.h:0
uint8_t cmd[4]
Definition pwc-ioctl.h:2