Instrument Neutral Distributed Interface INDI 2.2.5
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
INDI::PACInterface Class Reference

#include <indipacinterface.h>

Inheritance diagram for INDI::PACInterface:
AvalonUPAS MLAstroRPA OAPA PACSimulator

Public Types

enum  { MANUAL_AZ , MANUAL_ALT }
 
enum  { POSITION_AZ , POSITION_ALT }
 
enum  {
  PAC_HAS_SPEED = 1 << 0 , PAC_CAN_REVERSE = 1 << 1 , PAC_HAS_POSITION = 1 << 2 , PAC_CAN_HOME = 1 << 3 ,
  PAC_HAS_BACKLASH = 1 << 4 , PAC_CAN_SYNC = 1 << 5
}
 PAC capability flags passed to SetCapability(). More...
 

Public Member Functions

uint32_t GetCapability () const
 
void SetCapability (uint32_t cap)
 SetCapability sets the PAC device capabilities. Call this in the driver constructor.
 
bool HasSpeed ()
 
bool CanReverse ()
 
bool HasPosition ()
 
bool CanHome ()
 
bool HasBacklash ()
 
bool CanSync ()
 

Public Attributes

enum INDI::PACInterface:: { ... }  PACCapability
 PAC capability flags passed to SetCapability().
 

Protected Types

enum  { HOME_SET , HOME_GO , HOME_RESET }
 
enum  { SYNC_AZ , SYNC_ALT }
 
enum  { BACKLASH_AZ , BACKLASH_ALT }
 

Protected Member Functions

 PACInterface (DefaultDevice *device)
 
virtual ~PACInterface ()=default
 
virtual IPState MoveAZ (double degrees)
 Move the azimuth axis by the given number of degrees.
 
virtual IPState MoveALT (double degrees)
 MoveALT Move the altitude axis by the given number of degrees.
 
virtual IPState MoveBoth (double azDegrees, double altDegrees)
 MoveBoth Move both axes in a single coordinated operation.
 
virtual bool AbortMotion ()
 AbortMotion Abort all axis motion immediately.
 
virtual bool SetPACSpeed (uint16_t speed)
 SetPACSpeed Set the motor speed used for axis movements.
 
virtual bool ReverseAZ (bool enabled)
 ReverseAZ Reverse the direction of azimuth axis movement.
 
virtual bool ReverseALT (bool enabled)
 ReverseALT Reverse the direction of altitude axis movement.
 
virtual bool SetHome ()
 SetHome Mark the current position as the home (zero) reference.
 
virtual IPState GoHome ()
 GoHome Slew both axes back to the home (0, 0) position.
 
virtual bool ResetHome ()
 ResetHome Clear the stored home reference without moving.
 
virtual bool SyncAZ (double degrees)
 SyncAZ Sync the azimuth position reference to the given value without moving.
 
virtual bool SyncALT (double degrees)
 SyncALT Sync the altitude position reference to the given value without moving.
 
virtual bool SetBacklashEnabled (bool enabled)
 SetBacklashEnabled Enable or disable hardware backlash compensation.
 
virtual bool SetBacklashAZ (int32_t steps)
 SetBacklashAZ Set the azimuth axis backlash compensation value in steps.
 
virtual bool SetBacklashALT (int32_t steps)
 SetBacklashALT Set the altitude axis backlash compensation value in steps.
 
void initProperties (const char *group)
 initProperties Initialize PAC properties. Call this from your driver's initProperties().
 
bool updateProperties ()
 updateProperties Define or delete properties based on connection state. Call this from your driver's updateProperties().
 
bool processSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Process PAC switch properties.
 
bool processNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process PAC number properties.
 
bool saveConfigItems (FILE *fp)
 saveConfigItems Save PAC interface properties to config file. Call this from your driver's saveConfigItems().
 

Protected Attributes

INDI::PropertyNumber ManualAdjustmentNP {2}
 
INDI::PropertySwitch AbortSP {1}
 
