From 5d135f93a58820356d056bc1141201b9ad0ae995 Mon Sep 17 00:00:00 2001 From: Frank Chen Date: Sun, 8 Oct 2023 17:33:03 +0800 Subject: [PATCH] Update for coding style --- indi-astroasis/oasis_filter_wheel.cpp | 54 +++++++++++++-------------- indi-astroasis/oasis_focuser.cpp | 14 +++---- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/indi-astroasis/oasis_filter_wheel.cpp b/indi-astroasis/oasis_filter_wheel.cpp index 5f1e6bc8e..efee677a0 100644 --- a/indi-astroasis/oasis_filter_wheel.cpp +++ b/indi-astroasis/oasis_filter_wheel.cpp @@ -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); @@ -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); @@ -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 { @@ -120,7 +120,7 @@ const char *OasisFilterWheel::getDefaultName() bool OasisFilterWheel::Connect() { int number, ids[OFW_MAX_NUM]; - AOReturn ret; + AOReturn ret; OFWScan(&number, ids); @@ -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() @@ -218,7 +218,7 @@ 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; } } @@ -226,7 +226,7 @@ bool OasisFilterWheel::SetFilterNames() { 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; @@ -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 @@ -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); @@ -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; } @@ -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()); @@ -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 @@ -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) { @@ -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); diff --git a/indi-astroasis/oasis_focuser.cpp b/indi-astroasis/oasis_focuser.cpp index 4fefd38f7..368d38f87 100644 --- a/indi-astroasis/oasis_focuser.cpp +++ b/indi-astroasis/oasis_focuser.cpp @@ -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); @@ -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); } @@ -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: @@ -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; } @@ -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 @@ -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