Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of generic pump device #462

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
139 changes: 72 additions & 67 deletions DeviceAdapters/ASITiger/ASIPLogic.cpp

Large diffs are not rendered by default.

33 changes: 21 additions & 12 deletions DeviceAdapters/ASITiger/ASIPLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
// BASED ON: ASIStage.h and others
//

#ifndef _ASIPLOGIC_H_
#define _ASIPLOGIC_H_
#ifndef ASIPLOGIC_H
#define ASIPLOGIC_H

#include "ASIPeripheralBase.h"
#include "MMDevice.h"
Expand All @@ -36,7 +36,6 @@ class CPLogic : public ASIPeripheralBase<CShutterBase, CPLogic>
~CPLogic() { }

// Device API
// ----------
int Initialize();
bool Busy() { return false; }

Expand All @@ -46,7 +45,6 @@ class CPLogic : public ASIPeripheralBase<CShutterBase, CPLogic>
int Fire(double /*deltaT*/) { return DEVICE_UNSUPPORTED_COMMAND; }

// action interface
// ----------------
int OnPLogicMode (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetShutterChannel (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnPLogicOutputState (MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down Expand Up @@ -78,24 +76,35 @@ class CPLogic : public ASIPeripheralBase<CShutterBase, CPLogic>


private:
string axisLetter_;
std::string axisLetter_;
unsigned int numCells_;
unsigned int currentPosition_; // cached value of current position
// static const int NUM_CELLS = 16;
bool useAsdiSPIMShutter_; // used together with either useAs4ChShutter_ or useAs7ChShutter_, takes into account address 41 backplane (TTL0 for CameraA)

// PLogic Mode Table
// --------------------
// diSPIM | 4ch | 7ch | (useAsdiSPIMShutter_, useAs4ChShutter_, useAs7ChShutter_)
// --------------------
// 0 | 0 | 0 | "None"
// 1 | 1 | 0 | "diSPIM Shutter"
// 0 | 1 | 0 | "Four-channel shutter"
// 0 | 0 | 1 | "Seven-channel shutter"
// 1 | 0 | 1 | "Seven-channel TTL shutter"
bool useAsdiSPIMShutter_;
bool useAs4ChShutter_;
bool useAs7ChShutter_;
// used together with either useAs4ChShutter_ or useAs7ChShutter_,
// takes into account address 41 backplane (TTL0 for CameraA)

bool shutterOpen_;
bool advancedPropsEnabled_;
bool editCellUpdates_;
bool advancedPropsEnabled_; // flag to only create advanced properties once

int SetShutterChannel();
int SetPositionDirectly(unsigned int position);
int GetCellPropertyName(long index, string suffix, char* name);
int GetIOPropertyName(long index, string suffix, char* name);
int GetCellPropertyName(long index, const std::string& suffix, char* name);
int GetIOPropertyName(long index, const std::string& suffix, char* name);
int RefreshAdvancedCellPropertyValues(long index);
int RefreshCurrentPosition();
int RefreshEditCellPropertyValues();
};

#endif //_ASIPLOGIC_H_
#endif // ASIPLOGIC_H
2 changes: 2 additions & 0 deletions DeviceAdapters/ASITiger/ASITiger.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ const char* const g_CellTypeCode12 = "12 - D flop (sync)";
const char* const g_CellTypeCode13 = "13 - JK flop";
const char* const g_CellTypeCode14 = "14 - one shot (NRT)";
const char* const g_CellTypeCode15 = "15 - delay (NRT)";
const char* const g_CellTypeCode16 = "16 - one shot OR2 (NRT)";
const char* const g_CellTypeCode17 = "17 - delay OR2 (NRT)";
const char* const g_IOTypeCode0 = "0 - input";
const char* const g_IOTypeCode1 = "1 - output (open-drain)";
const char* const g_IOTypeCode2 = "2 - output (push-pull)";
Expand Down
2 changes: 2 additions & 0 deletions MMCore/CoreUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ inline std::string ToString(const MM::DeviceType d)
case MM::SLMDevice: return "SLM";
case MM::HubDevice: return "Hub";
case MM::GalvoDevice: return "Galvo";
case MM::PressurePumpDevice: return "PressurePump";
case MM::VolumetricPumpDevice: return "VolumetricPump";
}
return "Invalid";
}
Expand Down
2 changes: 2 additions & 0 deletions MMCore/Devices/DeviceInstances.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@
#include "SLMInstance.h"
#include "GalvoInstance.h"
#include "HubInstance.h"
#include "PressurePumpInstance.h"
#include "VolumetricPumpInstance.h"
30 changes: 30 additions & 0 deletions MMCore/Devices/PressurePumpInstance.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//
// DESCRIPTION: PressurePump device instance wrapper
//
// COPYRIGHT: Institut Pierre-Gilles de Gennes, Paris, 2024,
// All Rights reserved
//
// LICENSE: This file is distributed under the "Lesser GPL" (LGPL) license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR: Lars Kool, Institut Pierre-Gilles de Gennes

