Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling tracking mode in the pegasus driver, and enable King mode. #1954

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 31 additions & 40 deletions drivers/telescope/lx200_pegasus_nyx101.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ bool LX200NYX101::initProperties()
if (mountType == Equatorial)
SetTelescopeCapability(GetTelescopeCapability() | TELESCOPE_HAS_PIER_SIDE, SLEW_MODES);

// Overwrite TRACK_CUSTOM, with TRACK_KING
IUFillSwitch(&TrackModeS[TRACK_KING], "TRACK_KING", "King", ISS_OFF);

// Guide Rate
int guideRate = 1;
IUGetConfigOnSwitchIndex(getDeviceName(), "GUIDE_RATE", &guideRate);
Expand Down Expand Up @@ -112,15 +115,6 @@ bool LX200NYX101::initProperties()
IsAtHomePosition[0].fill("IsAtHomePosition","H","-");
IsAtHomePosition.fill(getDeviceName(),"IsAtHomePosition","IsAtHomePosition",STATUS_TAB, IP_RO, 60, IPS_IDLE);

TrackSidereal[0].fill("TrackSidereal","","-");
TrackSidereal.fill(getDeviceName(),"TrackSidereal","TrackSidereal",STATUS_TAB, IP_RO, 60, IPS_IDLE);

TrackLunar[0].fill("TrackLunar","(","-");
TrackLunar.fill(getDeviceName(),"TrackLunar","TrackLunar",STATUS_TAB, IP_RO, 60, IPS_IDLE);

TrackSolar[0].fill("TrackSolar","O","-");
TrackSolar.fill(getDeviceName(),"TrackSolar","TrackSolar",STATUS_TAB, IP_RO, 60, IPS_IDLE);

MountAltAz[0].fill("MountAltAz","A","-");
MountAltAz.fill(getDeviceName(),"MountAltAz","MountAltAz",STATUS_TAB, IP_RO, 60, IPS_IDLE);

Expand Down Expand Up @@ -215,9 +209,6 @@ bool LX200NYX101::updateProperties()
defineProperty(IsParked);
defineProperty(IsParkginInProgress);
defineProperty(IsAtHomePosition);
defineProperty(TrackSidereal);
defineProperty(TrackLunar);
defineProperty(TrackSolar);
defineProperty(MountAltAz);
defineProperty(MountEquatorial);
defineProperty(PierNone);
Expand All @@ -242,9 +233,6 @@ bool LX200NYX101::updateProperties()
deleteProperty(IsParked);
deleteProperty(IsParkginInProgress);
deleteProperty(IsAtHomePosition);
deleteProperty(TrackSidereal);
deleteProperty(TrackLunar);
deleteProperty(TrackSolar);
deleteProperty(MountAltAz);
deleteProperty(MountEquatorial);
deleteProperty(PierNone);
Expand Down Expand Up @@ -311,7 +299,7 @@ bool LX200NYX101::ReadScopeStatus()
//bool _IsAtHomePosition = false;
SetPropertyText(IsAtHomePosition, IPS_BUSY);

TelescopeTrackMode _TrackingMode = TRACK_SIDEREAL;
NYXTelescopeTrackMode _TrackingMode = TRACK_SIDEREAL;

//MountType _MountType = Equatorial;

Expand Down Expand Up @@ -376,7 +364,7 @@ bool LX200NYX101::ReadScopeStatus()
_TrackingMode = TRACK_SOLAR;
continue;
case 'k':
//Not Supported by TelescopeTrackMode
_TrackingMode = TRACK_KING;
continue;
case 'A':
//_MountType = AltAz;
Expand Down Expand Up @@ -423,26 +411,13 @@ bool LX200NYX101::ReadScopeStatus()
}
}

