Commit d27b6dac authored by gdargaud's avatar gdargaud
Browse files

Various tweaks

parent 19226815
TB_Phytron
TB_Phytron_QuickTest
core*
GetOriginals.sh
......@@ -75,9 +75,11 @@ static int Display=D_ALL; // Global to skip displaying some commands or replies
static int sock=0; // Socket
int Phytron_msWait=10; // Min delay between command and reply and new command. 50ms seems safe enough except for a few slow commands (see BigReply)
#define msleep(ms) usleep((ms)*1000) // ms sleep
int Phytron_msWait=10; // Min delay between command and reply and new command. 50ms seems safe enough
#define msleep(ms) usleep((ms)*1000)// ms sleep
int Phytron_msMotionPolling=500; // Same as above, but higher value to limit the number of polling messages
int Phytron_SpeedDiv=6; // Range: 1 to 255. Default is 6 or 10. 1 is too fast and might break the switch
double Phytron_MoveInDiode_Pos=-45; // Precise angle where the diode is in the middle of the beam
static int Enabled=0;
static char LastErrMsg[1024]="";
......@@ -661,7 +663,7 @@ int main(int argc, const char* argv[]) {
// Ret|=PH_ResetAxis(); // FIXME: not sure if this ought to be here. Does it set the zero ?
Ret|=PH_DoGetGeneralStatus();
Ret|=PH_SetParamValue(45, 1); // Full step. Default was 1/6 ?
Ret|=PH_SetParamValue(45, Phytron_SpeedDiv); // Full step. Default was 1/6 ?
Ret|=PH_SetParamValue(2, 1); // Measuring unit of movement - Step
// Ret|=PH_SetParamValue(2, 4); // Measuring unit of movement - Degree - DOES NOT SEEM DO ANYTHING
......@@ -800,7 +802,7 @@ int TB_Phytron_Init(void) {
if ((Ret=PH_Reset())) return Ret;
if ((Ret=PH_DoGetGeneralStatus())) return Ret;
if ((Ret=PH_SetParamValue(45, 1))) return Ret; // Full step. Default was 1/6 ?
if ((Ret=PH_SetParamValue(45, Phytron_SpeedDiv))) return Ret; // Full step. Default was 1/6 ?
if ((Ret=PH_MoveToLimit(-1))) return Ret;
......@@ -851,7 +853,7 @@ char* TB_Phytron_Status(void) {
///////////////////////////////////////////////////////////////////////////////
/// HIFN Move to absolute position
/// HIFN Angle/in degrees
/// HIPAR Angle/in degrees
///////////////////////////////////////////////////////////////////////////////
int TB_Phytron_MoveAbs(double Angle) {
int Ret;
......@@ -863,6 +865,22 @@ int TB_Phytron_MoveAbs(double Angle) {
return 0;
}
///////////////////////////////////////////////////////////////////////////////
/// HIFN Set the speed divisor
/// HIPAR SD/1 for highest speed, 255 for lowest
///////////////////////////////////////////////////////////////////////////////
int TB_Phytron_SpeedDiv(int SD) {
return PH_SetParamValue(45, Phytron_SpeedDiv = (SD<1 ? 1 : SD>255 ? 255 : SD));
}
///////////////////////////////////////////////////////////////////////////////
/// HIFN Move the diode in the path of the beam
/// HIPAR Do/0 to move the diode to the rest position, 1 to move it in the path of the beam
///////////////////////////////////////////////////////////////////////////////
extern int TB_Phytron_MoveInDiode(int Do) {
return TB_Phytron_MoveAbs(Do ? Phytron_MoveInDiode_Pos : 0);
}
///////////////////////////////////////////////////////////////////////////////
char* TB_Phytron_LastErrMsg(void) {
return LastErrMsg;
......
#ifndef __TB_PHYTRON_H
#define __TB_PHYTRON_H
extern char Phytron_IP[80]; // This is defined by the dhcp server configuration. See /etc/dhcp/dhcpd.conf file
extern char Phytron_IP[80]; // This is defined by the dhcp server configuration. See /etc/dhcp/dhcpd.conf file
extern int Phytron_Port;
extern int Phytron_msWait; // Min delay between command and reply and new command. 50ms seems safe enough except for a few slow commands (see BigReply)
extern int Phytron_msMotionPolling; // Same as above, but higher value to limit the number of polling messages
extern int Phytron_msWait; // Min delay between command and reply and new command. 50ms seems safe enough
extern int Phytron_msMotionPolling; // Same as above, but higher value to limit the number of polling messages
extern int Phytron_SpeedDiv; // Speed divisor (1-fastest to 255-slowest)
extern double Phytron_MoveInDiode_Pos; // Precise angle where the diode is in the middle of the beam
// Low level commands
......@@ -53,5 +55,8 @@ extern int TB_Phytron_Close(void);
extern int TB_Phytron_MoveAbs(double Angle);
extern char* TB_Phytron_Status(void);
extern char* TB_Phytron_LastErrMsg(void);
extern int TB_Phytron_SpeedDiv(int SD);
extern int TB_Phytron_MoveInDiode(int Do);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment