Scope
XYZControlSutter.h
1 #pragma once
2 
3 #include "ScopeDefines.h"
4 
5 // Only use this code if we need it
6 #ifdef SCOPE_USE_SUTTER_XYZSTAGE
7 
8 #include "XYZControl.h"
9 #include "SutterController.h"
10 
11 namespace scope {
12 
15 class XYZControlSutter
16  : public XYZControl {
17 
18 protected:
20  std::unique_ptr<SutterController> sc;
21 
25  ScopeNumber<double> microstepspermicron;
26 
29  uint16_t stepdiv;
30  uint16_t stepmult;
31  uint16_t speed;
32  uint16_t version;
36  union SutterValue16 {
38  uint16_t intval;
40  unsigned char charval[2];
41  };
42 
44  union SutterValue32 {
46  uint32_t intval;
48  unsigned char charval[4];
49  };
50 
53  uint16_t BytesToInt16(const std::vector<BYTE>& _bytevec, const uint32_t& _from);
54  std::vector<BYTE> Int16ToBytes(const uint16_t& _i);
55  uint32_t BytesToInt32(const std::vector<BYTE>& _bytevec, const uint32_t& _from);
56  std::vector<BYTE> Int32ToBytes(const uint32_t& _i);
60  void UpdateStatus();
61 
63  void SetVelocity(const uint16_t& _vel);
64 
65 public:
66  XYZControlSutter(void);
67 
69  ~XYZControlSutter(void);
70 
72  void Initialize(parameters::XYZControlSutter& _params);
73 
74  void UpdatePositionValues() override;
75 
76  void SetZero() override;
77 
78  void MoveRelative(const double& _xrel, const double& _yrel, const double& _zrel) override;
79 
80  void MoveAbsolute(const double& _xabs, const double& _yabs, const double& _zabs) override;
81 
82 };
83 
84 }
85 
86 #endif