diff --git a/DeviceAdapters/ASIStage/ASIBase.cpp b/DeviceAdapters/ASIStage/ASIBase.cpp index 65b271f14..762700935 100644 --- a/DeviceAdapters/ASIStage/ASIBase.cpp +++ b/DeviceAdapters/ASIStage/ASIBase.cpp @@ -8,23 +8,11 @@ #include "ASIBase.h" ASIBase::ASIBase(MM::Device* device, const char* prefix) : - core_(nullptr), device_(device), - port_("Undefined"), - initialized_(false), - oldstage_(false), - version_(Version()), - firmwareVersion_("Undefined"), - firmwareBuild_("Undefined"), - firmwareDate_("Undefined"), - oldstagePrefix_(prefix), - commandPrefix_(""), - serialTerm_("\r\n") -{ + oldstagePrefix_(prefix) { } -ASIBase::~ASIBase() -{ +ASIBase::~ASIBase() { } // Clear contents of serial port @@ -105,8 +93,8 @@ int ASIBase::CheckDeviceStatus() { int ASIBase::GetVersion(std::string& version) const { std::string answer; - if (const int error = QueryCommand("V", answer)) { - return error; + if (const int status = QueryCommand("V", answer); status != DEVICE_OK) { + return status; } if (answer.size() > 16 && answer.compare(0, 2, ":A") == 0) { const size_t start = 16; // dash position diff --git a/DeviceAdapters/ASIStage/ASIBase.h b/DeviceAdapters/ASIStage/ASIBase.h index 5c5ef124b..7881448c6 100644 --- a/DeviceAdapters/ASIStage/ASIBase.h +++ b/DeviceAdapters/ASIStage/ASIBase.h @@ -5,8 +5,7 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASIBASE_H -#define ASIBASE_H +#pragma once #include "ASIStage.h" #include "MMDevice.h" @@ -24,7 +23,7 @@ // New version format: ":A Version: USB-9.50 \r\n" (revision is a digit character: '0'-'9') class Version { public: - Version() : major_(0), minor_(0), rev_(0) { } + Version() = default; explicit Version(unsigned int major, unsigned int minor, unsigned int rev) : major_(major), minor_(minor), rev_(rev) { } @@ -78,9 +77,9 @@ class Version { } private: - unsigned int major_; - unsigned int minor_; - unsigned int rev_; + unsigned int major_ = 0; + unsigned int minor_ = 0; + unsigned int rev_ = 0; }; // Note: concrete device classes deriving ASIBase must set core_ in Initialize() @@ -111,22 +110,20 @@ class ASIBase { static constexpr size_t SERIAL_RXBUFFER_SIZE = 2048; static constexpr size_t CLEAR_BUFFER_SIZE = 255; - MM::Core* core_; - MM::Device* device_; - std::string port_; + MM::Core* core_ = nullptr; + MM::Device* device_ = nullptr; + std::string port_ = "Undefined"; - bool initialized_; - bool oldstage_; + bool initialized_ = false; + bool oldstage_ = false; - Version version_; - std::string firmwareVersion_; - std::string firmwareBuild_; - std::string firmwareDate_; + Version version_{}; + std::string firmwareVersion_ = "Undefined"; + std::string firmwareBuild_ = "Undefined"; + std::string firmwareDate_ = "Undefined"; - // Stage-specific configuration - std::string oldstagePrefix_; // "1H" or "2H" for LX-4000 stages, empty string for MS-2000 stages - std::string commandPrefix_; // set to oldstagePrefix_ if oldstage_ is true, otherwise empty string - std::string serialTerm_; // changes if oldstage_ is true + // stage-specific configuration + std::string oldstagePrefix_{}; // "1H" or "2H" for LX-4000 stages, empty string for MS-2000 stages + std::string commandPrefix_{}; // set to oldstagePrefix_ if oldstage_ is true, otherwise empty string + std::string serialTerm_ = "\r\n"; // changes if oldstage_ is true }; - -#endif // ASIBASE_H diff --git a/DeviceAdapters/ASIStage/ASICRISP.cpp b/DeviceAdapters/ASIStage/ASICRISP.cpp index f29a0f182..24f45c852 100644 --- a/DeviceAdapters/ASIStage/ASICRISP.cpp +++ b/DeviceAdapters/ASIStage/ASICRISP.cpp @@ -42,30 +42,14 @@ constexpr char SetLockOffset[] = "Set Lock Offset (Advanced Users Only)"; namespace Props = Properties; } // namespace -CRISP::CRISP() : - ASIBase(this, ""), - axisLetter_("Z"), - focusState_(""), - waitAfterLock_(1000), - answerTimeoutMs_(1000), - // init cached properties - gainMultiplier_(0), - ledIntensity_(0), - numAverages_(0), - numSkips_(0), - calibrationRange_(0), - inFocusRange_(0), - lockRange_(0), - objectiveNA_(0) -{ +CRISP::CRISP() : ASIBase(this, "") { InitializeDefaultErrorMessages(); SetErrorText(ERR_NOT_CALIBRATED, "CRISP is not calibrated. Try focusing close to a coverslip and selecting 'Calibrate'"); SetErrorText(ERR_UNRECOGNIZED_ANSWER, "The ASI controller said something incomprehensible"); SetErrorText(ERR_NOT_LOCKED, "The CRISP failed to lock"); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_CRISPDeviceName, MM::String, true); @@ -403,12 +387,11 @@ int CRISP::SetFocusState(const std::string& focusState) { return DEVICE_OK; } - if (const int error = ForceSetFocusState(focusState)) { - return error; + if (const int status = ForceSetFocusState(focusState); status != DEVICE_OK) { + return status; } focusState_ = focusState; - return DEVICE_OK; } @@ -497,8 +480,8 @@ int CRISP::SetContinuousFocusing(bool state) // Update focusState_ from the controller and check if focus is locked or trying to lock ('F' or 'K' state). int CRISP::GetContinuousFocusing(bool& state) { - if (const int error = UpdateFocusState()) { - return error; + if (const int status = UpdateFocusState(); status != DEVICE_OK) { + return status; } state = (focusState_ == g_CRISP_K) || (focusState_ == g_CRISP_F); return DEVICE_OK; @@ -558,8 +541,8 @@ int CRISP::GetCurrentFocusScore(double& score) { int CRISP::GetValue(const std::string& command, double& value) { std::string answer; - if (const int error = QueryCommand(command.c_str(), answer)) { - return error; + if (const int status = QueryCommand(command.c_str(), answer); status != DEVICE_OK) { + return status; } if (answer.length() > 2 && answer.compare(0, 2, ":N") == 0) { @@ -584,8 +567,8 @@ int CRISP::GetValue(const std::string& command, double& value) { int CRISP::SetCommand(const std::string& command) { std::string answer; - if (const int error = QueryCommand(command.c_str(), answer)) { - return error; + if (const int status = QueryCommand(command.c_str(), answer); status != DEVICE_OK) { + return status; } if (answer.compare(0, 2, ":A") == 0) { return DEVICE_OK; @@ -621,14 +604,14 @@ int CRISP::OnPort(MM::PropertyBase* pProp, MM::ActionType eAct) int CRISP::OnFocus(MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { - if (const int error = UpdateFocusState()) { - return error; + if (const int status = UpdateFocusState(); status != DEVICE_OK) { + return status; } pProp->Set(focusState_.c_str()); } else if (eAct == MM::AfterSet) { pProp->Get(focusState_); - if (const int error = SetFocusState(focusState_)) { - return error; + if (const int status = SetFocusState(focusState_); status != DEVICE_OK) { + return status; } } return DEVICE_OK; @@ -1016,8 +999,8 @@ void CRISP::CreateStateProperty() { new MM::ActionLambda([this](MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { std::string answer; - if (const int error = QueryCommand("LK X?", answer)) { - return error; + if (const int status = QueryCommand("LK X?", answer); status != DEVICE_OK) { + return status; } const char* state = &answer[answer.size() - 1]; if (!pProp->Set(state)) { @@ -1056,8 +1039,8 @@ void CRISP::CreateLockOffsetProperty() { new MM::ActionLambda([this](MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { double offset; // Note: autofocus API requires double - if (const int error = GetOffset(offset)) { - return error; + if (const int status = GetOffset(offset); status != DEVICE_OK) { + return status; } // cast to long to match integer property if (!pProp->Set(static_cast(offset))) { @@ -1174,8 +1157,8 @@ void CRISP::CreateLogAmpAGCProperty() { new MM::ActionLambda([this](MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { double tmp{}; // Note: response is ":A X=1.000000", parse as double - if (const int error = GetValue("AL X?", tmp)) { - return error; + if (const int status = GetValue("AL X?", tmp); status != DEVICE_OK) { + return status; } // cast to long to match integer property pProp->Set(static_cast(tmp)); diff --git a/DeviceAdapters/ASIStage/ASICRISP.h b/DeviceAdapters/ASIStage/ASICRISP.h index 9bba2e09a..e3957f4f6 100644 --- a/DeviceAdapters/ASIStage/ASICRISP.h +++ b/DeviceAdapters/ASIStage/ASICRISP.h @@ -5,8 +5,7 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASICRISP_H -#define ASICRISP_H +#pragma once #include "ASIBase.h" @@ -87,24 +86,22 @@ class CRISP : public CAutoFocusBase, public ASIBase { void CreateSetLogAmpAGCProperty(); void CreateSetLockOffsetProperty(); - std::string axisLetter_; - std::string focusState_; - long waitAfterLock_; + std::string axisLetter_ = "Z"; // determined by pre-init property + std::string focusState_{}; - int answerTimeoutMs_; + long waitAfterLock_ = 1000; + int answerTimeoutMs_ = 1000; // cached properties - long gainMultiplier_; - long ledIntensity_; - long numAverages_; - long numSkips_; // update rate (milliseconds) - double calibrationRange_; // microns - double inFocusRange_; // microns - double lockRange_; // millimeters - double objectiveNA_; + long gainMultiplier_ = 0; + long ledIntensity_ = 0; + long numAverages_ = 0; + long numSkips_ = 0; // update rate (milliseconds) + double calibrationRange_ = 0; // microns + double inFocusRange_ = 0; // microns + double lockRange_ = 0; // millimeters + double objectiveNA_ = 0; static constexpr int SIZE_OF_FC_ARRAY = 24; - std::string focusCurveData_[SIZE_OF_FC_ARRAY]; + std::string focusCurveData_[SIZE_OF_FC_ARRAY]{}; }; - -#endif // ASICRISP_H diff --git a/DeviceAdapters/ASIStage/ASILED.cpp b/DeviceAdapters/ASIStage/ASILED.cpp index f5d9d4997..c36d03969 100644 --- a/DeviceAdapters/ASIStage/ASILED.cpp +++ b/DeviceAdapters/ASIStage/ASILED.cpp @@ -7,20 +7,10 @@ #include "ASILED.h" -LED::LED() : - ASIBase(this, ""), - open_(false), - intensity_(20), - name_("LED"), - answerTimeoutMs_(1000), - channel_(0), - channelAxisChar_('X'), - hasDLED_(false) -{ +LED::LED() : ASIBase(this, "") { InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_LEDDeviceName, MM::String, true); @@ -51,7 +41,6 @@ void LED::GetName(char* name) const CDeviceUtils::CopyLimitedString(name, g_LEDDeviceName); } - bool LED::SupportsDeviceDetection() { return true; diff --git a/DeviceAdapters/ASIStage/ASILED.h b/DeviceAdapters/ASIStage/ASILED.h index c134de0de..16a966d91 100644 --- a/DeviceAdapters/ASIStage/ASILED.h +++ b/DeviceAdapters/ASIStage/ASILED.h @@ -5,13 +5,11 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASILED_H -#define ASILED_H +#pragma once #include "ASIBase.h" -class LED : public CShutterBase, public ASIBase -{ +class LED : public CShutterBase, public ASIBase { public: LED(); ~LED(); @@ -40,13 +38,13 @@ class LED : public CShutterBase, public ASIBase int IsOpen(bool* open); // queries the device rather than using a cached value int CurrentIntensity(long* intensity); // queries the device rather than using a cached value - bool open_; - long intensity_; - std::string name_; - int answerTimeoutMs_; - long channel_; - char channelAxisChar_; - bool hasDLED_; -}; + std::string name_ = "LED"; + long channel_ = 0; + char channelAxisChar_ = 'X'; + + bool open_ = false; + bool hasDLED_ = false; -#endif // ASILED_H + long intensity_ = 20; + int answerTimeoutMs_ = 1000; +}; diff --git a/DeviceAdapters/ASIStage/ASIMagnifier.cpp b/DeviceAdapters/ASIStage/ASIMagnifier.cpp index 6c22f4f1d..8259eaf04 100644 --- a/DeviceAdapters/ASIStage/ASIMagnifier.cpp +++ b/DeviceAdapters/ASIStage/ASIMagnifier.cpp @@ -7,15 +7,10 @@ #include "ASIMagnifier.h" -Magnifier::Magnifier() : - ASIBase(this, ""), - axis_("M"), // normally the zoom axis is the M axis - answerTimeoutMs_(1000) -{ +Magnifier::Magnifier() : ASIBase(this, "") { InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_MagnifierDeviceName, MM::String, true); @@ -110,12 +105,8 @@ int Magnifier::Initialize() return DEVICE_OK; } -int Magnifier::Shutdown() -{ - if (initialized_) - { - initialized_ = false; - } +int Magnifier::Shutdown() { + initialized_ = false; return DEVICE_OK; } diff --git a/DeviceAdapters/ASIStage/ASIMagnifier.h b/DeviceAdapters/ASIStage/ASIMagnifier.h index 9704f5726..dd58155da 100644 --- a/DeviceAdapters/ASIStage/ASIMagnifier.h +++ b/DeviceAdapters/ASIStage/ASIMagnifier.h @@ -5,13 +5,11 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASIMAGNIFIER_H -#define ASIMAGNIFIER_H +#pragma once #include "ASIBase.h" -class Magnifier : public CMagnifierBase, public ASIBase -{ +class Magnifier : public CMagnifierBase, public ASIBase { public: Magnifier(); ~Magnifier(); @@ -38,8 +36,6 @@ class Magnifier : public CMagnifierBase, public ASIBase private: int SetMagnification(double mag); - std::string axis_; - int answerTimeoutMs_; + std::string axis_ = "M"; // normally the zoom axis is the M axis + int answerTimeoutMs_ = 1000; }; - -#endif // ASIMAGNIFIER_H diff --git a/DeviceAdapters/ASIStage/ASIStage.h b/DeviceAdapters/ASIStage/ASIStage.h index 30deeb993..389680500 100644 --- a/DeviceAdapters/ASIStage/ASIStage.h +++ b/DeviceAdapters/ASIStage/ASIStage.h @@ -10,8 +10,7 @@ // Modified by Nico Stuurman, 12/2007 // Refactored by Brandon Simpson, 3/2022 -#ifndef ASISTAGE_H -#define ASISTAGE_H +#pragma once #include "MMDevice.h" #include "DeviceBase.h" @@ -82,4 +81,3 @@ const char* const g_CRISP_Unknown = "Unknown"; MM::DeviceDetectionStatus ASIDetectDevice(MM::Device& device, MM::Core& core, const std::string& port, double answerTimeoutMs); void LogDeviceError(MM::Device& device, MM::Core& core, int errorCode); -#endif // ASISTAGE_H diff --git a/DeviceAdapters/ASIStage/ASIStateDevice.cpp b/DeviceAdapters/ASIStage/ASIStateDevice.cpp index 65532de78..93c6db13a 100644 --- a/DeviceAdapters/ASIStage/ASIStateDevice.cpp +++ b/DeviceAdapters/ASIStage/ASIStateDevice.cpp @@ -7,17 +7,10 @@ #include "ASIStateDevice.h" -StateDevice::StateDevice() : - ASIBase(this, ""), - numPos_(4), - axis_("F"), - position_(0), - answerTimeoutMs_(1000) -{ +StateDevice::StateDevice() : ASIBase(this, "") { InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_StateDeviceName, MM::String, true); @@ -144,12 +137,8 @@ int StateDevice::Initialize() return DEVICE_OK; } -int StateDevice::Shutdown() -{ - if (initialized_) - { - initialized_ = false; - } +int StateDevice::Shutdown() { + initialized_ = false; return DEVICE_OK; } diff --git a/DeviceAdapters/ASIStage/ASIStateDevice.h b/DeviceAdapters/ASIStage/ASIStateDevice.h index dc80b206b..327c0aaf9 100644 --- a/DeviceAdapters/ASIStage/ASIStateDevice.h +++ b/DeviceAdapters/ASIStage/ASIStateDevice.h @@ -5,13 +5,11 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASISTATEDEVICE_H -#define ASISTATEDEVICE_H +#pragma once #include "ASIBase.h" -class StateDevice : public CStateDeviceBase, public ASIBase -{ +class StateDevice : public CStateDeviceBase, public ASIBase { public: StateDevice(); ~StateDevice(); @@ -34,10 +32,8 @@ class StateDevice : public CStateDeviceBase, public ASIBase private: int UpdateCurrentPosition(); - long numPos_; - std::string axis_; - long position_; - double answerTimeoutMs_; + std::string axis_ = "F"; + long numPos_ = 4; + long position_ = 0; + double answerTimeoutMs_ = 1000; }; - -#endif // ASISTATEDEVICE_H diff --git a/DeviceAdapters/ASIStage/ASITIRF.cpp b/DeviceAdapters/ASIStage/ASITIRF.cpp index 4f4cf4bff..c8b791bf7 100644 --- a/DeviceAdapters/ASIStage/ASITIRF.cpp +++ b/DeviceAdapters/ASIStage/ASITIRF.cpp @@ -7,17 +7,10 @@ #include "ASITIRF.h" -TIRF::TIRF() : - ASIBase(this, ""), - axis_("F"), // normally the TIRF axis is the F axis - answerTimeoutMs_(1000), - scaleFactor_(1), - unitFactor_(10000) -{ +TIRF::TIRF() : ASIBase(this, "") { InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_TIRFDeviceName, MM::String, true); @@ -115,12 +108,8 @@ int TIRF::Initialize() return DEVICE_OK; } -int TIRF::Shutdown() -{ - if (initialized_) - { - initialized_ = false; - } +int TIRF::Shutdown() { + initialized_ = false; return DEVICE_OK; } diff --git a/DeviceAdapters/ASIStage/ASITIRF.h b/DeviceAdapters/ASIStage/ASITIRF.h index db724091b..7748ee570 100644 --- a/DeviceAdapters/ASIStage/ASITIRF.h +++ b/DeviceAdapters/ASIStage/ASITIRF.h @@ -5,13 +5,11 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASITIRF_H -#define ASITIRF_H +#pragma once #include "ASIBase.h" -class TIRF : public CGenericBase, public ASIBase -{ +class TIRF : public CGenericBase, public ASIBase { public: TIRF(); ~TIRF(); @@ -38,10 +36,8 @@ class TIRF : public CGenericBase, public ASIBase int SetAngle(double angle); double GetAngle(); - std::string axis_; - int answerTimeoutMs_; - double scaleFactor_; - double unitFactor_; + std::string axis_ = "F"; // normally the TIRF axis is the F axis + int answerTimeoutMs_ = 1000; + double scaleFactor_ = 1; + double unitFactor_ = 10000; }; - -#endif // ASITIRF_H diff --git a/DeviceAdapters/ASIStage/ASITurret.cpp b/DeviceAdapters/ASIStage/ASITurret.cpp index db69206d2..969a70c86 100644 --- a/DeviceAdapters/ASIStage/ASITurret.cpp +++ b/DeviceAdapters/ASIStage/ASITurret.cpp @@ -7,15 +7,10 @@ #include "ASITurret.h" -AZ100Turret::AZ100Turret() : - ASIBase(this, ""), - numPos_(4), - position_(0) -{ +AZ100Turret::AZ100Turret() : ASIBase(this, "") { InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_AZ100TurretName, MM::String, true); @@ -109,12 +104,8 @@ int AZ100Turret::Initialize() return DEVICE_OK; } -int AZ100Turret::Shutdown() -{ - if (initialized_) - { - initialized_ = false; - } +int AZ100Turret::Shutdown() { + initialized_ = false; return DEVICE_OK; } diff --git a/DeviceAdapters/ASIStage/ASITurret.h b/DeviceAdapters/ASIStage/ASITurret.h index 0f1ee0361..473ba461c 100644 --- a/DeviceAdapters/ASIStage/ASITurret.h +++ b/DeviceAdapters/ASIStage/ASITurret.h @@ -5,13 +5,11 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASITURRET_H -#define ASITURRET_H +#pragma once #include "ASIBase.h" -class AZ100Turret : public CStateDeviceBase, public ASIBase -{ +class AZ100Turret : public CStateDeviceBase, public ASIBase { public: AZ100Turret(); ~AZ100Turret(); @@ -28,9 +26,6 @@ class AZ100Turret : public CStateDeviceBase, public ASIBase int OnPort(MM::PropertyBase* pProp, MM::ActionType eAct); private: - MM::MMTime changedTime_; - long numPos_; - long position_; + long numPos_ = 4; + long position_ = 0; }; - -#endif // ASITURRET_H diff --git a/DeviceAdapters/ASIStage/ASIXYStage.cpp b/DeviceAdapters/ASIStage/ASIXYStage.cpp index 6af8b5b2f..ea0653e46 100644 --- a/DeviceAdapters/ASIStage/ASIXYStage.cpp +++ b/DeviceAdapters/ASIStage/ASIXYStage.cpp @@ -7,37 +7,10 @@ #include "ASIXYStage.h" -XYStage::XYStage() : - ASIBase(this, "2H"), // LX-4000 prefix - axisletterX_("X"), - axisletterY_("Y"), - stepSizeXUm_(0.0), - stepSizeYUm_(0.0), - maxSpeed_(7.5), - ASISerialUnit_(10.0), - motorOn_(true), - joyStickSpeedFast_(60), - joyStickSpeedSlow_(5), - joyStickMirror_(false), - nrMoveRepetitions_(0), - answerTimeoutMs_(1000), - stopSignal_(false), - serialOnlySendChanged_(true), - manualSerialAnswer_(""), - advancedPropsEnabled_(false), - // init cached properties - acceleration_(0), - waitCycles_(0), - speed_(0), - backlash_(0), - error_(0), - finishError_(0), - overShoot_(0) -{ +XYStage::XYStage() : ASIBase(this, "2H") { // "2H" is the LX-4000 prefix InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_XYStageDeviceName, MM::String, true); @@ -287,12 +260,8 @@ int XYStage::Initialize() return DEVICE_OK; } -int XYStage::Shutdown() -{ - if (initialized_) - { - initialized_ = false; - } +int XYStage::Shutdown() { + initialized_ = false; return DEVICE_OK; } diff --git a/DeviceAdapters/ASIStage/ASIXYStage.h b/DeviceAdapters/ASIStage/ASIXYStage.h index 9555828ca..d9a54c380 100644 --- a/DeviceAdapters/ASIStage/ASIXYStage.h +++ b/DeviceAdapters/ASIStage/ASIXYStage.h @@ -5,8 +5,7 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASIXYSTAGE_H -#define ASIXYSTAGE_H +#pragma once #include "ASIBase.h" @@ -89,30 +88,28 @@ class XYStage : public CXYStageBase, public ASIBase int OnVectorY(MM::PropertyBase* pProp, MM::ActionType eAct) { return OnVectorGeneric(pProp, eAct, axisletterY_); } - std::string axisletterX_; - std::string axisletterY_; - double stepSizeXUm_; - double stepSizeYUm_; - double maxSpeed_; - double ASISerialUnit_; // this variable converts the floating point number provided by ASI (in 10ths of microns) into a long - bool motorOn_; - int joyStickSpeedFast_; - int joyStickSpeedSlow_; - bool joyStickMirror_; - long nrMoveRepetitions_; - double answerTimeoutMs_; - bool stopSignal_; - bool serialOnlySendChanged_; // if true the serial command is only sent when it has changed - std::string manualSerialAnswer_; // last answer received when the SerialCommand property was used - bool advancedPropsEnabled_; + std::string axisletterX_ = "X"; + std::string axisletterY_ = "Y"; + double stepSizeXUm_= 0.0; + double stepSizeYUm_ = 0.0; + double maxSpeed_ = 7.5; + double ASISerialUnit_ = 10.0; // this variable converts the floating point number provided by ASI (in 10ths of microns) into a long + bool motorOn_ = true; + int joyStickSpeedFast_ = 60; + int joyStickSpeedSlow_ = 5; + bool joyStickMirror_ = false; + long nrMoveRepetitions_ = 0; + double answerTimeoutMs_ = 1000; + bool stopSignal_ = false; + bool serialOnlySendChanged_ = true; // if true the serial command is only sent when it has changed + std::string manualSerialAnswer_{}; // last answer received when the SerialCommand property was used + bool advancedPropsEnabled_ = false; // cached properties - long acceleration_; - long waitCycles_; - double speed_; - double backlash_; - double error_; - double finishError_; - double overShoot_; + long acceleration_ = 0; + long waitCycles_ = 0; + double speed_ = 0; + double backlash_ = 0; + double error_ = 0; + double finishError_ = 0; + double overShoot_ = 0; }; - -#endif // ASIXYSTAGE_H diff --git a/DeviceAdapters/ASIStage/ASIZStage.cpp b/DeviceAdapters/ASIStage/ASIZStage.cpp index 6d6e14185..93486f823 100644 --- a/DeviceAdapters/ASIStage/ASIZStage.cpp +++ b/DeviceAdapters/ASIStage/ASIZStage.cpp @@ -7,36 +7,10 @@ #include "ASIZStage.h" -ZStage::ZStage() : - ASIBase(this, "1H"), // LX-4000 prefix - axis_("Z"), - axisNr_(4), - stepSizeUm_(0.1), - answerTimeoutMs_(1000), - sequenceable_(false), - runningFastSequence_(false), - hasRingBuffer_(false), - nrEvents_(0), - curSteps_(0), - maxSpeed_(7.5), - motorOn_(true), - supportsLinearSequence_(false), - linearSequenceIntervalUm_(0.0), - linearSequenceLength_(0), - linearSequenceTimeoutMs_(10000), - // init cached properties - speed_(0), - waitCycles_(0), - backlash_(0), - error_(0), - acceleration_(0), - finishError_(0), - overShoot_(0) -{ +ZStage::ZStage() : ASIBase(this, "1H") { // "1H" is the LX-4000 prefix InitializeDefaultErrorMessages(); - // create pre-initialization properties - // ------------------------------------ + // create pre-init properties // Name CreateProperty(MM::g_Keyword_Name, g_ZStageDeviceName, MM::String, true); @@ -280,12 +254,8 @@ int ZStage::Initialize() return DEVICE_OK; } -int ZStage::Shutdown() -{ - if (initialized_) - { - initialized_ = false; - } +int ZStage::Shutdown() { + initialized_ = false; return DEVICE_OK; } diff --git a/DeviceAdapters/ASIStage/ASIZStage.h b/DeviceAdapters/ASIStage/ASIZStage.h index f9a5cfefe..e7f2f7054 100644 --- a/DeviceAdapters/ASIStage/ASIZStage.h +++ b/DeviceAdapters/ASIStage/ASIZStage.h @@ -5,8 +5,7 @@ * Jon Daniels (jon@asiimaging.com) */ -#ifndef ASIZSTAGE_H -#define ASIZSTAGE_H +#pragma once #include "ASIBase.h" @@ -83,30 +82,28 @@ class ZStage : public CStageBase, public ASIBase bool HasCommand(const std::string& command); int OnVector(MM::PropertyBase* pProp, MM::ActionType eAct); - std::vector sequence_; - std::string axis_; - unsigned int axisNr_; - double stepSizeUm_; - double answerTimeoutMs_; - bool sequenceable_; - bool runningFastSequence_; - bool hasRingBuffer_; - long nrEvents_; - long curSteps_; - double maxSpeed_; - bool motorOn_; - bool supportsLinearSequence_; - double linearSequenceIntervalUm_; - long linearSequenceLength_; - long linearSequenceTimeoutMs_; + std::vector sequence_{}; + std::string axis_ = "Z"; + unsigned int axisNr_ = 4; + double stepSizeUm_ = 0.1; + double answerTimeoutMs_ = 1000; + bool sequenceable_ = false; + bool runningFastSequence_ = false; + bool hasRingBuffer_ = false; + long nrEvents_ = 0; + long curSteps_ = 0; + double maxSpeed_ = 7.5; + bool motorOn_ = true; + bool supportsLinearSequence_ = false; + double linearSequenceIntervalUm_ = 0.0; + long linearSequenceLength_ = 0; + long linearSequenceTimeoutMs_ = 10000; // cached properties - double speed_; - long waitCycles_; - double backlash_; - double error_; - long acceleration_; - double finishError_; - double overShoot_; + double speed_ = 0; + long waitCycles_ = 0; + double backlash_ = 0; + double error_ = 0; + long acceleration_ = 0; + double finishError_ = 0; + double overShoot_ = 0; }; - -#endif // ASIZSTAGE_H