Instrument Neutral Distributed Interface INDI 2.2.5
askar_waf.h
Go to the documentation of this file.
1/*
2 Askar-WAF Focuser
3 Copyright (C) 2026 Jiaxing Ruixing Optical Instrument Co., Ltd.
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
18 USA
19
20*/
21
22#pragma once
23
24#include "indifocuser.h"
25
26class AskarWAF : public INDI::Focuser {
27public:
28 AskarWAF();
29 virtual ~AskarWAF() override = default;
30
31 const char *getDefaultName() override;
32 virtual bool initProperties() override;
33 virtual bool updateProperties() override;
34
35protected:
41 virtual bool Handshake() override;
42
43 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
44 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
45 virtual bool AbortFocuser() override;
46 virtual bool SyncFocuser(uint32_t ticks) override;
47 virtual bool ReverseFocuser(bool enabled) override;
48 virtual bool SetFocuserBacklash(int32_t steps) override;
49 virtual bool SetFocuserBacklashEnabled(bool enabled) override;
50 virtual bool SetFocuserMaxPosition(uint32_t ticks) override;
51 virtual void TimerHit() override;
52
53private:
65 bool sendCommand(const char *cmd, char *res = nullptr, bool silent = false);
66
67 bool readPosition();
68 bool readMaxPosition();
69 bool readBacklash();
70 bool readReverse();
77 bool isMoving(bool *ok = nullptr);
78
79 uint32_t lastPosition{0};
80 uint8_t m_MotionQueryFailures{0};
81
82 // Firmware version & model name, read once at connection time
83 INDI::PropertyText FirmwareVersionTP{2};
84 enum { VERSION, MODEL };
85
86 // Askar-WAF response buffer size (includes room for trailing '\0')
87 static const uint8_t WAF_RES{32};
88 // Askar-WAF frame delimiter
89 static const char WAF_DEL{'#'};
90 // Askar-WAF read timeout in seconds
91 static const uint8_t WAF_TIMEOUT{3};
92 // Consecutive FQ# failures before aborting a busy move as IPS_ALERT
93 static const uint8_t WAF_MOTION_QUERY_MAX_FAILURES{5};
94};
virtual bool SetFocuserMaxPosition(uint32_t ticks) override
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
virtual bool Handshake() override
Handshake Try to communicate with the focuser and read its firmware version.
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool SetFocuserBacklashEnabled(bool enabled) override
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
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....
Definition askar_waf.cpp:89
const char * getDefaultName() override
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Definition askar_waf.cpp:45
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
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 IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual ~AskarWAF() override=default
IPState
Property state.
Definition indiapi.h:158
uint8_t cmd[4]
Definition pwc-ioctl.h:2