Skip to content

Commit

Permalink
Removed currentPumpDevices, added units to pump method names, removed…
Browse files Browse the repository at this point in the history
… spurious change of micromanager.sln
  • Loading branch information
Lars-Kool committed Oct 9, 2024
1 parent 6c19f81 commit f48bbf5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 121 deletions.
117 changes: 11 additions & 106 deletions MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PressurePumpInstance> 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<VolumetricPumpInstance> pump = currentVolumetricPump_.lock();
if (pump)
{
return pump->GetLabel();
}
return std::string();
}

/**
* Sets the current auto-focus device.
*/
Expand Down Expand Up @@ -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<PressurePumpInstance>(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<PressurePumpInstance> pPump =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(deviceLabel);
Expand All @@ -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<PressurePumpInstance> pPump =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(deviceLabel);
Expand All @@ -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<PressurePumpInstance> pPump =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(deviceLabel);
Expand All @@ -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<PressurePumpInstance> pPump =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(deviceLabel);
Expand All @@ -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<PressurePumpInstance> pPump =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(deviceLabel);
Expand All @@ -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<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
*/
void CMMCore::VolumetricPumpStop(const char* deviceLabel) throw (CMMError)
void CMMCore::volumetricPumpStop(const char* deviceLabel) throw (CMMError)
{
std::shared_ptr<VolumetricPumpInstance> pPump =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(deviceLabel);
Expand All @@ -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<VolumetricPumpInstance> pPump =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(deviceLabel);
Expand All @@ -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<VolumetricPumpInstance> pPump =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(deviceLabel);
Expand Down Expand Up @@ -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<VolumetricPumpInstance> pPump =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(deviceLabel);
Expand All @@ -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<VolumetricPumpInstance> pPump =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(deviceLabel);
Expand All @@ -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<VolumetricPumpInstance> pPump =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(deviceLabel);
Expand Down
26 changes: 11 additions & 15 deletions MMCore/MMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
///@}

Expand Down Expand Up @@ -618,21 +614,21 @@ 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
*
* 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);
Expand All @@ -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. */
Expand Down

0 comments on commit f48bbf5

Please sign in to comment.