13static std::unique_ptr<PACSimulator> simulator(
new PACSimulator());
36 CorrectionGainNP[0].
fill(
"GAIN",
"Gain (%)",
"%.0f", 0, 100, 10, 100);
38 CorrectionGainNP.
load();
65 CorrectionGainNP.
update(values, names, n);
67 CorrectionGainNP.
apply();
92 CorrectionGainNP.
save(fp);
103 LOG_INFO(
"Alignment correction motion aborted.");
114 LOGF_INFO(
"Simulator speed set to %u (move duration will be %.0f s).",
115 speed,
SpeedNP[0].getMax() + 1 - speed);
121 LOGF_INFO(
"Azimuth direction reverse %s.", enabled ?
"enabled" :
"disabled");
127 LOGF_INFO(
"Altitude direction reverse %s.", enabled ?
"enabled" :
"disabled");
138 const double duration =
SpeedNP[0].getMax() + 1 -
SpeedNP[0].getValue();
139 const double gain = CorrectionGainNP[0].getValue() / 100.0;
140 const double effective = degrees * gain;
141 const char *direction = (effective >= 0) ?
"East" :
"West";
143 LOGF_INFO(
"Simulating azimuth move: %.4f deg %s (duration %.0f s, speed %.0f, gain %.0f%%).",
144 std::abs(effective), direction, duration,
SpeedNP[0].getValue(), CorrectionGainNP[0].getValue());
150 LOGF_INFO(
"Azimuth move complete: %.4f deg %s.", std::abs(effective), (effective >= 0) ?
"East" :
"West");
153 if (m_MovingAxes <= 0)
169 const double duration =
SpeedNP[0].getMax() + 1 -
SpeedNP[0].getValue();
170 const double gain = CorrectionGainNP[0].getValue() / 100.0;
171 const double effective = degrees * gain;
172 const char *direction = (effective >= 0) ?
"North" :
"South";
174 LOGF_INFO(
"Simulating altitude move: %.4f deg %s (duration %.0f s, speed %.0f, gain %.0f%%).",
175 std::abs(effective), direction, duration,
SpeedNP[0].getValue(), CorrectionGainNP[0].getValue());
181 LOGF_INFO(
"Altitude move complete: %.4f deg %s.", std::abs(effective), (effective >= 0) ?
"North" :
"South");
184 if (m_MovingAxes <= 0)
const char * getDeviceName() const
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool initProperties()
Initialize properties initial state and value. The child class must implement this function.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
bool saveConfigItems(FILE *fp)
saveConfigItems Save PAC interface properties to config file. Call this from your driver's saveConfig...
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process PAC number properties.
INDI::PropertyNumber SpeedNP
void initProperties(const char *group)
initProperties Initialize PAC properties. Call this from your driver's initProperties().
void SetCapability(uint32_t cap)
SetCapability sets the PAC device capabilities. Call this in the driver constructor.
INDI::PropertyNumber ManualAdjustmentNP
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process PAC switch properties.
bool updateProperties()
updateProperties Define or delete properties based on connection state. Call this from your driver's ...
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
bool load()
load Attempt to load property values from configuration file.
void save(FILE *f) const
save Save property to configuration file.
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
static void singleShot(int msec, const std::function< void()> &callback)
This static function calls a the given function after a given time interval.
Provides interface to implement automated polar alignment correction (PAC).
virtual bool ReverseAZ(bool enabled) override
ReverseAZ Reverse the direction of azimuth axis movement.
virtual bool ReverseALT(bool enabled) override
ReverseALT Reverse the direction of altitude axis movement.
virtual bool SetPACSpeed(uint16_t speed) override
SetPACSpeed Set the motor speed used for axis movements.
bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState MoveALT(double degrees) override
MoveALT Move the altitude axis by the given number of degrees.
virtual IPState MoveAZ(double degrees) override
Move the azimuth axis by the given number of degrees.
virtual bool AbortMotion() override
AbortMotion Abort all axis motion immediately.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
#define LOGF_INFO(fmt,...)