#include "PressurePumpInstance.h"
#include "../../MMDevice/MMDeviceConstants.h"

// General pump functions
int PressurePumpInstance::Stop() { return GetImpl()->Stop(); }
int PressurePumpInstance::Calibrate() { return GetImpl()->Calibrate(); }
bool PressurePumpInstance::requiresCalibration() { return GetImpl()->RequiresCalibration(); }
int PressurePumpInstance::setPressure(double pressure) { return GetImpl()->SetPressure(pressure); }
int PressurePumpInstance::getPressure(double& pressure) { return GetImpl()->GetPressure(pressure); }
45 changes: 45 additions & 0 deletions MMCore/Devices/PressurePumpInstance.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//
// DESCRIPTION: Pump device instance wrapper
//
// COPYRIGHT: Institut Pierre-Gilles de Gennes, Paris, 2024,
// All Rights reserved
//
// LICENSE: This file is distributed under the "Lesser GPL" (LGPL) license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR: Lars Kool, Institut Pierre-Gilles de Gennes

#include "DeviceInstanceBase.h"
#include "../../MMDevice/MMDeviceConstants.h"

class PressurePumpInstance : public DeviceInstanceBase<MM::PressurePump>
{
public:
PressurePumpInstance(CMMCore* core,
std::shared_ptr<LoadedDeviceAdapter> adapter,
const std::string& name,
MM::Device* pDevice,
DeleteDeviceFunction deleteFunction,
const std::string& label,
mm::logging::Logger deviceLogger,
mm::logging::Logger coreLogger) :
DeviceInstanceBase<MM::PressurePump>(core, adapter, name, pDevice, deleteFunction, label, deviceLogger, coreLogger)
{}


int Calibrate();
int Stop();
bool requiresCalibration();
int setPressure(double pressure);
int getPressure(double& pressure);
};
39 changes: 39 additions & 0 deletions MMCore/Devices/VolumetricPumpInstance.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//
// DESCRIPTION: Pump device instance wrapper
//
// COPYRIGHT: Institut Pierre-Gilles de Gennes, Paris, 2024,
// All Rights reserved
//
// LICENSE: This file is distributed under the "Lesser GPL" (LGPL) license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR: Lars Kool, Institut Pierre-Gilles de Gennes

#include "VolumetricPumpInstance.h"
#include "../../MMDevice/MMDeviceConstants.h"