switch(_TrackingMode)
{
case INDI::Telescope::TRACK_SIDEREAL:
SetPropertyText(TrackSidereal, IPS_OK);
SetPropertyText(TrackLunar, IPS_BUSY);
SetPropertyText(TrackSolar, IPS_BUSY);
break;
case INDI::Telescope::TRACK_LUNAR:
SetPropertyText(TrackLunar, IPS_OK);
SetPropertyText(TrackSidereal, IPS_BUSY);
SetPropertyText(TrackSolar, IPS_BUSY);
break;
case INDI::Telescope::TRACK_SOLAR:
SetPropertyText(TrackSolar, IPS_OK);
SetPropertyText(TrackSidereal, IPS_BUSY);
SetPropertyText(TrackLunar, IPS_BUSY);
break;
case INDI::Telescope::TRACK_CUSTOM:
break;
}
TrackModeS[TRACK_SIDEREAL].s = ISS_OFF;
TrackModeS[TRACK_LUNAR].s = ISS_OFF;
TrackModeS[TRACK_SOLAR].s = ISS_OFF;
TrackModeS[TRACK_KING].s = ISS_OFF;
TrackModeS[_TrackingMode].s = ISS_ON;
TrackModeSP.s = IPS_OK;
IDSetSwitch(&TrackModeSP, nullptr);

switch(_PierSide)
{
Expand Down Expand Up @@ -594,9 +569,6 @@ bool LX200NYX101::ISNewSwitch(const char *dev, const char *name, ISState *states
SetPropertyText(IsParked, IPS_IDLE);
SetPropertyText(IsParkginInProgress, IPS_IDLE);
SetPropertyText(IsAtHomePosition, IPS_IDLE);
SetPropertyText(TrackSidereal, IPS_IDLE);
SetPropertyText(TrackLunar, IPS_IDLE);
SetPropertyText(TrackSolar, IPS_IDLE);
SetPropertyText(MountAltAz, IPS_IDLE);
SetPropertyText(MountEquatorial, IPS_IDLE);
SetPropertyText(PierNone, IPS_IDLE);
Expand Down Expand Up @@ -672,6 +644,25 @@ bool LX200NYX101::setGuideRate(int rate)
return sendCommand(command);
}

bool LX200NYX101::SetTrackMode(uint8_t mode)
{
switch(mode){
case TRACK_SIDEREAL:
return sendCommand(":TQ#");
break;
case TRACK_SOLAR:
return sendCommand(":TS#");
break;
case TRACK_LUNAR:
return sendCommand(":TL#");
break;
case TRACK_KING:
return sendCommand(":TK#");
break;
}
return false;
}

bool LX200NYX101::setMountType(int type)
{
return sendCommand((type == Equatorial) ? ":SXEM,1#" : "::SXEM,3#");
Expand Down
12 changes: 9 additions & 3 deletions drivers/telescope/lx200_pegasus_nyx101.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class LX200NYX101 : public LX200Generic
virtual bool setUTCOffset(double offset) override;
virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
virtual bool SetTrackEnabled(bool enabled) override;
virtual bool SetTrackMode(uint8_t mode) override;
virtual bool SetSlewRate(int index) override;

private:
Expand All @@ -51,6 +52,14 @@ class LX200NYX101 : public LX200Generic
static const char DRIVER_STOP_CHAR { 0x23 };
static constexpr const uint8_t DRIVER_TIMEOUT {3};

enum NYXTelescopeTrackMode
{
TRACK_SIDEREAL,
TRACK_SOLAR,
TRACK_LUNAR,
TRACK_KING
};

INDI::PropertySwitch MountTypeSP {2};
enum MountType
{
Expand All @@ -67,9 +76,6 @@ class LX200NYX101 : public LX200Generic
INDI::PropertyText IsParked {1};
INDI::PropertyText IsParkginInProgress {1};
INDI::PropertyText IsAtHomePosition {1};
INDI::PropertyText TrackSidereal {1};
INDI::PropertyText TrackLunar {1};
INDI::PropertyText TrackSolar {1};
INDI::PropertyText MountAltAz {1};
INDI::PropertyText MountEquatorial {1};
INDI::PropertyText PierNone {1};
Expand Down
Loading