Skip to content

Commit

Permalink
Found some more references to MMPump
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars-Kool committed Jun 24, 2024
1 parent 5fdca38 commit 3fca3cf
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 22 deletions.
79 changes: 62 additions & 17 deletions MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ CMMCore::~CMMCore()
delete properties_;
delete cbuf_;
delete pixelSizeGroup_;
delete pixelSizeGroup_;
delete pPostedErrorsLock_;

LOG_INFO(coreLogger_) << "Core session ended";
Expand Down Expand Up @@ -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<PumpInstance> camera = currentPumpDevice_.lock();
if (camera)
std::shared_ptr<PressurePumpInstance> 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<VolumetricPumpInstance> pump = currentVolumetricPump_.lock();
if (pump)
{
return pump->GetLabel();
}
return std::string();
}
Expand Down Expand Up @@ -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<PumpInstance>(deviceLabel);
currentPressurePump_ =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(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
*/
Expand Down Expand Up @@ -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<VolumetricPumpInstance>(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
*/
Expand Down
11 changes: 7 additions & 4 deletions MMCore/MMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

class CPluginManager;
class CircularBuffer;
class CircularBuffer;
class ConfigGroupCollection;
class CoreCallback;
class CorePropertyCollection;
Expand All @@ -100,7 +101,6 @@ class AutoFocusInstance;
class CameraInstance;
class DeviceInstance;
class GalvoInstance;
class PumpInstance;
class ImageProcessorInstance;
class SLMInstance;
class ShutterInstance;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
///@}

Expand Down Expand Up @@ -684,8 +686,9 @@ class CMMCore
std::weak_ptr<AutoFocusInstance> currentAutofocusDevice_;
std::weak_ptr<SLMInstance> currentSLMDevice_;
std::weak_ptr<GalvoInstance> currentGalvoDevice_;
std::weak_ptr<PumpInstance> currentPumpDevice_;
std::weak_ptr<ImageProcessorInstance> currentImageProcessor_;
std::weak_ptr<PressurePumpInstance> currentPressurePump_;
std::weak_ptr<VolumetricPumpInstance> currentVolumetricPump_;

std::string channelGroup_;
long pollingIntervalMs_;
Expand Down
3 changes: 2 additions & 1 deletion MMDevice/MMDeviceConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 3fca3cf

Please sign in to comment.