Skip to content

Commit

Permalink
Merge pull request micro-manager#525 from marktsuchida/mm2-update-cpp
Browse files Browse the repository at this point in the history
Merge C++ changes from 1.4
  • Loading branch information
marktsuchida authored Feb 4, 2017
2 parents 610defc + 3e53a63 commit 38c9955
Show file tree
Hide file tree
Showing 13 changed files with 1,081 additions and 35 deletions.
754 changes: 753 additions & 1 deletion DeviceAdapters/ASITiger/ASIZStage.cpp

Large diffs are not rendered by default.

39 changes: 31 additions & 8 deletions DeviceAdapters/ASITiger/ASIZStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class CZStage : public ASIPeripheralBase<CStageBase, CZStage>
int SetOrigin();

bool IsContinuousFocusDrive() const {return false;} // todo figure out what this means and if it's accurate
int IsStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }
int GetStageSequenceMaxLength(long& nrEvents) const { nrEvents = 0; return DEVICE_OK; }

// below aren't implemented yet
int StartStageSequence() { return DEVICE_UNSUPPORTED_COMMAND; }
int StopStageSequence() { return DEVICE_UNSUPPORTED_COMMAND; }
int ClearStageSequence() { return DEVICE_UNSUPPORTED_COMMAND; }
int AddToStageSequence(double /*position*/) { return DEVICE_UNSUPPORTED_COMMAND; }
int SendStageSequence() { return DEVICE_UNSUPPORTED_COMMAND; }
int IsStageSequenceable(bool& isSequenceable) const { isSequenceable = ttl_trigger_enabled_; return DEVICE_OK; }
int GetStageSequenceMaxLength(long& nrEvents) const { nrEvents = ring_buffer_capacity_; return DEVICE_OK; }

int StartStageSequence();
int StopStageSequence();
int ClearStageSequence();
int AddToStageSequence(double position);
int SendStageSequence();

// action interface
// ----------------
Expand Down Expand Up @@ -97,12 +97,35 @@ class CZStage : public ASIPeripheralBase<CStageBase, CZStage>
int OnWheelSlowSpeed (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnWheelMirror (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnAxisPolarity (MM::PropertyBase* pProp, MM::ActionType eAct);
// single axis properties
int OnSAAmplitude (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAOffset (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAPeriod (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAMode (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAPattern (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAAdvanced (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAClkSrc (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAClkPol (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSATTLOut (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSATTLPol (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSAPatternByte (MM::PropertyBase* pProp, MM::ActionType eAct);
// ring buffer properties
int OnRBDelayBetweenPoints (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnRBMode (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnRBTrigger (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnRBRunning (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnUseSequence (MM::PropertyBase* pProp, MM::ActionType eAct);

private:
double unitMult_;
double stepSizeUm_;
string axisLetter_;
bool advancedPropsEnabled_;
bool ring_buffer_supported_;
long ring_buffer_capacity_;
bool ttl_trigger_supported_;
bool ttl_trigger_enabled_;
std::vector<double> sequence_;

// private helper functions
int OnSaveJoystickSettings();
Expand Down
2 changes: 2 additions & 0 deletions DeviceAdapters/MCL_NanoDrive/MCL_NanoDrive.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ static const char* g_Keyword_SetPosZUm = "Set position Z (um)";
static const char* g_Keyword_SetPosXUm = "Set position X (um)";
static const char* g_Keyword_SetPosYUm = "Set position Y (um)";
static const char* g_Keyword_SetOrigin = "Set origin here";
static const char* g_Keyword_SetSequence = "Use Sequence";
static const char* g_Keyword_ShiftSequence = "Shift sequence by 1";

#endif //_MCL_NANODRIVE_H_
46 changes: 44 additions & 2 deletions DeviceAdapters/MCL_NanoDrive/MCL_NanoDrive_XYStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ MCL_NanoDrive_XYStage::MCL_NanoDrive_XYStage():
settlingTimeY_ms_(100),
curXpos_(0),
curYpos_(0),
commandedX_(0),
commandedY_(0),
firstWriteX_(true),
firstWriteY_(true),
MCLhandle_(0)
Expand Down Expand Up @@ -51,8 +53,8 @@ void MCL_NanoDrive_XYStage::GetName(char* name) const

int MCL_NanoDrive_XYStage::Initialize()
{
// BEGIN LOCKING
HandleListLock();
// BEGIN LOCKING
HandleListLock();

int err = DEVICE_OK;
int possHandle = 0;
Expand Down Expand Up @@ -89,6 +91,7 @@ HandleListLock();
device->Initialize(possHandle, XY_TYPE);
for (int i = 0; i < numHandles; i++)
{

possHandle = handlesToUseOrRelease[i];
device->setHandle(possHandle);

Expand Down Expand Up @@ -357,6 +360,17 @@ int MCL_NanoDrive_XYStage::SetDeviceProperties()
if (err != DEVICE_OK)
return err;


//Current Commanded Position
sprintf(iToChar, "%f", commandedX_);
pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnCommandChangedX);
err = CreateProperty("CommandedX",iToChar, MM::Float, true, pAct);

//Current Commanded Position
sprintf(iToChar, "%f", commandedY_);
pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnCommandChangedY);
err = CreateProperty("CommandedY",iToChar, MM::Float, true, pAct);

return DEVICE_OK;
}

Expand Down Expand Up @@ -727,3 +741,31 @@ int MCL_NanoDrive_XYStage::OnSetOrigin(MM::PropertyBase* pProp, MM::ActionType e

return err;
}

int MCL_NanoDrive_XYStage::OnCommandChangedX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
int err = DEVICE_OK;

if (eAct == MM::BeforeGet)
{
double ignoreZ;
MCL_GetCommandedPosition(&commandedX_, &commandedY_, &ignoreZ, MCLhandle_);
pProp->Set(commandedX_);
}

return err;
}

int MCL_NanoDrive_XYStage::OnCommandChangedY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
int err = DEVICE_OK;

if (eAct == MM::BeforeGet)
{
double ignoreZ;
MCL_GetCommandedPosition(&commandedX_, &commandedY_, &ignoreZ, MCLhandle_);
pProp->Set(commandedY_);
}

return err;
}
5 changes: 5 additions & 0 deletions DeviceAdapters/MCL_NanoDrive/MCL_NanoDrive_XYStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class MCL_NanoDrive_XYStage : public CXYStageBase<MCL_NanoDrive_XYStage>
int OnSettlingTimeXMs(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSettlingTimeYMs(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetOrigin(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnCommandChangedX(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnCommandChangedY(MM::PropertyBase* pProp, MM::ActionType eAct);

private:
int SetDeviceProperties();
Expand Down Expand Up @@ -91,6 +93,9 @@ class MCL_NanoDrive_XYStage : public CXYStageBase<MCL_NanoDrive_XYStage>

bool firstWriteX_;
bool firstWriteY_;

double commandedX_;
double commandedY_;
};

#endif // _MCL_NANODRIVE_XYSTAGE_H_
Loading

0 comments on commit 38c9955

Please sign in to comment.