Instrument Neutral Distributed Interface INDI 2.2.5
esatto.h
Go to the documentation of this file.
1/*
2 Esatto Focuser
3 Copyright (C) 2022 Jasem Mutlaq
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#include "inditimer.h"
25#include "primalucacommandset.h"
26
27class Esatto : public INDI::Focuser
28{
29 public:
30 Esatto();
31 virtual ~Esatto() override = default;
32
33 const char *getDefaultName() override;
34 virtual bool initProperties() override;
35 virtual bool updateProperties() override;
36 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
37
38 protected:
39 virtual bool Handshake() override;
40 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
41 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
42 virtual bool ReverseFocuser(bool enabled) override;
43 virtual bool AbortFocuser() override;
44 virtual void TimerHit() override;
45 virtual bool SetFocuserBacklash(int32_t steps) override;
46
47 private:
48 bool Ack();
49
50 bool updateTemperature();
51 bool updatePosition();
52 bool updateVoltageIn();
53 bool updateMaxLimit();
54
55 void setConnectionParams();
56 bool initCommandSet();
57
58 bool getStartupValues();
59 void hexDump(char * buf, const char * data, int size);
60
61 uint16_t m_TemperatureCounter { 0 };
62 double m_LastTemperature[2] = {-1, -1};
63 double m_LastVoltage[2] = {-1, -1};
64
65 INDI::PropertyNumber TemperatureNP {2};
66 enum
67 {
68 TEMPERATURE_EXTERNAL,
69 TEMPERATURE_MOTOR,
70 };
71
72 INDI::PropertyText FirmwareTP {2};
73 enum
74 {
75 FIRMWARE_SN,
76 FIRMWARE_VERSION,
77 };
78
79 INDI::PropertyNumber VoltageNP {2};
80 enum
81 {
82 VOLTAGE_12V,
83 VOLTAGE_USB
84 };
85
86 INDI::PropertySwitch FastMoveSP {3};
87 enum
88 {
89 FASTMOVE_IN,
90 FASTMOVE_OUT,
91 FASTMOVE_STOP
92 };
93
94 std::unique_ptr<PrimalucaLabs::Esatto> m_Esatto;
95 static constexpr uint8_t TEMPERATURE_FREQUENCY {10};
96 static constexpr double MEASUREMENT_THRESHOLD {0.1};
97};
const char * getDefaultName() override
Definition esatto.cpp:155
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 esatto.cpp:223
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition esatto.cpp:284
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition esatto.cpp:270
Esatto()
Definition esatto.cpp:34
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
Definition esatto.cpp:259
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
Definition esatto.cpp:414
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Definition esatto.cpp:46
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
Definition esatto.cpp:139
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition esatto.cpp:295
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
Definition esatto.cpp:372
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
Definition esatto.cpp:108
virtual ~Esatto() override=default
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158