Merge branch '3.0-rc' into developer

This commit is contained in:
Dhanya Maliakal 2017-08-17 13:55:52 +02:00
commit 945a7ed10f
8 changed files with 864 additions and 831 deletions

View File

@ -95,6 +95,7 @@ int main(int argc, char* argv[]) {
cprintf(RED,"Warning: Unable to open port %s\n", PORTNAME);
return -1;
}
cprintf(GREEN,"opened port at %s\n",PORTNAME);
struct termios serial_conf;
// reset structure
@ -132,33 +133,21 @@ int main(int argc, char* argv[]) {
cprintf(GREEN,"Ready...\n");
/*
int once = 1;
while(strcmp(buffer,"start")){
if(once){
once=0;
cprintf(MAGENTA,"in the loop, checking\n");
}
memset(buffer,0,BUFFERSIZE);
n = read(fd,buffer,BUFFERSIZE);
//#ifdef VERBOSE
cprintf(BLUE,"Received %d Bytes\n", n);
//#endif
cprintf(BLUE,"Got message: %s\n",buffer);
}
cprintf(GREEN,"started\n");
*/
while(ret != GOODBYE){
memset(buffer,0,BUFFERSIZE);
n = read(fd,buffer,BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Received %d Bytes\n", n);
#endif
cprintf(BLUE,"Got message: %s\n",buffer);
cprintf(BLUE,"Got message: '%s'\n",buffer);
switch(buffer[0]){
case '\0':
cprintf(GREEN,"Got Start (Detector restart)\n");
break;
case 's':
cprintf(GREEN,"Got Start \n");
break;
case 'p':
if (!sscanf(&buffer[1],"%d",&ival)){
cprintf(RED,"Warning: cannot scan voltage value\n");
@ -171,10 +160,10 @@ int main(int argc, char* argv[]) {
strcpy(buffer,"fail ");
else
strcpy(buffer,"success ");
cprintf(GREEN,"%s\n",buffer);
cprintf(GREEN,"Sending: '%s'\n",buffer);
n = write(fd, buffer, BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Sent %d Bytes\n", n);
cprintf(GREEN,"Sent %d Bytes\n", n);
#endif
break;
@ -188,20 +177,21 @@ int main(int argc, char* argv[]) {
else
strcpy(buffer,"success ");
n = write(fd, buffer, BUFFERSIZE);
cprintf(GREEN,"Sending: '%s'\n",buffer);
#ifdef VERBOSE
cprintf(BLUE,"Sent %d Bytes\n", n);
cprintf(GREEN,"Sent %d Bytes\n", n);
#endif
//value
memset(buffer,0,BUFFERSIZE);
buffer[BUFFERSIZE-1] = '\n';
if(ival >= 0){
cprintf(GREEN,"%d\n",ival);
cprintf(GREEN,"Sending: '%d'\n",ival);
sprintf(buffer,"%d ",ival);
n = write(fd, buffer, BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Sent %d Bytes\n", n);
cprintf(GREEN,"Sent %d Bytes\n", n);
#endif
}else cprintf(GREEN,"%s\n",buffer);
}else cprintf(RED,"%s\n",buffer);
break;
case 'e':
@ -209,7 +199,7 @@ int main(int argc, char* argv[]) {
ret = GOODBYE;
break;
default:
printf("Unknown Command. buffer:[%s]\n",buffer);
cprintf(RED,"Unknown Command. buffer:'%s'\n",buffer);
break;
}
}

View File

@ -224,7 +224,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num){
int Feb_Control_OpenSerialCommunication(){
cprintf(BG_BLUE,"opening serial communication of hv\n");
cprintf(GREEN,"opening serial communication of hv\n");
//if(Feb_Control_hv_fd != -1)
close(Feb_Control_hv_fd);
Feb_Control_hv_fd = open(SPECIAL9M_HIGHVOLTAGE_PORT, O_RDWR | O_NOCTTY | O_SYNC);
@ -232,7 +232,7 @@ int Feb_Control_OpenSerialCommunication(){
cprintf(RED,"Warning: Unable to open port %s to set up high voltage serial communciation to the blackfin\n", SPECIAL9M_HIGHVOLTAGE_PORT);
return 0;
}
cprintf(GREEN,"Serial Port opened at %s\n",SPECIAL9M_HIGHVOLTAGE_PORT);
struct termios serial_conf;
// reset structure
memset (&serial_conf, 0, sizeof(serial_conf));
@ -265,12 +265,15 @@ int Feb_Control_OpenSerialCommunication(){
memset(buffer,0,SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE);
buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-1] = '\n';
strcpy(buffer,"start");
cprintf(GREEN,"sending start: '%s'\n",buffer);
int n = write(Feb_Control_hv_fd, buffer, SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE);
if (n < 0) {
cprintf(RED,"\nWarning: Error writing to i2c bus\n");
return 0;
}
#ifdef VERBOSE
cprintf(GREEN,"Sent: %d bytes\n",n);
#endif
return 1;
}
@ -629,13 +632,14 @@ int Feb_Control_SendHighVoltage(int dacvalue){
buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-1]='\n';
int n;
sprintf(buffer,"p%d",dacvalue);
cprintf(GREEN,"Sending HV: '%s'\n",buffer);
n = write(Feb_Control_hv_fd, buffer, SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE);
if (n < 0) {
cprintf(RED,"\nWarning: Error writing to i2c bus\n");
return 0;
}
#ifdef VERBOSEI
cprintf(BLUE,"Sent %d Bytes\n", n);
cprintf(GREEN,"Sent %d Bytes\n", n);
#endif
//ok/fail
memset(buffer,0,SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE);
@ -646,8 +650,9 @@ int Feb_Control_SendHighVoltage(int dacvalue){
return 0;
}
#ifdef VERBOSEI
cprintf(BLUE,"Received %d Bytes\n", n);
cprintf(GREEN,"Received %d Bytes\n", n);
#endif
cprintf(GREEN,"Received HV: '%s'\n",buffer);
fflush(stdout);
/*Feb_Control_CloseSerialCommunication();*/
if(buffer[0] != 's'){
@ -715,13 +720,14 @@ int Feb_Control_ReceiveHighVoltage(unsigned int* value){
//request
strcpy(buffer,"g ");
cprintf(GREEN,"\nSending HV: '%s'\n",buffer);
n = write(Feb_Control_hv_fd, buffer, SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE);
if (n < 0) {
cprintf(RED,"\nWarning: Error writing to i2c bus\n");
return 0;
}
#ifdef VERBOSEI
cprintf(BLUE,"Sent %d Bytes\n", n);
cprintf(GREEN,"Sent %d Bytes\n", n);
#endif
//ok/fail
@ -733,8 +739,9 @@ int Feb_Control_ReceiveHighVoltage(unsigned int* value){
return 0;
}
#ifdef VERBOSEI
cprintf(BLUE,"Received %d Bytes\n", n);
cprintf(GREEN,"Received %d Bytes\n", n);
#endif
cprintf(GREEN,"Received HV: '%s'\n",buffer);
if(buffer[0] != 's'){
cprintf(RED,"\nWarning: failed to read high voltage\n");
return 0;
@ -748,8 +755,9 @@ int Feb_Control_ReceiveHighVoltage(unsigned int* value){
return 0;
}
#ifdef VERBOSEI
cprintf(BLUE,"Received %d Bytes\n", n);
cprintf(GREEN,"Received %d Bytes\n", n);
#endif
cprintf(GREEN,"Received HV: '%s'\n",buffer);
/*Feb_Control_OpenSerialCommunication();*/
if (!sscanf(buffer,"%d",value)){
cprintf(RED,"\nWarning: failed to scan high voltage read\n");

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repsitory UUID: 2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8
Revision: 296
Repsitory UUID: 177efa2636a7cee812707537ad90489a61832942
Revision: 299
Branch: 3.0-rc
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 1457
Last Changed Date: 2017-08-08 15:23:10.000000002 +0200 ./Makefile
Last Changed Rev: 1480
Last Changed Date: 2017-08-17 09:06:21.000000002 +0200 ./Makefile

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
//#define SVNREPPATH ""
#define SVNREPUUID "2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8"
//#define SVNREV 0x1457
#define SVNREPUUID "177efa2636a7cee812707537ad90489a61832942"
//#define SVNREV 0x1480
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x1457
#define SVNDATE 0x20170808
#define SVNREV 0x1480
#define SVNDATE 0x20170817
//

View File

@ -299,6 +299,12 @@ void allocateDetectorStructureMemory(){
(detectorModules)->offset=0;
(detectorModules)->reg=0;
thisSettings = UNINITIALIZED;
// if trimval requested, should return -1 to acknowledge unknown
int ichan=0;
for (ichan=0; ichan<(detectorModules->nchan); ichan++) {
*((detectorModules->chanregs)+ichan) = -1;
}
}
@ -554,7 +560,7 @@ int setModule(sls_detector_module myMod, int delay){
if(myMod.nchan==0 && myMod.nchip == 0)
cprintf(BLUE,"Setting module without trimbits\n");
else{
cprintf(GREEN,"Setting module with trimbits\n");
printf("Setting module with trimbits\n");
//includ gap pixels
unsigned int tt[263680];
int iy,ichip,ix,ip=0,ich=0;
@ -1063,11 +1069,24 @@ int setAllTrimbits(int val){
}
}
}
cprintf(GREEN, "All trimbits have been set to %d\n", val);
return OK;
}
int getAllTrimbits(){
return *((detectorModules->chanregs));
int ichan=0;
int value = *((detectorModules->chanregs));
if (detectorModules){
for (ichan=0; ichan<(detectorModules->nchan); ichan++) {
if(*((detectorModules->chanregs)+ichan) != value) {
value= -1;
break;
}
}
}
printf("Value of all Trimbits: %d\n", value);
return value;
}
int getBebFPGATemp(){

File diff suppressed because it is too large Load Diff