Instrument Neutral Distributed Interface INDI 2.2.5
pyxis.h
Go to the documentation of this file.
1/*
2 Optec Pyrix Rotator
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 "indirotator.h"
24#include "string.h"
25
26class Pyxis : public INDI::Rotator
27{
28 public:
29
30 Pyxis();
31 virtual ~Pyxis() = default;
32
33 virtual bool Handshake() override;
34 const char * getDefaultName() override;
35 virtual bool initProperties() override;
36 virtual bool updateProperties() override;
37
38 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
39 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
40
41 protected:
42 // Rotator Overrides
43 virtual IPState HomeRotator() override;
44 virtual IPState MoveRotator(double angle) override;
45 virtual bool ReverseRotator(bool enabled) override;
46
47 // Misc.
48 virtual void TimerHit() override;
49
50 private:
51 // Check if connection is OK
52 bool Ack();
53 bool isMotionComplete();
54 bool getPA(uint16_t &PA);
55 int getReverseStatus();
56 bool setSteppingMode(uint8_t mode);
57 bool setRotationRate(uint8_t rate);
58 bool sleepController();
59 bool wakeupController();
60 std::string getVersion() ;
61
62 void queryParams();
63
64 // Rotation Rate
65 INDI::PropertyNumber RotationRateNP {1};
66
67 // Stepping
68 INDI::PropertySwitch SteppingSP {2};
69 enum { FULL_STEP, HALF_STEP};
70
71 // Power
72 INDI::PropertySwitch PowerSP {2};
73 enum { POWER_SLEEP, POWER_WAKEUP};
74
75 // Firmware version; tells us if 2 inch or 3 inch device
76 INDI::PropertyText FirmwareTP {1};
77 INDI::PropertyText ModelTP {1};
78
79 uint16_t targetPA = {0};
80
81 // Direction of rotation; 1->angle increasing; -1->angle decreasing
82 int direction = 1 ;
83};
Definition pyxis.h:27
virtual IPState HomeRotator() override
HomeRotator Go to home position.
Definition pyxis.cpp:440
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition pyxis.cpp:106
Pyxis()
Definition pyxis.cpp:49
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
Definition pyxis.cpp:57
const char * getDefaultName() override
Definition pyxis.cpp:101
virtual IPState MoveRotator(double angle) override
MoveRotator Go to specific angle.
Definition pyxis.cpp:461
virtual ~Pyxis()=default
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition pyxis.cpp:223
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition pyxis.cpp:246
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition pyxis.cpp:525
virtual bool ReverseRotator(bool enabled) override
ReverseRotator Reverse the direction of the rotator. CW is usually the normal direction,...
Definition pyxis.cpp:502
virtual bool Handshake() override
perform handshake with device to check communication
Definition pyxis.cpp:92
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158