Skip to content

Commit

Permalink
use INDI_ENABLED/INDI_DISABLED
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-soja committed Jan 20, 2025
1 parent 69804ee commit f0f07d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
22 changes: 6 additions & 16 deletions drivers/telescope/lx200am5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,12 @@ bool LX200AM5::initProperties()
});

// Heavy Duty Mode
HeavyDutyModeSP[HeavyDutyModeOff].fill("OFF", "Off", ISS_OFF);
HeavyDutyModeSP[HeavyDutyModeOn].fill("ON", "On", ISS_OFF);
HeavyDutyModeSP[INDI_ENABLED].fill("INDI_ENABLED", "Enabled", ISS_OFF);
HeavyDutyModeSP[INDI_DISABLED].fill("INDI_DISABLED", "Disabled", ISS_OFF);
HeavyDutyModeSP.fill(getDeviceName(), "HEAVY_DUTY_MODE", "Heavy Duty Mode", MOTION_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
HeavyDutyModeSP.onUpdate([this]{
IPState state = IPS_BUSY;

if (HeavyDutyModeSP[HeavyDutyModeOff].getState() == ISS_ON)
{
state = setHeavyDutyMode(false) ? IPS_OK : IPS_ALERT;
}

if (HeavyDutyModeSP[HeavyDutyModeOn].getState() == ISS_ON)
{
state = setHeavyDutyMode(true) ? IPS_OK : IPS_ALERT;
}

bool enabled = HeavyDutyModeSP[INDI_ENABLED].getState() == ISS_ON;
IPState state = setHeavyDutyMode(enabled) ? IPS_OK : IPS_ALERT;
HeavyDutyModeSP.setState(state);
HeavyDutyModeSP.apply();
});
Expand Down Expand Up @@ -473,12 +463,12 @@ bool LX200AM5::getHeavyDutyMode()

if (strcmp(response, "1440#") == 0)
{
HeavyDutyModeSP[HeavyDutyModeOff].setState(ISS_ON);
HeavyDutyModeSP[INDI_DISABLED].setState(ISS_ON);
}

if (strcmp(response, "720#") == 0)
{
HeavyDutyModeSP[HeavyDutyModeOn].setState(ISS_ON);
HeavyDutyModeSP[INDI_ENABLED].setState(ISS_ON);
}

HeavyDutyModeSP.setState(IPS_OK);
Expand Down
5 changes: 0 additions & 5 deletions drivers/telescope/lx200am5.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ class LX200AM5 : public LX200Generic

// Heavy duty control
INDI::PropertySwitch HeavyDutyModeSP {2};
enum
{
HeavyDutyModeOff = 0,
HeavyDutyModeOn = 1,
};

// Meridian Flip Control
INDI::PropertySwitch MeridianFlipSP {2};
Expand Down

0 comments on commit f0f07d9

Please sign in to comment.