Skip to content

Commit

Permalink
Merge pull request #486 from MatthewPlayer/main
Browse files Browse the repository at this point in the history
Add Scientifica Motion 8 device adapter
  • Loading branch information
marktsuchida authored Aug 28, 2024
2 parents e153aeb + 54e895f commit c8f3108
Show file tree
Hide file tree
Showing 9 changed files with 1,824 additions and 0 deletions.
1,104 changes: 1,104 additions & 0 deletions DeviceAdapters/ScientificaMotion8/ScientificaMotion8.cpp

Large diffs are not rendered by default.

159 changes: 159 additions & 0 deletions DeviceAdapters/ScientificaMotion8/ScientificaMotion8.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
///////////////////////////////////////////////////////////////////////////////
// FILE: ScientificaMotion8.h
// PROJECT: Micro-Manager
// SUBSYSTEM: DeviceAdapters
//-----------------------------------------------------------------------------
// DESCRIPTION: Scientifica Motion 8 rack adapter
// COPYRIGHT: University of California, San Francisco, 2006
// LICENSE: This file is distributed under the BSD 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: Nenad Amodaj, [email protected], 06/01/2006
//
// Scientifica Specific Parts
// AUTHOR: Matthew Player (ElecSoft Solutions)

#ifndef _SCIENTIFICA_MOTION_8_H_
#define _SCIENTIFICA_MOTION_8_H_

#include "MMDevice.h"
#include "DeviceBase.h"
#include <string>
#include <map>
#include "ScientificaTxPacket.h"
#include "ScientificaRxPacket.h"

class ScientificaMotion8Hub : public HubBase<ScientificaMotion8Hub>
{
public:
ScientificaMotion8Hub();
~ScientificaMotion8Hub();

int Initialize();
int Shutdown();
void GetName(char* pName) const;
bool Busy();

bool SupportsDeviceDetection(void);
MM::DeviceDetectionStatus DetectDevice(void);
int DetectInstalledDevices();

int OnPort(MM::PropertyBase* pPropt, MM::ActionType eAct);

ScientificaRxPacket* WriteRead(ScientificaTxPacket* tx, int expected_length);
bool CheckControllerVersion();
int Stop(uint8_t device);
int SetPosition(uint8_t device, uint8_t axis, long steps);
int IsMoving(uint8_t device, bool* moving);
bool initialized_;
private:
std::string port_;
static MMThreadLock lock_;
int ReadControllerMap(void);


uint8_t device_1_x_channel_;
uint8_t device_1_y_channel_;
uint8_t device_1_z_channel_;
uint8_t device_1_f_channel_;

uint8_t device_2_x_channel_;
uint8_t device_2_y_channel_;
uint8_t device_2_z_channel_;
uint8_t device_2_f_channel_;
};


class M8XYStage : public CXYStageBase<M8XYStage>
{
public:
M8XYStage(uint8_t device);
~M8XYStage();

bool Busy();
void GetName(char* pName) const;

int Initialize();
int Shutdown();

// XYStage API
int SetPositionSteps(long x, long y);
int GetPositionSteps(long& x, long& y);
int Home();
int Stop();
int SetOrigin();
int SetXOrigin();
int SetYOrigin();
int GetLimitsUm(double& xMin, double& xMax, double& yMin, double& yMax);
int GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax);
double GetStepSizeXUm() { return 0.01; }
double GetStepSizeYUm() { return 0.01; }
int IsXYStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }
private:
uint8_t device_;
std::string name_;
};

class M8ZStage : public CStageBase<M8ZStage>
{
public:
M8ZStage(uint8_t device);
~M8ZStage();

//Device API
int Initialize();
int Shutdown();
void GetName(char* pName) const;
bool Busy();

// Stage API
int GetPositionUm(double& pos);
int SetPositionUm(double pos);
int SetPositionSteps(long steps);
int GetPositionSteps(long& steps);
int Home();
int Stop();
int SetOrigin();
int GetLimits(double& min, double& max);
int IsStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }
bool IsContinuousFocusDrive() const { return false; }
private:
uint8_t device_;
std::string name_;
};

class M8FilterCubeTurret : public CStateDeviceBase<M8FilterCubeTurret>
{
public:
M8FilterCubeTurret(uint8_t device);
~M8FilterCubeTurret();


//Device API
int Initialize();
int Shutdown();
void GetName(char* pName) const;
bool Busy();

unsigned long GetNumberOfPositions()const { return numPositions_; }

int OnState(MM::PropertyBase* pProp, MM::ActionType eAct);
private:
uint8_t device_;
std::string name_;

int SetFilter(int filterIndex);
int GetFilter(int& filterIndex);

int numPositions_;
};

#endif
108 changes: 108 additions & 0 deletions DeviceAdapters/ScientificaMotion8/ScientificaMotion8.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E4E9FA4F-E9DD-4483-9140-2FD472C28F1D}</ProjectGuid>
<RootNamespace>Scientifica</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\buildscripts\VisualStudio\MMCommon.props" />
<Import Project="..\..\buildscripts\VisualStudio\MMDeviceAdapter.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\buildscripts\VisualStudio\MMCommon.props" />
<Import Project="..\..\buildscripts\VisualStudio\MMDeviceAdapter.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AssemblyDebug>true</AssemblyDebug>
<SubSystem>Windows</SubSystem>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="ScientificaMotion8.h" />
<ClInclude Include="ScientificaRxPacket.h" />
<ClInclude Include="ScientificaTxPacket.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ScientificaMotion8.cpp" />
<ClCompile Include="ScientificaRxPacket.cpp" />
<ClCompile Include="ScientificaTxPacket.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MMDevice\MMDevice-SharedRuntime.vcxproj">
<Project>{b8c95f39-54bf-40a9-807b-598df2821d55}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ScientificaMotion8.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ScientificaRxPacket.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ScientificaTxPacket.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ScientificaMotion8.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ScientificaRxPacket.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ScientificaTxPacket.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
Loading

0 comments on commit c8f3108

Please sign in to comment.