- Updated the managers documentation a little
- The crystal settings calculation in hkl now tried to put omega into the limts by calculating a delta omega. - TRICS data files now include HKL and the UB - The scan module has been expanded to support user defined scans which run a script at any scan point. - A small fix to the PSD code in SinqHM_srv_filler
This commit is contained in:
97
scan.c
97
scan.c
@ -5,7 +5,7 @@
|
||||
Implementation file for the SICS scan command.
|
||||
|
||||
|
||||
Mark Koennecke, October 1997
|
||||
Mark Koennecke, October 1997, June 2001
|
||||
|
||||
copyright: see copyright.h
|
||||
----------------------------------------------------------------------------*/
|
||||
@ -26,6 +26,7 @@
|
||||
#include "splitter.h"
|
||||
#include "danu.h"
|
||||
#include "amorscan.h"
|
||||
#include "userscan.h"
|
||||
#include "motor.h"
|
||||
|
||||
extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
@ -889,6 +890,70 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int AppendScanLine(pScanData self, char *line)
|
||||
{
|
||||
/* reopen file */
|
||||
self->fd = fopen(self->pFile,"r+");
|
||||
if(!self->fd)
|
||||
{
|
||||
SCWrite(self->pCon,
|
||||
"ERROR: Failed to reopen scan file, aborting scan",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* jump to end of file */
|
||||
fseek(self->fd,0,SEEK_END);
|
||||
|
||||
/* print */
|
||||
fprintf(self->fd,"%s\n",line);
|
||||
|
||||
/* done */
|
||||
fclose(self->fd);
|
||||
self->fd = NULL;
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern char *stptok(const char *s, char *t, int len, char *brk);
|
||||
|
||||
int StoreScanCounts(pScanData self, char *data)
|
||||
{
|
||||
CountEntry sCount;
|
||||
char pNumber[20], *pPtr;
|
||||
int iCount = 0;
|
||||
|
||||
if(data == NULL)
|
||||
{
|
||||
SCWrite(self->pCon,"WARNING: StoreScanCounst called without data",eWarning);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* parse the data */
|
||||
pPtr = data;
|
||||
pPtr = stptok(pPtr,pNumber,19," \t");
|
||||
if(pPtr != NULL)
|
||||
{
|
||||
sCount.lCount = atoi(pNumber);
|
||||
}
|
||||
while((pPtr = stptok(pPtr,pNumber,19," \t")) != NULL)
|
||||
{
|
||||
sCount.Monitors[iCount] = atoi(pNumber);
|
||||
iCount++;
|
||||
if(iCount >= 10)
|
||||
{
|
||||
SCWrite(self->pCon,
|
||||
"ERROR: I have only space for 10 Monitors in count structure",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sCount.i = self->iCounts;
|
||||
DynarReplace(self->pCounts,self->iCounts,&sCount,sizeof(CountEntry));
|
||||
self->iCounts++;
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int StartToDrive(pScanData self, int iPoint)
|
||||
{
|
||||
@ -2131,7 +2196,8 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
{
|
||||
if(argc < 5)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: Insufficient number of arguments given for %s add",
|
||||
sprintf(pBueffel,
|
||||
"ERROR: Insufficient number of arguments given for %s add",
|
||||
argv[0]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
@ -2151,7 +2217,8 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = AddScanVar(self,pSics,pCon,argv[2],(float)fStart,(float)fStep);
|
||||
iRet = AddScanVar(self,pSics,pCon,argv[2],
|
||||
(float)fStart,(float)fStep);
|
||||
if(iRet)
|
||||
{
|
||||
SCSendOK(pCon);
|
||||
@ -2177,9 +2244,6 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
/*------------ configure */
|
||||
else if(strcmp(argv[1],"configure") == 0)
|
||||
{
|
||||
/* managers only */
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
return 0;
|
||||
if(argc < 3)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: missing configure option",eError);
|
||||
@ -2194,10 +2258,19 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
}
|
||||
else if(strcmp(argv[2],"amor") == 0)
|
||||
{
|
||||
/* managers only */
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
return 0;
|
||||
ConfigureAmor(self);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(argv[2],"user") == 0)
|
||||
{
|
||||
ConfigureUserScan(self);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: option %s not recognized by configure",
|
||||
@ -2447,6 +2520,18 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*----------------- line */
|
||||
else if(strcmp(argv[1],"line") == 0)
|
||||
{
|
||||
Arg2Text(argc-2,&argv[2],pBueffel,511);
|
||||
return AppendScanLine(self,pBueffel);
|
||||
}
|
||||
/*----------------- storecounts */
|
||||
else if(strcmp(argv[1],"storecounts") == 0)
|
||||
{
|
||||
Arg2Text(argc-2,&argv[2],pBueffel,511);
|
||||
return StoreScanCounts(self,pBueffel);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: %s not recognized as subcommand to %s",
|
||||
|
Reference in New Issue
Block a user