INDI::PropertyNumber PositionNP {2}
 
INDI::PropertyNumber SpeedNP {1}
 
INDI::PropertySwitch AZReverseSP {2}
 
INDI::PropertySwitch ALTReverseSP {2}
 
INDI::PropertySwitch HomeSP {3}
 
INDI::PropertyNumber SyncNP {2}
 
INDI::PropertySwitch BacklashSP {2}
 
INDI::PropertyNumber BacklashNP {2}
 

Detailed Description

Definition at line 62 of file indipacinterface.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Indices for the ManualAdjustmentNP number property.

Enumerator
MANUAL_AZ 

Azimuth step in degrees: positive = East, negative = West.

MANUAL_ALT 

Altitude step in degrees: positive = North, negative = South.

Definition at line 66 of file indipacinterface.h.

◆ anonymous enum

anonymous enum

Indices for the PositionNP number property.

Enumerator
POSITION_AZ 

Current azimuth position in degrees.

POSITION_ALT 

Current altitude position in degrees.

Definition at line 73 of file indipacinterface.h.

◆ anonymous enum

anonymous enum

PAC capability flags passed to SetCapability().

Enumerator
PAC_HAS_SPEED 

Device supports variable motor speed.

PAC_CAN_REVERSE 

Device supports reversing axis direction.

PAC_HAS_POSITION 

Device can report current axis position.

PAC_CAN_HOME 

Device supports Set/Return/Reset home.

PAC_HAS_BACKLASH 

Device supports backlash compensation.

PAC_CAN_SYNC 

Device can sync AZ/ALT position reference.

Definition at line 82 of file indipacinterface.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
HOME_SET 
HOME_GO 
HOME_RESET 

Definition at line 399 of file indipacinterface.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
SYNC_AZ 
SYNC_ALT 

Definition at line 408 of file indipacinterface.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
BACKLASH_AZ 
BACKLASH_ALT 

Definition at line 421 of file indipacinterface.h.

Constructor & Destructor Documentation

◆ PACInterface()

PACInterface::PACInterface ( DefaultDevice *  device)
explicitprotected

Definition at line 31 of file indipacinterface.cpp.

◆ ~PACInterface()

virtual INDI::PACInterface::~PACInterface ( )
protectedvirtualdefault

Member Function Documentation

◆ AbortMotion()

bool PACInterface::AbortMotion ( )
protectedvirtual

AbortMotion Abort all axis motion immediately.

The default implementation logs an error and returns false. Drivers that support hardware abort should override this method.

Returns
True if motion was successfully aborted, false otherwise.

Reimplemented in AvalonUPAS, MLAstroRPA, OAPA, and PACSimulator.

Definition at line 385 of file indipacinterface.cpp.

◆ CanHome()

bool INDI::PACInterface::CanHome ( )
inline
Returns
True if the device supports Set/Return/Reset home.

Definition at line 126 of file indipacinterface.h.

◆ CanReverse()

bool INDI::PACInterface::CanReverse ( )
inline
Returns
True if the device supports reversing axis direction.

Definition at line 114 of file indipacinterface.h.

◆ CanSync()

bool INDI::PACInterface::CanSync ( )
inline
Returns
True if the device can sync AZ/ALT position reference.

Definition at line 138 of file indipacinterface.h.

◆ GetCapability()

uint32_t INDI::PACInterface::GetCapability ( ) const
inline
Returns
Current capability bitmask.

Definition at line 93 of file indipacinterface.h.

◆ GoHome()

IPState PACInterface::GoHome ( )
protectedvirtual

GoHome Slew both axes back to the home (0, 0) position.

Only called when PAC_CAN_HOME is set. Default returns IPS_ALERT.

Returns
IPS_OK if completed immediately, IPS_BUSY if in progress, IPS_ALERT on error.

Reimplemented in MLAstroRPA.

Definition at line 423 of file indipacinterface.cpp.

◆ HasBacklash()

