From f48bbf5afb37a581a5bfe4a5fa4fb589328902ed Mon Sep 17 00:00:00 2001 From: Lars Kool Date: Wed, 9 Oct 2024 09:30:03 +0200 Subject: [PATCH] Removed currentPumpDevices, added units to pump method names, removed spurious change of micromanager.sln --- MMCore/MMCore.cpp | 117 +++++----------------------------------------- MMCore/MMCore.h | 26 +++++------ 2 files changed, 22 insertions(+), 121 deletions(-) diff --git a/MMCore/MMCore.cpp b/MMCore/MMCore.cpp index 09168bc26..0d47abdf2 100644 --- a/MMCore/MMCore.cpp +++ b/MMCore/MMCore.cpp @@ -3229,32 +3229,6 @@ std::string CMMCore::getAutoFocusDevice() return std::string(); } -/** - * Returns the label of the currently selected pressure pump. - */ -std::string CMMCore::getPressurePumpDevice() -{ - std::shared_ptr pump = currentPressurePump_.lock(); - if (pump) - { - return pump->GetLabel(); - } - return std::string(); -} - -/** - * Returns the label of the currently selected volumetric pump. - */ -std::string CMMCore::getVolumetricPumpDevice() -{ - std::shared_ptr pump = currentVolumetricPump_.lock(); - if (pump) - { - return pump->GetLabel(); - } - return std::string(); -} - /** * Sets the current auto-focus device. */ @@ -6245,43 +6219,11 @@ std::string CMMCore::getGalvoChannel(const char* deviceLabel) throw (CMMError) // Pressure Pump methods /////////////////////////////////////////////////////////////////////////////// -/** - * Sets the current pump device. - * @param pump the shutter device label - */ -void CMMCore::setPressurePumpDevice(const char* deviceLabel) throw (CMMError) -{ - if (!deviceLabel || strlen(deviceLabel) > 0) // Allow empty label - CheckDeviceLabel(deviceLabel); - - // Nothing to do if this is the current shutter device: - if (getPressurePumpDevice().compare(deviceLabel) == 0) - return; - - if (strlen(deviceLabel) > 0) - { - currentPressurePump_ = - deviceManager_->GetDeviceOfType(deviceLabel); - - LOG_INFO(coreLogger_) << "Default shutter set to " << deviceLabel; - } - else - { - currentPressurePump_.reset(); - LOG_INFO(coreLogger_) << "Default pump unset"; - } - properties_->Refresh(); // TODO: more efficient - std::string newPumpLabel = getPressurePumpDevice(); - { - MMThreadGuard scg(stateCacheLock_); - stateCache_.addSetting(PropertySetting(MM::g_Keyword_CoreDevice, MM::g_Keyword_CorePressurePump, newPumpLabel.c_str())); - } -} /** * Stops the pressure pump */ -void CMMCore::PressurePumpStop(const char* deviceLabel) throw (CMMError) +void CMMCore::pressurePumpStop(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6299,7 +6241,7 @@ void CMMCore::PressurePumpStop(const char* deviceLabel) throw (CMMError) /** * Calibrates the pump */ -void CMMCore::PressurePumpCalibrate(const char* deviceLabel) throw (CMMError) +void CMMCore::pressurePumpCalibrate(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6317,7 +6259,7 @@ void CMMCore::PressurePumpCalibrate(const char* deviceLabel) throw (CMMError) /** * Returns boolean whether the pump is operational before calibration */ -bool CMMCore::PressurePumpRequiresCalibration(const char* deviceLabel) throw (CMMError) +bool CMMCore::pressurePumpRequiresCalibration(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6329,7 +6271,7 @@ bool CMMCore::PressurePumpRequiresCalibration(const char* deviceLabel) throw (CM /** * Gets the pressure of the pump in kPa */ -double CMMCore::getPumpPressure(const char* deviceLabel) throw (CMMError) +double CMMCore::getPumpPressureKPa(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6349,7 +6291,7 @@ double CMMCore::getPumpPressure(const char* deviceLabel) throw (CMMError) /** * Sets the pressure of the pump in kPa */ -void CMMCore::setPumpPressure(const char* deviceLabel, double pressurekPa) throw (CMMError) +void CMMCore::setPumpPressureKPa(const char* deviceLabel, double pressurekPa) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6364,47 +6306,10 @@ void CMMCore::setPumpPressure(const char* deviceLabel, double pressurekPa) throw } } -/////////////////////////////////////////////////////////////////////////////// -// Volumetric Pump methods -/////////////////////////////////////////////////////////////////////////////// - -/** - * Sets the current pump device. - * @param pump the shutter device label - */ -void CMMCore::setVolumetricPumpDevice(const char* deviceLabel) throw (CMMError) -{ - if (!deviceLabel || strlen(deviceLabel) > 0) // Allow empty label - CheckDeviceLabel(deviceLabel); - - // Nothing to do if this is the current shutter device: - if (getVolumetricPumpDevice().compare(deviceLabel) == 0) - return; - - if (strlen(deviceLabel) > 0) - { - currentVolumetricPump_ = - deviceManager_->GetDeviceOfType(deviceLabel); - - LOG_INFO(coreLogger_) << "Default shutter set to " << deviceLabel; - } - else - { - currentVolumetricPump_.reset(); - LOG_INFO(coreLogger_) << "Default pump unset"; - } - properties_->Refresh(); // TODO: more efficient - std::string newPumpLabel = getVolumetricPumpDevice(); - { - MMThreadGuard scg(stateCacheLock_); - stateCache_.addSetting(PropertySetting(MM::g_Keyword_CoreDevice, MM::g_Keyword_CoreVolumetricPump, newPumpLabel.c_str())); - } -} - /** * Stops the volumetric pump */ -void CMMCore::VolumetricPumpStop(const char* deviceLabel) throw (CMMError) +void CMMCore::volumetricPumpStop(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6422,7 +6327,7 @@ void CMMCore::VolumetricPumpStop(const char* deviceLabel) throw (CMMError) /** * Homes the pump */ -void CMMCore::VolumetricPumpHome(const char* deviceLabel) throw (CMMError) +void CMMCore::volumetricPumpHome(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6437,7 +6342,7 @@ void CMMCore::VolumetricPumpHome(const char* deviceLabel) throw (CMMError) } } -bool CMMCore::VolumetricPumpRequiresHoming(const char* deviceLabel) throw (CMMError) +bool CMMCore::volumetricPumpRequiresHoming(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6603,7 +6508,7 @@ double CMMCore::getPumpFlowrate(const char* deviceLabel) throw (CMMError) * Start dispensing at the set flowrate until syringe is empty, or manually * stopped (whichever occurs first). */ -void CMMCore::PumpStart(const char* deviceLabel) throw (CMMError) +void CMMCore::pumpStart(const char* deviceLabel) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6621,7 +6526,7 @@ void CMMCore::PumpStart(const char* deviceLabel) throw (CMMError) /** * Dispenses for the provided duration (in seconds) at the set flowrate */ -void CMMCore::PumpDispenseDuration(const char* deviceLabel, double seconds) throw (CMMError) +void CMMCore::pumpDispenseDurationSeconds(const char* deviceLabel, double seconds) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); @@ -6639,7 +6544,7 @@ void CMMCore::PumpDispenseDuration(const char* deviceLabel, double seconds) thro /** * Dispenses the provided volume (in uL) at the set flowrate */ -void CMMCore::PumpDispenseVolume(const char* deviceLabel, double microLiter) throw (CMMError) +void CMMCore::pumpDispenseVolumeUl(const char* deviceLabel, double microLiter) throw (CMMError) { std::shared_ptr pPump = deviceManager_->GetDeviceOfType(deviceLabel); diff --git a/MMCore/MMCore.h b/MMCore/MMCore.h index c667a8ae1..b9c408841 100644 --- a/MMCore/MMCore.h +++ b/MMCore/MMCore.h @@ -279,8 +279,6 @@ class CMMCore std::string getImageProcessorDevice(); std::string getSLMDevice(); std::string getGalvoDevice(); - std::string getPressurePumpDevice(); - std::string getVolumetricPumpDevice(); std::string getChannelGroup(); void setCameraDevice(const char* cameraLabel) throw (CMMError); void setShutterDevice(const char* shutterLabel) throw (CMMError); @@ -290,8 +288,6 @@ class CMMCore void setImageProcessorDevice(const char* procLabel) throw (CMMError); void setSLMDevice(const char* slmLabel) throw (CMMError); void setGalvoDevice(const char* galvoLabel) throw (CMMError); - void setPressurePumpDevice(const char* pumpLabel) throw (CMMError); - void setVolumetricPumpDevice(const char* pumpLabel) throw (CMMError); void setChannelGroup(const char* channelGroup) throw (CMMError); ///@} @@ -618,11 +614,11 @@ class CMMCore * Control of pressure pumps */ ///@{ - void PressurePumpStop(const char* pumpLabel) throw (CMMError); - void PressurePumpCalibrate(const char* pumpLabel) throw (CMMError); - bool PressurePumpRequiresCalibration(const char* pumpLabel) throw (CMMError); - void setPumpPressure(const char* pumplabel, double pressure) throw (CMMError); - double getPumpPressure(const char* pumplabel) throw (CMMError); + void pressurePumpStop(const char* pumpLabel) throw (CMMError); + void pressurePumpCalibrate(const char* pumpLabel) throw (CMMError); + bool pressurePumpRequiresCalibration(const char* pumpLabel) throw (CMMError); + void setPumpPressureKPa(const char* pumplabel, double pressure) throw (CMMError); + double getPumpPressureKPa(const char* pumplabel) throw (CMMError); ///@} /** \name VolumetricPump control @@ -630,9 +626,9 @@ class CMMCore * Control of volumetric pumps */ ///@{ - void VolumetricPumpStop(const char* pumpLabel) throw (CMMError); - void VolumetricPumpHome(const char* pumpLabel) throw (CMMError); - bool VolumetricPumpRequiresHoming(const char* pumpLabel) throw (CMMError); + void volumetricPumpStop(const char* pumpLabel) throw (CMMError); + void volumetricPumpHome(const char* pumpLabel) throw (CMMError); + bool volumetricPumpRequiresHoming(const char* pumpLabel) throw (CMMError); void invertPumpDirection(const char* pumpLabel, bool invert) throw (CMMError); bool isPumpDirectionInverted(const char* pumpLabel) throw (CMMError); void setPumpVolume(const char* pumpLabel, double volume) throw (CMMError); @@ -641,9 +637,9 @@ class CMMCore double getPumpMaxVolume(const char* pumpLabel) throw (CMMError); void setPumpFlowrate(const char* pumpLabel, double volume) throw (CMMError); double getPumpFlowrate(const char* pumpLabel) throw (CMMError); - void PumpStart(const char* pumpLabel) throw (CMMError); - void PumpDispenseDuration(const char* pumpLabel, double seconds) throw (CMMError); - void PumpDispenseVolume(const char* pumpLabel, double microLiter) throw (CMMError); + void pumpStart(const char* pumpLabel) throw (CMMError); + void pumpDispenseDurationSeconds(const char* pumpLabel, double seconds) throw (CMMError); + void pumpDispenseVolumeUl(const char* pumpLabel, double microLiter) throw (CMMError); ///@} /** \name Device discovery. */