- Fixed a crash coming from velo.c
- Improved saving of reflection lists - The other changes are mostly whitespace
This commit is contained in:
15
devexec.c
15
devexec.c
@ -1069,18 +1069,27 @@ int SicsIdle(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Usage:
|
||||
Success
|
||||
Success [level]
|
||||
*/
|
||||
int Success(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int iRet;
|
||||
int iRet, level;
|
||||
Status eOld;
|
||||
pExeList self = (pExeList)pData;
|
||||
|
||||
eOld = GetStatus();
|
||||
SetStatus(eRunning);
|
||||
while(DevExecLevelRunning(self, RUNRUN)){
|
||||
|
||||
if(argc > 1){
|
||||
if(strcmp(argv[1],"RUNDRIVE") == 0){
|
||||
level = RUNDRIVE;
|
||||
}
|
||||
} else {
|
||||
level = RUNRUN;
|
||||
}
|
||||
|
||||
while(DevExecLevelRunning(self, level)){
|
||||
TaskYield(self->pTask);
|
||||
}
|
||||
iRet = self->iStatus;
|
||||
|
@ -165,6 +165,7 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl)
|
||||
This can happen after a stop
|
||||
*/
|
||||
if (pPriv->state == IDLE) {
|
||||
ECBTransfer(self);
|
||||
return HWIdle;
|
||||
}
|
||||
|
||||
@ -210,6 +211,7 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl)
|
||||
}
|
||||
if (out.d == 0 && pPriv->state == COUNT) {
|
||||
result = HWIdle;
|
||||
ECBTransfer(self);
|
||||
pPriv->state = IDLE;
|
||||
} else {
|
||||
result = HWBusy;
|
||||
@ -228,11 +230,12 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl)
|
||||
readScaler(pPriv, scaler, &count);
|
||||
/*
|
||||
ignore errors on this one
|
||||
*/
|
||||
*/
|
||||
*fControl = (float) count;
|
||||
|
||||
return result;
|
||||
}
|
||||
}exit
|
||||
|
||||
|
||||
/*=====================================================================*/
|
||||
static int clearScalers(pECBCounter self)
|
||||
|
@ -13,5 +13,6 @@
|
||||
pSICSOBJ MakeHdbTable(char *name, char *hdbclass);
|
||||
int ReadTableTemplate(pSICSOBJ self, SConnection *con);
|
||||
int HdbTableFactory(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]);
|
||||
int SaveHdbTable(void *data, char *name, FILE * fd);
|
||||
|
||||
#endif /*HDBTABLE_H_*/
|
||||
|
@ -328,9 +328,10 @@ static int HistCountStatus(void *pData, SConnection * pCon)
|
||||
return HWBusy;
|
||||
}
|
||||
}
|
||||
if (eCt == HWBusy)
|
||||
if (eCt == HWBusy){
|
||||
updateHMData(self->pDriv->data);
|
||||
|
||||
}
|
||||
|
||||
if (eCt == HWIdle) {
|
||||
/* force an update of local histogram data with next
|
||||
GetHistogram
|
||||
|
2
hkl.c
2
hkl.c
@ -393,7 +393,7 @@ int hklInRange(void *data, double fSet[4], int mask[4])
|
||||
violation we first try to calculate a delta omega which puts omega
|
||||
into the right range. This is a fix because the omega movement is quite
|
||||
often restricted due to the cryogenic garbage around the sample.
|
||||
*/
|
||||
-------------------------------------------------------------------------*/
|
||||
int CalculateSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
|
||||
float fSet[4], SConnection * pCon)
|
||||
{
|
||||
|
@ -180,8 +180,10 @@ int GetCountLock(pICountable self, SConnection * pCon)
|
||||
{
|
||||
if (self->running == 1) {
|
||||
SCWrite(pCon, "ERROR: someone else is already counting!", eError);
|
||||
/* printf("Countlock denied\n"); */
|
||||
return 0;
|
||||
} else {
|
||||
/* printf("Countlock aquired\n");*/
|
||||
self->running = 1;
|
||||
return 1;
|
||||
}
|
||||
@ -190,6 +192,7 @@ int GetCountLock(pICountable self, SConnection * pCon)
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void ReleaseCountLock(pICountable self)
|
||||
{
|
||||
/* printf("Countlock released\n"); */
|
||||
self->running = 0;
|
||||
}
|
||||
|
||||
|
19
reflist.c
19
reflist.c
@ -6,6 +6,10 @@
|
||||
* copyright: see file COPYRIGHT
|
||||
*
|
||||
* Mark Koennecke, July 2008
|
||||
*
|
||||
* Fixed saving of anglesheader status
|
||||
*
|
||||
* Mark Koennecke, September 2009
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -26,6 +30,18 @@ typedef struct {
|
||||
int angCount;
|
||||
int count;
|
||||
} RLPriv, *pRLPriv;
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int SaveRefList(void *data, char *name, FILE * fd)
|
||||
{
|
||||
pHdb node = NULL;
|
||||
pSICSOBJ self = (pSICSOBJ)data;
|
||||
|
||||
node = GetHipadabaNode(self->objectNode,"anglesheader");
|
||||
fprintf(fd,"%s anglesheader %s\n", name, node->value.v.text);
|
||||
SaveHdbTable(data,name,fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------
|
||||
* The point of the code below and the callback is to update the
|
||||
* configuration counts whenever the corresponding parameters
|
||||
@ -449,7 +465,8 @@ pSICSOBJ CreateReflectionList(SConnection * pCon, SicsInterp * pSics,
|
||||
SCWrite(pCon, "ERROR: failed to create reflection list", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pNew->pDes->SaveStatus = SaveRefList;
|
||||
|
||||
AddSICSHdbPar(pNew->objectNode, "names", usUser, MakeSICSFunc(NamesCmd));
|
||||
|
||||
cmd =
|
||||
|
4
sansbc.c
4
sansbc.c
@ -186,6 +186,10 @@ static int StatCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
|
||||
return 0;
|
||||
}
|
||||
data = GetHistogramPointer(hm,pCon);
|
||||
if(data == NULL){
|
||||
SCPrintf(pCon,eError,"ERROR: failed to get data for hm %s", par[0]->value.v.text);
|
||||
return 0;
|
||||
}
|
||||
max = -9999;
|
||||
min = 99999.99;
|
||||
length = dim[0]*dim[1];
|
||||
|
2
scan.c
2
scan.c
@ -575,7 +575,7 @@ static int ScanLoop(pScanData self)
|
||||
}
|
||||
if (!iRet) {
|
||||
SCWrite(self->pCon,
|
||||
"WARNING: skipped scan point after count failure", eLog);
|
||||
"WARNING: skipped scan point after count failure", eLog);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
29
sicsdata.c
29
sicsdata.c
@ -9,6 +9,8 @@
|
||||
copyright: see file COPYRIGHT
|
||||
|
||||
Mark Koennecke, June 2003
|
||||
|
||||
added addto. Mark Koennecke, August 2009
|
||||
----------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
@ -424,6 +426,7 @@ static int divideSicsData(pSICSData self, SicsInterp * pSics,
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
static int scaleSicsData(pSICSData self, SicsInterp * pSics,
|
||||
SConnection * pCon, float scale)
|
||||
@ -442,6 +445,24 @@ static int scaleSicsData(pSICSData self, SicsInterp * pSics,
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*------------------------------------------------------------------*/
|
||||
static int addToSicsData(pSICSData self, SicsInterp * pSics,
|
||||
SConnection *pCon, float val)
|
||||
{
|
||||
int i;
|
||||
float div;
|
||||
|
||||
for (i = 0; i < self->dataUsed; i++) {
|
||||
div = getDataPos(self, i);
|
||||
div += val;
|
||||
if (self->dataType[i] == INTTYPE) {
|
||||
self->data[i] = (int) fabsf(div);
|
||||
} else {
|
||||
memcpy(&self->data[i], &div, sizeof(float));
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
static int copyScanCounts(pSICSData self, int argc, char *argv[],
|
||||
@ -938,7 +959,7 @@ int SICSDataAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pSICSData self = NULL;
|
||||
char pBueffel[132];
|
||||
int pos;
|
||||
float scale;
|
||||
float scale, val;
|
||||
|
||||
self = (pSICSData) pData;
|
||||
assert(self);
|
||||
@ -992,6 +1013,12 @@ int SICSDataAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
return scaleSicsData(self, pSics, pCon, atof(argv[2]));
|
||||
} else if (strcmp(argv[1], "addto") == 0) {
|
||||
if (argc < 3) {
|
||||
SCWrite(pCon, "ERROR: need a value to add", eError);
|
||||
return 0;
|
||||
}
|
||||
return addToSicsData(self, pSics, pCon, atof(argv[2]));
|
||||
} else if (strcmp(argv[1], "copydata") == 0) {
|
||||
return copyData(self, pSics, pCon, argc, argv);
|
||||
} else if (strcmp(argv[1], "putint") == 0) {
|
||||
|
3
sicvar.c
3
sicvar.c
@ -543,8 +543,7 @@ int VarWrapper(SConnection * pCon, SicsInterp * pInterp, void *pData,
|
||||
return iRet;
|
||||
} else {
|
||||
/* now, only a new value is still possible */
|
||||
eStat = GetStatus();
|
||||
if ((eStat != eEager) && (eStat != eBatch)) {
|
||||
if (DevExecLevelRunning(pServ->pExecutor, RUNDRIVE)) {
|
||||
SCWrite(pCon,
|
||||
"You cannot set variables while a scan is running", eError);
|
||||
DeleteTokenList(pList);
|
||||
|
@ -85,6 +85,7 @@ static int calculateNBSettings(pSingleDiff self,
|
||||
if (status != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(om > 180.){
|
||||
om -= 360;
|
||||
} else if (om < -180.){
|
||||
|
Reference in New Issue
Block a user