bool INDI::PACInterface::HasBacklash ( )
inline
Returns
True if the device supports backlash compensation.

Definition at line 132 of file indipacinterface.h.

◆ HasPosition()

bool INDI::PACInterface::HasPosition ( )
inline
Returns
True if the device can report its current axis position.

Definition at line 120 of file indipacinterface.h.

◆ HasSpeed()

bool INDI::PACInterface::HasSpeed ( )
inline
Returns
True if the device supports variable speed.

Definition at line 108 of file indipacinterface.h.

◆ initProperties()

void PACInterface::initProperties ( const char *  group)
protected

initProperties Initialize PAC properties. Call this from your driver's initProperties().

Parameters
groupGroup or tab name for the properties.

Definition at line 36 of file indipacinterface.cpp.

◆ MoveALT()

IPState PACInterface::MoveALT ( double  degrees)
protectedvirtual

MoveALT Move the altitude axis by the given number of degrees.

Sign convention: positive = North (increase altitude), negative = South.

The default implementation returns IPS_ALERT. Drivers with motorised altitude adjustment must override this method.

Parameters
degreesSigned step size in degrees.
Returns
IPS_OK if completed immediately, IPS_BUSY if in progress, IPS_ALERT on error.

Reimplemented in AvalonUPAS, MLAstroRPA, OAPA, and PACSimulator.

Definition at line 368 of file indipacinterface.cpp.

◆ MoveAZ()

IPState PACInterface::MoveAZ ( double  degrees)
protectedvirtual

Move the azimuth axis by the given number of degrees.

Sign convention: positive = East, negative = West.

The default implementation returns IPS_ALERT. Drivers with motorised azimuth adjustment must override this method.

Parameters
degreesSigned step size in degrees.
Returns
IPS_OK if completed immediately, IPS_BUSY if in progress, IPS_ALERT on error.

Reimplemented in AvalonUPAS, MLAstroRPA, OAPA, and PACSimulator.

Definition at line 362 of file indipacinterface.cpp.

◆ MoveBoth()

IPState PACInterface::MoveBoth ( double  azDegrees,
double  altDegrees 
)
protectedvirtual

MoveBoth Move both axes in a single coordinated operation.

Called by processNumber() when both azStep and altStep are non-zero. The default implementation calls MoveAZ() followed by MoveALT(), preserving backward-compatible behaviour for any driver that does not override this method.

Drivers that can do better should override this:

  • Hardware with native dual-axis commands (e.g. GRBL) can pack both axes into a single serial command for truly simultaneous motion.
  • Hardware with shared angle registers that must sequence internally (e.g. MLAstro RPA) can send one chained command and let the device handle the AZ→ALT sequence on its own.
Parameters
azDegreesSigned azimuth step in degrees (+East / −West).
altDegreesSigned altitude step in degrees (+North / −South).
Returns
IPS_OK if completed immediately, IPS_BUSY if in progress, IPS_ALERT on error.

Reimplemented in AvalonUPAS, MLAstroRPA, and OAPA.

Definition at line 374 of file indipacinterface.cpp.

◆ processNumber()

bool PACInterface::processNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
protected

Process PAC number properties.

Definition at line 262 of file indipacinterface.cpp.

◆ processSwitch()

bool PACInterface::processSwitch ( const char *  dev,
const char *  name,
ISState *  states,
char *  names[],
int  n 
)
protected

Process PAC switch properties.

Definition at line 151 of file indipacinterface.cpp.

◆ ResetHome()

bool PACInterface::ResetHome ( )
protectedvirtual

ResetHome Clear the stored home reference without moving.

Only called when PAC_CAN_HOME is set. Default implementation returns false.

Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 430 of file indipacinterface.cpp.

◆ ReverseALT()

bool PACInterface::ReverseALT ( bool  enabled)
protectedvirtual

ReverseALT Reverse the direction of altitude axis movement.

Only called when PAC_CAN_REVERSE capability is set.

Parameters
enabledTrue to reverse, false to restore normal direction.
Returns
True if successful, false otherwise.