// Volume controlled pump functions
int VolumetricPumpInstance::Home() { return GetImpl()->Home(); }
int VolumetricPumpInstance::Stop() { return GetImpl()->Stop(); }
bool VolumetricPumpInstance::requiresHoming() { return GetImpl()->RequiresHoming(); }
int VolumetricPumpInstance::invertDirection(bool state) { return GetImpl()->InvertDirection(state); }
int VolumetricPumpInstance::isDirectionInverted(bool& state) { return GetImpl()->IsDirectionInverted(state); }
int VolumetricPumpInstance::setVolumeUl(double volume) { return GetImpl()->SetVolumeUl(volume); }
int VolumetricPumpInstance::getVolumeUl(double& volume) { return GetImpl()->GetVolumeUl(volume); }
int VolumetricPumpInstance::setMaxVolumeUl(double volume) { return GetImpl()->SetMaxVolumeUl(volume); }
int VolumetricPumpInstance::getMaxVolumeUl(double& volume) { return GetImpl()->GetMaxVolumeUl(volume); }
int VolumetricPumpInstance::setFlowrateUlPerSec(double flowrate) { return GetImpl()->SetFlowrateUlPerSecond(flowrate); }
int VolumetricPumpInstance::getFlowrateUlPerSec(double& flowrate) { return GetImpl()->GetFlowrateUlPerSecond(flowrate); }
int VolumetricPumpInstance::Start() { return GetImpl()->Start(); }
int VolumetricPumpInstance::DispenseDuration(double durSec) { return GetImpl()->DispenseDuration(durSec); }
int VolumetricPumpInstance::DispenseVolume(double volUl) { return GetImpl()->DispenseVolume(volUl); }
53 changes: 53 additions & 0 deletions MMCore/Devices/VolumetricPumpInstance.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//
// DESCRIPTION: Pump device instance wrapper
//
// COPYRIGHT: Institut Pierre-Gilles de Gennes, Paris, 2024,
// All Rights reserved
//
// LICENSE: This file is distributed under the "Lesser GPL" (LGPL) license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR: Lars Kool, Institut Pierre-Gilles de Gennes

#include "DeviceInstanceBase.h"
#include "../../MMDevice/MMDeviceConstants.h"

class VolumetricPumpInstance : public DeviceInstanceBase<MM::VolumetricPump>
{
public:
VolumetricPumpInstance(CMMCore* core,
std::shared_ptr<LoadedDeviceAdapter> adapter,
const std::string& name,
MM::Device* pDevice,
DeleteDeviceFunction deleteFunction,
const std::string& label,
mm::logging::Logger deviceLogger,
mm::logging::Logger coreLogger) :
DeviceInstanceBase<MM::VolumetricPump>(core, adapter, name, pDevice, deleteFunction, label, deviceLogger, coreLogger)
{}

int Home();
int Stop();
bool requiresHoming();
int invertDirection(bool state);
int isDirectionInverted(bool& state);
int setVolumeUl(double volUl);
int getVolumeUl(double& volUl);
int setMaxVolumeUl(double volUl);
int getMaxVolumeUl(double& volUl);
int setFlowrateUlPerSec(double flowrate);
int getFlowrateUlPerSec(double& flowrate);
int Start();
int DispenseDuration(double durSec);
int DispenseVolume(double volUl);
};
4 changes: 4 additions & 0 deletions MMCore/LoadableModules/LoadedDeviceAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ LoadedDeviceAdapter::LoadDevice(CMMCore* core, const std::string& name,
return std::make_shared<GalvoInstance>(core, shared_this, name, pDevice, deleter, label, deviceLogger, coreLogger);
case MM::HubDevice:
return std::make_shared<HubInstance>(core, shared_this, name, pDevice, deleter, label, deviceLogger, coreLogger);
case MM::PressurePumpDevice:
return std::make_shared<PressurePumpInstance>(core, shared_this, name, pDevice, deleter, label, deviceLogger, coreLogger);
case MM::VolumetricPumpDevice:
return std::make_shared<VolumetricPumpInstance>(core, shared_this, name, pDevice, deleter, label, deviceLogger, coreLogger);
default:
deleter(pDevice);
throw CMMError("Device " + ToQuotedString(name) +
Expand Down
Loading