added short cmd, not tested
This commit is contained in:
@@ -81,23 +81,29 @@
|
||||
// exit ASCII checksum mode
|
||||
#define CMD_EXITACM ("YXY0\r\xb8")
|
||||
|
||||
|
||||
// timeout (seconds) of reading answer (from last symbol read)
|
||||
#define READTIMEOUT (0.05)
|
||||
|
||||
// steps per revolution
|
||||
#define X_MOT_STEPSPERREV (4394294.)
|
||||
#define Y_MOT_STEPSPERREV (3325291.)
|
||||
//#define X_MOT_STEPSPERREV (3325440.)
|
||||
#define X_MOT_STEPSPERREV (3325952.)
|
||||
//#define Y_MOT_STEPSPERREV (4394496.)
|
||||
#define Y_MOT_STEPSPERREV (4394960.)
|
||||
|
||||
// motor position to radians and back
|
||||
#define X_MOT2RAD(n) (2.*M_PI * (double)n / X_MOT_STEPSPERREV)
|
||||
#define Y_MOT2RAD(n) (2.*M_PI * (double)n / Y_MOT_STEPSPERREV)
|
||||
#define X_RAD2MOT(r) ((uint32_t)(r / 2./M_PI * X_MOT_STEPSPERREV))
|
||||
#define Y_RAD2MOT(r) ((uint32_t)(r / 2./M_PI * Y_MOT_STEPSPERREV))
|
||||
// motor speed in rad/s and back
|
||||
#define X_MOTSPD2RS(n) (X_MOT2RAD(n)/65536.*1953.)
|
||||
#define X_RS2MOTSPD(r) ((uint32_t)(X_RAD2MOT(r)*65536./1953.))
|
||||
#define Y_MOTSPD2RS(n) (Y_MOT2RAD(n)/65536.*1953.)
|
||||
#define Y_RS2MOTSPD(r) ((uint32_t)(Y_RAD2MOT(r)*65536./1953.))
|
||||
// adder time to seconds vice versa
|
||||
#define ADDER2S(a) (a*1953.)
|
||||
#define S2ADDER(s) (s/1953.)
|
||||
|
||||
// encoder per revolution
|
||||
#define X_ENC_STEPSPERREV (67108863.)
|
||||
#define Y_ENC_STEPSPERREV (67108863.)
|
||||
#define X_ENC_STEPSPERREV (67108864.)
|
||||
#define Y_ENC_STEPSPERREV (67108864.)
|
||||
// encoder position to radians and back
|
||||
#define X_ENC2RAD(n) (2.*M_PI * (double)n / X_ENC_STEPSPERREV)
|
||||
#define Y_ENC2RAD(n) (2.*M_PI * (double)n / Y_ENC_STEPSPERREV)
|
||||
@@ -131,8 +137,8 @@ typedef struct{ // 41 bytes
|
||||
}__attribute__((packed)) SSstat;
|
||||
|
||||
typedef struct{
|
||||
int32_t Xmot; // 0 DEC motor position
|
||||
int32_t Xspeed; // 4 DEC speed
|
||||
int32_t Xmot; // 0 X motor position
|
||||
int32_t Xspeed; // 4 X speed
|
||||
int32_t Ymot; // 8
|
||||
int32_t Yspeed; // 12
|
||||
uint8_t xychange; // 16 change Xbits/Ybits value
|
||||
@@ -142,13 +148,13 @@ typedef struct{
|
||||
} __attribute__((packed)) SSscmd; // short command
|
||||
|
||||
typedef struct{
|
||||
int32_t Xmot; // 0 DEC motor position
|
||||
int32_t Xspeed; // 4 DEC speed
|
||||
int32_t Xmot; // 0 X motor position
|
||||
int32_t Xspeed; // 4 X speed
|
||||
int32_t Ymot; // 8
|
||||
int32_t Yspeed; // 12
|
||||
int32_t Xadder; // 16 - DEC adder
|
||||
int32_t Xadder; // 16 - X adder
|
||||
int32_t Yadder; // 20
|
||||
int32_t Xatime; // 24 DEC adder time
|
||||
int32_t Xatime; // 24 X adder time (1953 == 1s)
|
||||
int32_t Yatime; // 28
|
||||
uint16_t checksum; // 32
|
||||
} __attribute__((packed)) SSlcmd; // long command
|
||||
@@ -162,3 +168,4 @@ int SSgetint(const char *cmd, int64_t *ans);
|
||||
int SSXmoveto(double pos);
|
||||
int SSYmoveto(double pos);
|
||||
int SSemergStop();
|
||||
int SSshortCmd(SSscmd *cmd);
|
||||
|
||||
Reference in New Issue
Block a user