Skip to content

Commit

Permalink
Migrate Wanderer rotator lite
Browse files Browse the repository at this point in the history
  • Loading branch information
naheedsa committed Apr 21, 2024
1 parent 730f652 commit 1608624
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions drivers/rotator/wanderer_rotator_lite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ bool WandererRotatorLite::initProperties()
INDI::Rotator::initProperties();
setDefaultPollingPeriod(500);
serialConnection->setDefaultBaudRate(Connection::Serial::B_19200);
IUFillSwitch(&HomeS[0], "SetHomeButton", "Set Current Position as Home", ISS_OFF);
IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "SetHome", "Set Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 5,
HomeSP[0].fill("SetHomeButton", "Set Current Position as Home", ISS_OFF);
HomeSP.fill(getDeviceName(), "SetHome", "Set Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 5,
IPS_IDLE);

return true;
Expand All @@ -58,13 +58,13 @@ bool WandererRotatorLite::updateProperties()
if (isConnected())
{

defineProperty(&HomeSP);
defineProperty(HomeSP);
deleteProperty(PresetNP.name);
deleteProperty(PresetGotoSP.name);
}
else
{
deleteProperty(HomeSP.name);
deleteProperty(HomeSP);
deleteProperty(PresetNP.name);
deleteProperty(PresetGotoSP.name);
}
Expand All @@ -75,13 +75,13 @@ bool WandererRotatorLite::ISNewSwitch(const char *dev, const char *name, ISState
{
if (dev && !strcmp(dev, getDeviceName()))
{
if (!strcmp(name, HomeSP.name))
if (HomeSP.isNameMatch(name))
{

HomeSP.s = SetHomePosition() ? IPS_OK : IPS_ALERT;
HomeSP.setState(SetHomePosition() ? IPS_OK : IPS_ALERT);
GotoRotatorN[0].value = 0;
LOG_INFO("Home is set");
IDSetSwitch(&HomeSP, nullptr);
HomeSP.apply();
IDSetNumber(&GotoRotatorNP, nullptr);
return true;

Expand Down
3 changes: 1 addition & 2 deletions drivers/rotator/wanderer_rotator_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class WandererRotatorLite : public INDI::Rotator
bool Handshake() override;
bool sendCommand(const char *cmd);
bool Move(const char *cmd);
ISwitchVectorProperty HomeSP;
ISwitch HomeS[1];
INDI::PropertySwitch HomeSP {1};
bool SetHomePosition();
bool haltcommand = false;
bool ReverseState;
Expand Down

0 comments on commit 1608624

Please sign in to comment.