mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
SlsDetector client library and servers. First import.
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@1 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
47
slsDetectorSoftware/usersFunctions/usersFunctions.c
Normal file
47
slsDetectorSoftware/usersFunctions/usersFunctions.c
Normal file
@ -0,0 +1,47 @@
|
||||
#include "usersFunctions.h"
|
||||
#include <math.h>
|
||||
|
||||
float pos;
|
||||
|
||||
/*
|
||||
contains the conversion channel-angle for a module channel
|
||||
conv_r=pitch/radius
|
||||
*/
|
||||
|
||||
|
||||
float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) {
|
||||
|
||||
|
||||
float ang;
|
||||
|
||||
ang=180./PI*(center*conv_r+atan((float)(ichan-center)*conv_r))+encoder+totalOffset;
|
||||
|
||||
return direction*ang;
|
||||
|
||||
}
|
||||
|
||||
/* reads the encoder and returns the position */
|
||||
|
||||
float get_position() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/* moves the encoder to position p */
|
||||
|
||||
int go_to_position(float p) {
|
||||
pos=p;
|
||||
}
|
||||
|
||||
/* moves the encoder to position p without waiting */
|
||||
|
||||
int go_to_position_no_wait(float p) {
|
||||
pos=p;
|
||||
}
|
||||
|
||||
|
||||
/* reads I0 and returns the intensity */
|
||||
|
||||
float get_i0() {
|
||||
return 100.;
|
||||
}
|
||||
|
34
slsDetectorSoftware/usersFunctions/usersFunctions.h
Normal file
34
slsDetectorSoftware/usersFunctions/usersFunctions.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef USERS_FUNCTIONS_H
|
||||
#define USERS_FUNCTIONS_H
|
||||
/******************************************************************
|
||||
|
||||
Functions depending on the experimental setup should be defined here
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction);
|
||||
float get_position();
|
||||
int go_to_position(float p);
|
||||
int go_to_position_no_wait(float p);
|
||||
|
||||
|
||||
float get_i0();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user