From f0f07d9e841750df8e0d8969c423aaa726153420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Soja?= Date: Mon, 20 Jan 2025 08:51:57 +0100 Subject: [PATCH] use INDI_ENABLED/INDI_DISABLED --- drivers/telescope/lx200am5.cpp | 22 ++++++---------------- drivers/telescope/lx200am5.h | 5 ----- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/telescope/lx200am5.cpp b/drivers/telescope/lx200am5.cpp index 620b97f45d..7596859441 100644 --- a/drivers/telescope/lx200am5.cpp +++ b/drivers/telescope/lx200am5.cpp @@ -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(); }); @@ -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); diff --git a/drivers/telescope/lx200am5.h b/drivers/telescope/lx200am5.h index 89e92d3284..1300de9a02 100644 --- a/drivers/telescope/lx200am5.h +++ b/drivers/telescope/lx200am5.h @@ -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};