Reimplemented in AvalonUPAS, MLAstroRPA, OAPA, and PACSimulator.

Definition at line 408 of file indipacinterface.cpp.

◆ ReverseAZ()

bool PACInterface::ReverseAZ ( bool  enabled)
protectedvirtual

ReverseAZ Reverse the direction of azimuth axis movement.

Only called when PAC_CAN_REVERSE capability is set.

Parameters
enabledTrue to reverse, false to restore normal direction.
Returns
True if successful, false otherwise.

Reimplemented in AvalonUPAS, MLAstroRPA, OAPA, and PACSimulator.

Definition at line 400 of file indipacinterface.cpp.

◆ saveConfigItems()

bool PACInterface::saveConfigItems ( FILE *  fp)
protected

saveConfigItems Save PAC interface properties to config file. Call this from your driver's saveConfigItems().

Parameters
fpPointer to the open config file.
Returns
True on success.

Definition at line 337 of file indipacinterface.cpp.

◆ SetBacklashALT()

bool PACInterface::SetBacklashALT ( int32_t  steps)
protectedvirtual

SetBacklashALT Set the altitude axis backlash compensation value in steps.

Only called when PAC_HAS_BACKLASH is set. Default returns false.

Parameters
stepsNumber of motor steps used to compensate altitude backlash.
Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 469 of file indipacinterface.cpp.

◆ SetBacklashAZ()

bool PACInterface::SetBacklashAZ ( int32_t  steps)
protectedvirtual

SetBacklashAZ Set the azimuth axis backlash compensation value in steps.

Only called when PAC_HAS_BACKLASH is set. Default returns false.

Parameters
stepsNumber of motor steps used to compensate azimuth backlash.
Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 461 of file indipacinterface.cpp.

◆ SetBacklashEnabled()

bool PACInterface::SetBacklashEnabled ( bool  enabled)
protectedvirtual

SetBacklashEnabled Enable or disable hardware backlash compensation.

Only called when PAC_HAS_BACKLASH is set. Default returns false.

Parameters
enabledTrue to enable backlash compensation, false to disable.
Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 453 of file indipacinterface.cpp.

◆ SetCapability()

void INDI::PACInterface::SetCapability ( uint32_t  cap)
inline

SetCapability sets the PAC device capabilities. Call this in the driver constructor.

Parameters
capBitmask of PAC_HAS_SPEED, PAC_CAN_REVERSE, and/or PAC_HAS_POSITION.

Definition at line 102 of file indipacinterface.h.

◆ SetHome()

bool PACInterface::SetHome ( )
protectedvirtual

SetHome Mark the current position as the home (zero) reference.

Only called when PAC_CAN_HOME is set. Default implementation returns false.

Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 416 of file indipacinterface.cpp.

◆ SetPACSpeed()

bool PACInterface::SetPACSpeed ( uint16_t  speed)
protectedvirtual

SetPACSpeed Set the motor speed used for axis movements.

Only called when PAC_HAS_SPEED capability is set. The default implementation logs an error and returns false; drivers with variable-speed hardware must override.

Parameters
speedSpeed value (range defined by the driver, default 1–10).
Returns
True if the speed was applied successfully, false otherwise.

Reimplemented in AvalonUPAS, MLAstroRPA, and PACSimulator.

Definition at line 392 of file indipacinterface.cpp.

◆ SyncALT()

bool PACInterface::SyncALT ( double  degrees)
protectedvirtual

SyncALT Sync the altitude position reference to the given value without moving.

Only called when PAC_CAN_SYNC is set. Default returns false.

Parameters
degreesDesired current altitude reading in degrees.
Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 445 of file indipacinterface.cpp.

◆ SyncAZ()

bool PACInterface::SyncAZ ( double  degrees)
protectedvirtual

SyncAZ Sync the azimuth position reference to the given value without moving.

Only called when PAC_CAN_SYNC is set. Default returns false.

