Skip to content

Commit

Permalink
remove unnecessary Enums and avoid using enum for a single item
Browse files Browse the repository at this point in the history
  • Loading branch information
naheedsa committed Feb 22, 2024
1 parent 25ca248 commit f9f1340
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
14 changes: 7 additions & 7 deletions drivers/focuser/moonlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool MoonLite::initProperties()
IPS_IDLE);

// Focuser temperature
TemperatureNP[TEMPERATURE].fill("TEMPERATURE", "Celsius", "%6.2f", -50, 70., 0., 0.);
TemperatureNP[0].fill("TEMPERATURE", "Celsius", "%6.2f", -50, 70., 0., 0.);
TemperatureNP.fill(getDeviceName(), "FOCUS_TEMPERATURE", "Temperature",
MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);

Expand All @@ -66,8 +66,8 @@ bool MoonLite::initProperties()
OPTIONS_TAB, IP_RW, 0, IPS_IDLE);

// Compensate for temperature
TemperatureCompensateSP[Enable].fill("Enable", "", ISS_OFF);
TemperatureCompensateSP[Disable].fill("Disable", "", ISS_ON);
TemperatureCompensateSP[INDI_ENABLED].fill("Enable", "", ISS_OFF);
TemperatureCompensateSP[INDI_DISABLED].fill("Disable", "", ISS_ON);
TemperatureCompensateSP.fill(getDeviceName(), "T. Compensate",
"", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);

Expand Down Expand Up @@ -195,7 +195,7 @@ bool MoonLite::readTemperature()
int rc = sscanf(res, "%X", &temp);
if (rc > 0)
// Signed hex
TemperatureNP[TEMPERATURE].setValue(static_cast<int16_t>(temp) / 2.0);
TemperatureNP[0].setValue(static_cast<int16_t>(temp) / 2.0);
else
{
LOGF_ERROR("Unknown error: focuser temperature value (%s)", res);
Expand Down Expand Up @@ -372,7 +372,7 @@ bool MoonLite::ISNewSwitch(const char * dev, const char * name, ISState * states
int last_index = TemperatureCompensateSP.findOnSwitchIndex();
TemperatureCompensateSP.update(states, names, n);

bool rc = setTemperatureCompensation((TemperatureCompensateSP[Enable].getState() == ISS_ON));
bool rc = setTemperatureCompensation((TemperatureCompensateSP[INDI_ENABLED].getState() == ISS_ON));

if (!rc)
{
Expand Down Expand Up @@ -518,10 +518,10 @@ void MoonLite::TimerHit()
rc = readTemperature();
if (rc)
{
if (fabs(lastTemperature - TemperatureNP[TEMPERATURE].value) >= 0.5)
if (fabs(lastTemperature - TemperatureNP[0].value) >= 0.5)
{
TemperatureNP.apply();
lastTemperature = static_cast<uint32_t>(TemperatureNP[TEMPERATURE].value);
lastTemperature = static_cast<uint32_t>(TemperatureNP[0].value);
}
}

Expand Down
9 changes: 0 additions & 9 deletions drivers/focuser/moonlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ class MoonLite : public INDI::Focuser

// Read Only Temperature Reporting
INDI::PropertyNumber TemperatureNP {1};
enum
{
TEMPERATURE
};

// Full/Half Step modes
INDI::PropertySwitch StepModeSP {2};
Expand All @@ -141,11 +137,6 @@ class MoonLite : public INDI::Focuser

// Temperature Compensation Enable/Disable
INDI::PropertySwitch TemperatureCompensateSP {2};
enum
{
Enable,
Disable
};

// MoonLite Buffer
static const uint8_t ML_RES { 32 };
Expand Down

0 comments on commit f9f1340

Please sign in to comment.