Skip to content

Commit

Permalink
Update for coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
astroasis committed Oct 8, 2023
1 parent 89ff617 commit 5d135f9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
54 changes: 27 additions & 27 deletions indi-astroasis/oasis_filter_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool OasisFilterWheel::initProperties()
{
INDI::FilterWheel::initProperties();

// Mode
// Mode
IUFillSwitch(&ModeS[0], "MODE_0", "Fast", ISS_OFF);
IUFillSwitch(&ModeS[1], "MODE_1", "Normal", ISS_OFF);
IUFillSwitch(&ModeS[2], "MODE_2", "Slow", ISS_OFF);
Expand All @@ -57,12 +57,12 @@ bool OasisFilterWheel::initProperties()
IUFillSwitchVector(&AutoRunSP, AutoRunS, 2, getDeviceName(), "FILTER_AUTO_RUN", "Auto run on power up",
MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);

// Factory Reset
// Factory Reset
IUFillSwitch(&FactoryResetS[0], "FACTORY_RESET", "Reset", ISS_OFF);
IUFillSwitchVector(&FactoryResetSP, FactoryResetS, 1, getDeviceName(), "FACTORY_RESET", "Factory Reset",
MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE);

// Calibrate
// Calibrate
IUFillSwitch(&CalibrateS[0], "CALIBRATE", "Calibrate", ISS_OFF);
IUFillSwitchVector(&CalibrateSP, CalibrateS, 1, getDeviceName(), "FILTER_CALIBRATION", "Calibrate",
MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE);
Expand All @@ -87,9 +87,9 @@ bool OasisFilterWheel::updateProperties()
AutoRunS[INDI_ENABLED].s = config.autorun ? ISS_ON : ISS_OFF;
AutoRunS[INDI_DISABLED].s = config.autorun ? ISS_OFF : ISS_ON;

ModeS[0].s = (config.mode == 0) ? ISS_ON : ISS_OFF;
ModeS[1].s = (config.mode == 1) ? ISS_ON : ISS_OFF;
ModeS[2].s = (config.mode == 2) ? ISS_ON : ISS_OFF;
ModeS[0].s = (config.mode == 0) ? ISS_ON : ISS_OFF;
ModeS[1].s = (config.mode == 1) ? ISS_ON : ISS_OFF;
ModeS[2].s = (config.mode == 2) ? ISS_ON : ISS_OFF;
}
else
{
Expand Down Expand Up @@ -120,7 +120,7 @@ const char *OasisFilterWheel::getDefaultName()
bool OasisFilterWheel::Connect()
{
int number, ids[OFW_MAX_NUM];
AOReturn ret;
AOReturn ret;

OFWScan(&number, ids);

Expand Down Expand Up @@ -196,14 +196,14 @@ bool OasisFilterWheel::GetFilterNames()
if (ret != AO_SUCCESS)
{
LOGF_ERROR("Failed to get Oasis filter wheel slot name, ret = %d\n", ret);
state = IPS_ALERT;
state = IPS_ALERT;
}
}
}

IUFillTextVector(FilterNameTP, FilterNameT, MaxFilter, getDeviceName(), "FILTER_NAME", "Filter",
FilterSlotNP.group, IP_RW, 0, state);

return true;
return true;
}

bool OasisFilterWheel::SetFilterNames()
Expand All @@ -218,15 +218,15 @@ bool OasisFilterWheel::SetFilterNames()
LOGF_ERROR("Filter #%d: the filter name is not valid. It should not have more than 32 chars", i + 1);
LOGF_ERROR("Filter #%d: and the valid chars are A to Z, a to z, 0 to 9 = . # / - _ percent or space", i + 1);

return false;
return false;
}
}

