- Added a protocol to spuuoprt the FOCUS Pfeiffer vacuum protocol
- Changed floor() to round() in sanslirebin - Some changes to accomodate the new run/drive behaviour - Added the the sps bipa command
This commit is contained in:
67
sps.c
67
sps.c
@@ -232,7 +232,70 @@ int SPSGetStatus(pSPS self, int iStatus, int *iSet)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static void byteToString(unsigned char byte, char txt[9])
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 8; i++){
|
||||
if(byte & (1 << i) ){
|
||||
txt[i] = '1';
|
||||
} else {
|
||||
txt[i] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int SPSBitPattern(pSPS self, SConnection *pCon)
|
||||
{
|
||||
int iRet, i;
|
||||
char pBueffel[256], *pPtr = NULL, pNum[10], pText[9];
|
||||
unsigned char byte;
|
||||
pDynString result = NULL;
|
||||
|
||||
/* send an R command down to the SPS */
|
||||
iRet = SPSCommand(self, "R", pBueffel, 255);
|
||||
if (!iRet) {
|
||||
SCWrite(pCon,"ERROR: communication error in SPSBitPattern",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
result = CreateDynString(128,128);
|
||||
if(result == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in SPSBitpattern", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* decode the reply into the Byte array */
|
||||
pPtr = strchr(pBueffel, 'R');
|
||||
if (pPtr == NULL) {
|
||||
return -2;
|
||||
}
|
||||
pPtr++;
|
||||
for (i = 0; i < 16; i++) {
|
||||
/* skip the whitespace */
|
||||
pPtr++;
|
||||
pNum[0] = *pPtr;
|
||||
pPtr++;
|
||||
pNum[1] = *pPtr;
|
||||
pPtr++;
|
||||
pNum[2] = *pPtr;
|
||||
pPtr++;
|
||||
pNum[3] = '\0';
|
||||
byte = atoi(pNum);
|
||||
memset(pText,0,9*sizeof(char));
|
||||
byteToString(byte, pText);
|
||||
DynStringConcat(result, pText);
|
||||
if(((i+1) % 4) == 0){
|
||||
DynStringConcatChar(result,'\n');
|
||||
} else {
|
||||
DynStringConcatChar(result,' ');
|
||||
}
|
||||
}
|
||||
SCWrite(pCon,GetCharArray(result), eValue);
|
||||
DeleteDynString(result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------
|
||||
This is a special feature for SANS at SINQ. SANS has a collimator and
|
||||
the length of the collimator can only be deduced from the SPS status
|
||||
@@ -707,6 +770,10 @@ int SPSAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* -------- bit pattern*/
|
||||
else if (strcmp(argv[1], "bipa") == 0) {
|
||||
return SPSBitPattern(self,pCon);
|
||||
}
|
||||
sprintf(pBueffel, "ERROR: %s does not not understand subcommand %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
|
||||
Reference in New Issue
Block a user