From 3fca3cf21ca35b3be809ba0d01fbba3053cf5820 Mon Sep 17 00:00:00 2001 From: Lars Kool Date: Mon, 24 Jun 2024 11:26:41 +0200 Subject: [PATCH] Found some more references to MMPump --- MMCore/MMCore.cpp | 79 ++++++++++++++++++++++++++++-------- MMCore/MMCore.h | 11 +++-- MMDevice/MMDeviceConstants.h | 3 +- 3 files changed, 71 insertions(+), 22 deletions(-) diff --git a/MMCore/MMCore.cpp b/MMCore/MMCore.cpp index 576fbd93e..2098be6fc 100644 --- a/MMCore/MMCore.cpp +++ b/MMCore/MMCore.cpp @@ -179,6 +179,7 @@ CMMCore::~CMMCore() delete properties_; delete cbuf_; delete pixelSizeGroup_; + delete pixelSizeGroup_; delete pPostedErrorsLock_; LOG_INFO(coreLogger_) << "Core session ended"; @@ -3229,14 +3230,27 @@ std::string CMMCore::getAutoFocusDevice() } /** - * Returns the label of the currently selected pump device. + * Returns the label of the currently selected pressure pump. */ -std::string CMMCore::getPumpDevice() +std::string CMMCore::getPressurePumpDevice() { - std::shared_ptr camera = currentPumpDevice_.lock(); - if (camera) + std::shared_ptr pump = currentPressurePump_.lock(); + if (pump) { - return camera->GetLabel(); + 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(); } @@ -6227,45 +6241,43 @@ std::string CMMCore::getGalvoChannel(const char* deviceLabel) throw (CMMError) return pGalvo->GetChannel(); } -/* Pump device */ +/////////////////////////////////////////////////////////////////////////////// +// Pressure Pump methods +/////////////////////////////////////////////////////////////////////////////// /** * Sets the current pump device. * @param pump the shutter device label */ -void CMMCore::setPumpDevice(const char* deviceLabel) throw (CMMError) +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 (getPumpDevice().compare(deviceLabel) == 0) + if (getPressurePumpDevice().compare(deviceLabel) == 0) return; if (strlen(deviceLabel) > 0) { - currentPumpDevice_ = - deviceManager_->GetDeviceOfType(deviceLabel); + currentPressurePump_ = + deviceManager_->GetDeviceOfType(deviceLabel); LOG_INFO(coreLogger_) << "Default shutter set to " << deviceLabel; } else { - currentPumpDevice_.reset(); + currentPressurePump_.reset(); LOG_INFO(coreLogger_) << "Default pump unset"; } properties_->Refresh(); // TODO: more efficient - std::string newPumpLabel = getPumpDevice(); + std::string newPumpLabel = getPressurePumpDevice(); { MMThreadGuard scg(stateCacheLock_); - stateCache_.addSetting(PropertySetting(MM::g_Keyword_CoreDevice, MM::g_Keyword_CorePump, newPumpLabel.c_str())); + stateCache_.addSetting(PropertySetting(MM::g_Keyword_CoreDevice, MM::g_Keyword_CorePressurePump, newPumpLabel.c_str())); } } -/////////////////////////////////////////////////////////////////////////////// -// Pressure Pump methods -/////////////////////////////////////////////////////////////////////////////// - /** * Stops the pressure pump */ @@ -6356,6 +6368,39 @@ double CMMCore::getPumpPressure(const char* deviceLabel) throw (CMMError) // 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 */ diff --git a/MMCore/MMCore.h b/MMCore/MMCore.h index e7eec7e70..e453e5842 100644 --- a/MMCore/MMCore.h +++ b/MMCore/MMCore.h @@ -89,6 +89,7 @@ class CPluginManager; class CircularBuffer; +class CircularBuffer; class ConfigGroupCollection; class CoreCallback; class CorePropertyCollection; @@ -100,7 +101,6 @@ class AutoFocusInstance; class CameraInstance; class DeviceInstance; class GalvoInstance; -class PumpInstance; class ImageProcessorInstance; class SLMInstance; class ShutterInstance; @@ -280,7 +280,8 @@ class CMMCore std::string getImageProcessorDevice(); std::string getSLMDevice(); std::string getGalvoDevice(); - std::string getPumpDevice(); + std::string getPressurePumpDevice(); + std::string getVolumetricPumpDevice(); std::string getChannelGroup(); void setCameraDevice(const char* cameraLabel) throw (CMMError); void setShutterDevice(const char* shutterLabel) throw (CMMError); @@ -290,7 +291,8 @@ class CMMCore void setImageProcessorDevice(const char* procLabel) throw (CMMError); void setSLMDevice(const char* slmLabel) throw (CMMError); void setGalvoDevice(const char* galvoLabel) throw (CMMError); - void setPumpDevice(const char* pumpLabel) throw (CMMError); + void setPressurePumpDevice(const char* pumpLabel) throw (CMMError); + void setVolumetricPumpDevice(const char* pumpLabel) throw (CMMError); void setChannelGroup(const char* channelGroup) throw (CMMError); ///@} @@ -684,8 +686,9 @@ class CMMCore std::weak_ptr currentAutofocusDevice_; std::weak_ptr currentSLMDevice_; std::weak_ptr currentGalvoDevice_; - std::weak_ptr currentPumpDevice_; std::weak_ptr currentImageProcessor_; + std::weak_ptr currentPressurePump_; + std::weak_ptr currentVolumetricPump_; std::string channelGroup_; long pollingIntervalMs_; diff --git a/MMDevice/MMDeviceConstants.h b/MMDevice/MMDeviceConstants.h index eaad137e6..1679eaa64 100644 --- a/MMDevice/MMDeviceConstants.h +++ b/MMDevice/MMDeviceConstants.h @@ -131,7 +131,8 @@ namespace MM { const char* const g_Keyword_CoreImageProcessor = "ImageProcessor"; const char* const g_Keyword_CoreSLM = "SLM"; const char* const g_Keyword_CoreGalvo = "Galvo"; - const char* const g_Keyword_CorePump = "Pump"; + const char* const g_Keyword_CorePressurePump = "PressurePump"; + const char* const g_Keyword_CoreVolumetricPump = "VolumetricPump"; const char* const g_Keyword_CoreTimeoutMs = "TimeoutMs"; const char* const g_Keyword_Channel = "Channel"; const char* const g_Keyword_Version = "Version";