for (int i = 0; i < FilterSlotN[0].max; i++)
{
AOReturn ret = OFWSetSlotName(mID, i + 1, FilterNameT[i].text);

if (ret != AO_SUCCESS)
if (ret != AO_SUCCESS)
{
LOGF_ERROR("Failed to set Oasis filter wheel slot name, ret = %d\n", ret);
return false;
Expand All @@ -250,13 +250,13 @@ bool OasisFilterWheel::ISNewSwitch(const char *dev, const char *name, ISState *s
IUUpdateSwitch(&ModeSP, states, names, n);
target = IUFindOnSwitchIndex(&ModeSP);

config.mask = MASK_MODE;
config.mask = MASK_MODE;
config.mode = target;

ret = OFWSetConfig(mID, &config);

if (ret == AO_SUCCESS)
{
if (ret == AO_SUCCESS)
{
ModeSP.s = IPS_OK;
}
else
Expand All @@ -265,10 +265,10 @@ bool OasisFilterWheel::ISNewSwitch(const char *dev, const char *name, ISState *s

IUResetSwitch(&ModeSP);

if ((prev >= 0) && (prev < 3))
ModeS[prev].s = ISS_ON;
if ((prev >= 0) && (prev < 3))
ModeS[prev].s = ISS_ON;

ModeSP.s = IPS_ALERT;
ModeSP.s = IPS_ALERT;
}

IDSetSwitch(&ModeSP, nullptr);
Expand All @@ -286,8 +286,8 @@ bool OasisFilterWheel::ISNewSwitch(const char *dev, const char *name, ISState *s

ret = OFWSetConfig(mID, &config);

if (ret == AO_SUCCESS)
{
if (ret == AO_SUCCESS)
{
IUUpdateSwitch(&AutoRunSP, states, names, n);
AutoRunSP.s = IPS_OK;
}
Expand All @@ -310,8 +310,8 @@ bool OasisFilterWheel::ISNewSwitch(const char *dev, const char *name, ISState *s

ret = OFWCalibrate(mID, 0);

if (ret == AO_SUCCESS)
{
if (ret == AO_SUCCESS)
{
LOG_INFO("Oasis filter wheel calibrating...\n");
CalibrateSP.s = IPS_BUSY;
SetTimer(getCurrentPollingPeriod());
Expand All @@ -335,8 +335,8 @@ bool OasisFilterWheel::ISNewSwitch(const char *dev, const char *name, ISState *s

ret = OFWFactoryReset(mID);

if (ret == AO_SUCCESS)
{
if (ret == AO_SUCCESS)
{
FactoryResetSP.s = IPS_OK;
}
else
Expand Down Expand Up @@ -367,7 +367,7 @@ int OasisFilterWheel::QueryFilter()
return 0;
}

CurrentFilter = (status.filterStatus == STATUS_IDLE) ? status.filterPosition : 0;
CurrentFilter = (status.filterStatus == STATUS_IDLE) ? status.filterPosition : 0;

if (status.filterStatus == STATUS_IDLE)
{
Expand All @@ -376,14 +376,14 @@ int OasisFilterWheel::QueryFilter()
else
{
LOG_INFO("Oasis filter wheel moving...\n");
}
}

return CurrentFilter;
}

bool OasisFilterWheel::SelectFilter(int position)
{
AOReturn ret;
AOReturn ret;

ret = OFWSetPosition(mID, position);

Expand Down
14 changes: 7 additions & 7 deletions indi-astroasis/oasis_focuser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ bool OasisFocuser::initProperties()
// Focuser board temperature
TemperatureBoardNP[0].fill("TEMPERATURE", "Board", "%.2f", -100, 100, 0., 0.);
TemperatureBoardNP.fill(getDeviceName(), "FOCUS_TEMPERATURE_BOARD", "Temperature",
MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);
MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);

// Focuser ambient temperature
TemperatureAmbientNP[0].fill("TEMPERATURE", "Ambient", "%.2f", -100, 100, 0., 0.);
TemperatureAmbientNP.fill(getDeviceName(), "FOCUS_TEMPERATURE_AMBIENT", "Temperature",
MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);
MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);

// Backlash compensation direction
BacklashDirSP[INDI_ENABLED].fill("ON", "IN", ISS_ON);
Expand Down Expand Up @@ -131,7 +131,7 @@ bool OasisFocuser::updateProperties()
unsigned int firmware = version.firmware;

snprintf(ver, sizeof(ver), "%d.%d.%d built %s",
firmware >> 24, (firmware >> 16) & 0xff, (firmware >> 8) & 0xff, version.built);
firmware >> 24, (firmware >> 16) & 0xff, (firmware >> 8) & 0xff, version.built);

VersionSP[0].setText(ver);
}
Expand Down Expand Up @@ -202,7 +202,7 @@ bool OasisFocuser::SetConfig(unsigned int mask, int value)
case MASK_BACKLASH:
config.backlash = value;
break;
case MASK_BACKLASH_DIRECTION:
case MASK_BACKLASH_DIRECTION:
config.backlashDirection = value;
break;
case MASK_REVERSE_DIRECTION:
Expand All @@ -220,7 +220,7 @@ bool OasisFocuser::SetConfig(unsigned int mask, int value)
case MASK_BLUETOOTH:
config.bluetoothOn = value;
break;
default:
default:
LOGF_ERROR("Invalid Oasis Focuser configuration mask %08X\n", mask);
return false;
}
Expand Down Expand Up @@ -353,7 +353,7 @@ bool OasisFocuser::ISNewSwitch(const char * dev, const char * name, ISState * st
BeepOnMoveSP.update(states, names, n);

int on = (BeepOnMoveSP.findOnSwitchIndex() == INDI_ENABLED) ? 1 : 0;

if (SetConfig(MASK_BEEP_ON_MOVE, on))
BeepOnMoveSP.setState(IPS_OK);
else
Expand All @@ -371,7 +371,7 @@ bool OasisFocuser::ISNewSwitch(const char * dev, const char * name, ISState * st

// 0 - IN, 1 - OUT
int dir = (BacklashDirSP.findOnSwitchIndex() == INDI_ENABLED) ? 0 : 1;

if (SetConfig(MASK_BACKLASH_DIRECTION, dir))
BacklashDirSP.setState(IPS_OK);
else
Expand Down

0 comments on commit 5d135f9

Please sign in to comment.