Parameters
degreesDesired current azimuth reading in degrees.
Returns
True if successful, false otherwise.

Reimplemented in MLAstroRPA.

Definition at line 437 of file indipacinterface.cpp.

◆ updateProperties()

bool PACInterface::updateProperties ( )
protected

updateProperties Define or delete properties based on connection state. Call this from your driver's updateProperties().

Returns
true on success.

Definition at line 99 of file indipacinterface.cpp.

Member Data Documentation

◆ AbortSP

INDI::PropertySwitch INDI::PACInterface::AbortSP {1}
protected

Abort motion property. Pressing Abort calls AbortMotion() and resets ManualAdjustmentNP and PositionNP to IPS_IDLE.

Definition at line 369 of file indipacinterface.h.

◆ ALTReverseSP

INDI::PropertySwitch INDI::PACInterface::ALTReverseSP {2}
protected

Altitude axis reverse switch. Only defined when PAC_CAN_REVERSE is set.

Definition at line 392 of file indipacinterface.h.

◆ AZReverseSP

INDI::PropertySwitch INDI::PACInterface::AZReverseSP {2}
protected

Azimuth axis reverse switch. Only defined when PAC_CAN_REVERSE is set.

Definition at line 387 of file indipacinterface.h.

◆ BacklashNP

INDI::PropertyNumber INDI::PACInterface::BacklashNP {2}
protected

Backlash compensation steps per axis. Only defined when PAC_HAS_BACKLASH is set. Element [BACKLASH_AZ] : azimuth backlash in motor steps. Element [BACKLASH_ALT]: altitude backlash in motor steps.

Definition at line 420 of file indipacinterface.h.

◆ BacklashSP

INDI::PropertySwitch INDI::PACInterface::BacklashSP {2}
protected

Backlash enable/disable switch. Only defined when PAC_HAS_BACKLASH is set.

Definition at line 413 of file indipacinterface.h.

◆ HomeSP

INDI::PropertySwitch INDI::PACInterface::HomeSP {3}
protected

Home management switch. Only defined when PAC_CAN_HOME is set. Elements: [HOME_SET] Set home, [HOME_GO] Return to home, [HOME_RESET] Reset home.

Definition at line 398 of file indipacinterface.h.

◆ ManualAdjustmentNP

INDI::PropertyNumber INDI::PACInterface::ManualAdjustmentNP {2}
protected

Manual adjustment property. Element [MANUAL_AZ] : azimuth step in degrees (+East / −West). Element [MANUAL_ALT] : altitude step in degrees (+North / −South). Writing a non-zero value to either element immediately triggers the corresponding move.

State reflects overall motion: IPS_BUSY – one or both axes still moving IPS_ALERT – one or both axes encountered an error IPS_OK – both axes completed successfully

Definition at line 363 of file indipacinterface.h.

◆ []

enum { ... } INDI::PACInterface::PACCapability

PAC capability flags passed to SetCapability().

◆ PositionNP

INDI::PropertyNumber INDI::PACInterface::PositionNP {2}
protected

Current axis position in degrees. Only defined when PAC_HAS_POSITION is set. Drivers should update this property periodically (e.g. from TimerHit).

Definition at line 375 of file indipacinterface.h.

◆ SpeedNP

INDI::PropertyNumber INDI::PACInterface::SpeedNP {1}
protected

Motor speed. Only defined when PAC_HAS_SPEED capability is set. Default range 1–10; drivers may adjust min/max/step in their initProperties() after calling PACI::initProperties().

Definition at line 382 of file indipacinterface.h.

◆ SyncNP

INDI::PropertyNumber INDI::PACInterface::SyncNP {2}
protected

Sync position numbers. Only defined when PAC_CAN_SYNC is set. Writing a value syncs that axis position reference without moving. Element [SYNC_AZ] : new azimuth reference in degrees. Element [SYNC_ALT]: new altitude reference in degrees.

Definition at line 407 of file indipacinterface.h.


The documentation for this class was generated from the following files: