- Fixed a crash coming from velo.c

- Improved saving of reflection lists
- The other changes are mostly whitespace
This commit is contained in:
koennecke
2009-10-30 13:49:37 +00:00
parent cb0e4ea434
commit 2e873e3059
13 changed files with 79 additions and 14 deletions

View File

@ -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;

View File

@ -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;
@ -232,7 +234,8 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl)
*fControl = (float) count;
return result;
}
}exit
/*=====================================================================*/
static int clearScalers(pECBCounter self)

View File

@ -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_*/

View File

@ -328,8 +328,9 @@ 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

2
hkl.c
View File

@ -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)
{

View File

@ -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;
}

View File

@ -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,6 +465,7 @@ 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));

View File

@ -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];

View File

@ -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) {

View File

@ -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);

View File

@ -85,6 +85,7 @@ static int calculateNBSettings(pSingleDiff self,
if (status != 1) {
return 0;
}
if(om > 180.){
om -= 360;
} else if (om < -180.){

2
velo.c
View File

@ -919,7 +919,7 @@ int VelSelAction(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[])
{
pVelSel self = NULL;
char pCommand[512], pBueffel[256];
char pCommand[512], pBueffel[512];
char *pPtr = NULL;
float fTilt, fRot, fVal;
int iDrive = 0;