- Fixed sicsprompt bug. Sicsprompt caused a core dump

- Removed generation of incommenurate reflections for 0,0,0 in fourmess.c
- Implemented a Poch command for heartbeats
- Fixed 64 bit dimension issues in nxdict
- Fixed different calling conventions for NXReportError deep stack in nxdict
- Stopped ei motor driving when not necessary
- Added yet another monitor for POLDI
- Added a protocoll driver for the JVL motor RS-485 binary protocoll
- Fixed some reporting issues


SKIPPED:
	psi/jvlprot.c
	psi/make_gen
	psi/polterwrite.c
	psi/psi.c
	psi/spss7.c
This commit is contained in:
koennecke
2012-06-05 09:09:20 +00:00
parent ecd96f9ab0
commit bd50b19178
21 changed files with 238 additions and 51 deletions

View File

@ -323,10 +323,12 @@ static int ScriptCallback(int iEvent, void *pEventData, void *pUserData)
return 0; return 0;
} }
if (pUserData == NULL) { if (pUserData == NULL) {
SCDeleteConnection(pCon);
fprintf(stdout, "ERROR: ScriptCallback: no script to execute\n"); fprintf(stdout, "ERROR: ScriptCallback: no script to execute\n");
return 0; return 0;
} }
SCSetRights(pCon, usInternal); SCSetRights(pCon, usInternal);
SCSetWriteFunc(pCon,SCNotWrite);
status = InterpExecute(pServ->pSics, pCon, (char *) pUserData); status = InterpExecute(pServ->pSics, pCon, (char *) pUserData);
SCDeleteConnection(pCon); SCDeleteConnection(pCon);

View File

@ -26,6 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <tcl.h> #include <tcl.h>
#include "splitter.h"
#include "sics.h" #include "sics.h"
#include "ifile.h" #include "ifile.h"
#include "sicsvar.h" #include "sicsvar.h"
@ -423,6 +424,16 @@ int CommandLog(SConnection * pCon, SicsInterp * pSics, void *pData,
PrintTail(iVal, pCon); PrintTail(iVal, pCon);
return 1; return 1;
} }
/**
* handle write
*/
if (strcmp(argv[1], "write") == 0) {
Arg2Text(argc-2, &argv[2],pBueffel,sizeof(pBueffel));
WriteToCommandLogId(NULL, pCon->sockHandle,pBueffel);
SCSendOK(pCon);
return 1;
}
/* check rights */ /* check rights */
if (!SCMatchRights(pCon, usMugger)) { if (!SCMatchRights(pCon, usMugger)) {

View File

@ -248,6 +248,9 @@ SConnection *SCCreateDummyConnection(SicsInterp * pSics)
SConnection *pRes = NULL; SConnection *pRes = NULL;
pRes = CreateConnection(pSics); pRes = CreateConnection(pSics);
if(pRes == NULL){
return pServ->dummyCon;
}
pRes->sockHandle = -1; pRes->sockHandle = -1;
pRes->iUserRights = usInternal; pRes->iUserRights = usInternal;
@ -958,12 +961,61 @@ int SCOnlySockWrite(SConnection * self, char *buffer, int iOut)
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int SCPureSockWrite(SConnection * self, char *buffer, int iOut) int SCPureSockWrite(SConnection * self, char *buffer, int iOut)
{ {
char pBueffel[1024];
char *pPtr;
/* for commandlog tail */ /* for commandlog tail */
if (!VerifyConnection(self)) { if (!VerifyConnection(self)) {
return 0; return 0;
} }
if(self->iProtocolID == 5) {
if (strlen(buffer) + 30 > 1024) {
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
memset(pPtr, 0, strlen(buffer) + 20);
} else {
pPtr = pBueffel;
}
sprintf(pPtr, "%d::>%s<::", self->transID, buffer);
testAndWriteSocket(self, pPtr, iOut);
if(pPtr != pBueffel){
free(pPtr);
}
} else {
testAndWriteSocket(self, buffer, iOut); testAndWriteSocket(self, buffer, iOut);
}
return 1;
}
/*--------------------------------------------------------------------------
special for ClientLog. Do not use elsewhere without check
----------------------------------------------------------------------------*/
int SCLogWrite(SConnection * self, char *buffer, int iOut)
{
char pBueffel[1024];
char *pPtr;
if (!VerifyConnection(self)) {
return 0;
}
WriteToCommandLogId(NULL, self->sockHandle, buffer);
if(self->iProtocolID == 5) {
if (strlen(buffer) + 30 > 1024) {
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
memset(pPtr, 0, strlen(buffer) + 20);
} else {
pPtr = pBueffel;
}
sprintf(pPtr, "%d::>%s<::", self->transID, buffer);
testAndWriteSocket(self, pPtr, iOut);
if(pPtr != pBueffel){
free(pPtr);
}
} else {
testAndWriteSocket(self, buffer, iOut);
}
return 1; return 1;
} }
@ -978,10 +1030,11 @@ int SCNotWrite(SConnection * self, char *buffer, int iOut)
return 0; return 0;
} }
/* log it for any case */ /* log it for any case
sprintf(pBueffel, "Next line intended for socket: %d", self->sockHandle); sprintf(pBueffel, "Next line intended for socket: %d", self->sockHandle);
SICSLogWrite(pBueffel, eInternal); SICSLogWrite(pBueffel, eInternal);
SICSLogWrite(buffer, iOut); SICSLogWrite(buffer, iOut);
*/
testAndStoreInTcl(self, buffer, iOut); testAndStoreInTcl(self, buffer, iOut);
return 1; return 1;
@ -1130,7 +1183,7 @@ int SCWriteZipped(SConnection * self, char *pName, void *pData,
sprintf(outBuf, "SICSBIN ZIP %s %d %d\r\n", pName, sprintf(outBuf, "SICSBIN ZIP %s %d %d\r\n", pName,
compressedLength, cc.transID); compressedLength, cc.transID);
} else { } else {
sprintf(outBuf, "SICSBIN ZIP %s %d \r\n", pName, compressedLength); sprintf(outBuf, "SICSBIN ZIP %s %d\r\n", pName, compressedLength);
} }
pHeader = strdup(outBuf); pHeader = strdup(outBuf);
if (pHeader == NULL) { if (pHeader == NULL) {
@ -1195,7 +1248,7 @@ int SCWriteBinary(SConnection * self, char *pName, void *pData,
sprintf(outBuf, "SICSBIN BIN %s %d %d\r\n", pName, sprintf(outBuf, "SICSBIN BIN %s %d %d\r\n", pName,
iDataLen, cc.transID); iDataLen, cc.transID);
} else { } else {
sprintf(outBuf, "SICSBIN BIN %s %d \r\n", pName, iDataLen); sprintf(outBuf, "SICSBIN BIN %s %d\r\n", pName, iDataLen);
} }
pHeader = strdup(outBuf); pHeader = strdup(outBuf);
if (pHeader == NULL) { if (pHeader == NULL) {
@ -1429,15 +1482,17 @@ int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen)
char pFrom[50]; char pFrom[50];
Status eOld; Status eOld;
int oldMode; int oldMode;
SConnection *master = NULL;
if (!VerifyConnection(pCon)) { if (!VerifyConnection(pCon)) {
return 0; return 0;
} }
SCWrite(pCon, pPrompt, eWarning); SCWrite(pCon, pPrompt, eWarning);
master = SCfindMaster(pCon);
eOld = GetStatus(); eOld = GetStatus();
SetStatus(eInput); SetStatus(eInput);
CostaUnlock(pCon->pStack); CostaUnlock(master->pStack);
while (1) { while (1) {
/* /*
wait a second. We want to wait even in a simulation, otherwise wait a second. We want to wait even in a simulation, otherwise
@ -1454,17 +1509,17 @@ int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen)
break; break;
} }
/* do we have data ? */ /* do we have data ? */
iRet = CostaPop(pCon->pStack, &pPtr); iRet = CostaPop(master->pStack, &pPtr);
if (iRet == 1) { if (iRet == 1) {
SetStatus(eOld); SetStatus(eOld);
CostaLock(pCon->pStack); CostaLock(master->pStack);
strlcpy(pResult, pPtr, iLen); strlcpy(pResult, pPtr, iLen);
WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr); WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr);
return 1; return 1;
} }
} }
SetStatus(eOld); SetStatus(eOld);
CostaLock(pCon->pStack); CostaLock(master->pStack);
return 0; return 0;
} }
@ -1560,7 +1615,9 @@ int SCInvoke(SConnection * self, SicsInterp * pInter, char *pCommand)
if (SCGetWriteFunc(self) != SCNotWrite) { if (SCGetWriteFunc(self) != SCNotWrite) {
sendingConnection = self->sockHandle; sendingConnection = self->sockHandle;
if (self->sockHandle >= 0) { if (self->sockHandle >= 0) {
if(strstr(pCommand,"Poch") == NULL){
WriteToCommandLogCmd(self->sockHandle, pCommand); WriteToCommandLogCmd(self->sockHandle, pCommand);
}
} else { } else {
WriteToCommandLog("CRON>>", pCommand); WriteToCommandLog("CRON>>", pCommand);
} }

View File

@ -106,6 +106,7 @@ writeFunc SCGetWriteFunc(SConnection * pCon);
void SCSetWriteFunc(SConnection * pCon, writeFunc x); void SCSetWriteFunc(SConnection * pCon, writeFunc x);
int SCOnlySockWrite(SConnection * self, char *buffer, int iOut); int SCOnlySockWrite(SConnection * self, char *buffer, int iOut);
int SCPureSockWrite(SConnection * self, char *buffer, int iOut); int SCPureSockWrite(SConnection * self, char *buffer, int iOut);
int SCLogWrite(SConnection * self, char *buffer, int iOut);
int SCFileWrite(SConnection * self, char *buffer, int iOut); int SCFileWrite(SConnection * self, char *buffer, int iOut);
int SCNotWrite(SConnection * self, char *buffer, int iOut); int SCNotWrite(SConnection * self, char *buffer, int iOut);
int SCNormalWrite(SConnection * self, char *buffer, int iOut); int SCNormalWrite(SConnection * self, char *buffer, int iOut);

View File

@ -241,7 +241,7 @@ static int CheckCountStatus(void *pData, SConnection * pCon)
if(self->pDriv->fTime > .0){ if(self->pDriv->fTime > .0){
rate = (float)(self->pDriv->lCounts[1])/self->pDriv->fTime; rate = (float)(self->pDriv->lCounts[1])/self->pDriv->fTime;
if(rate > 5000){ if(rate > 10000){
SCWrite(pCon,"WARNING: Your control monitor is running into dead time", SCWrite(pCon,"WARNING: Your control monitor is running into dead time",
eWarning); eWarning);
} }

View File

@ -103,7 +103,7 @@ int Drive(SConnection * pCon, SicsInterp * pInter, char *name, float fNew)
if (pInt) { if (pInt) {
iRet = pInt->CheckLimits(pDum, fNew, pBueffel, 511); iRet = pInt->CheckLimits(pDum, fNew, pBueffel, 511);
if (!iRet) { if (!iRet) {
SCWrite(pCon, pBueffel, eError); SCWrite(pCon, pBueffel, eLogError);
SCSetInterrupt(pCon, eAbortOperation); SCSetInterrupt(pCon, eAbortOperation);
return 0; return 0;
} }

View File

@ -40,6 +40,7 @@ extern char *trim(char *);
extern void SNXFormatTime(char *pBueffel, int iLen); extern void SNXFormatTime(char *pBueffel, int iLen);
#define ABS(x) (x < 0 ? -(x) : (x))
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct { typedef struct {
FILE *profFile; /* file with reflection profiles, ccl */ FILE *profFile; /* file with reflection profiles, ccl */
@ -766,6 +767,12 @@ static int GenInconsumerate(pSICSOBJ self, SConnection * pCon,
for (i = 0; i < priv->masterCount; i++) { for (i = 0; i < priv->masterCount; i++) {
GetRefIndex(priv->messList, i, hkl); GetRefIndex(priv->messList, i, hkl);
if(ABS(hkl[0])+ABS(hkl[1])+ABS(hkl[2]) < .3){
/*
* Stop generation for 0,0,0,
*/
continue;
}
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
hkl[j] += qvec[j]; hkl[j] += qvec[j];
} }

45
macro.c
View File

@ -728,7 +728,52 @@ int ClientPut(SConnection * pCon, SicsInterp * pInter, void *pData,
} }
return 1; return 1;
} }
/*-----------------------------------------------------------------
ClientLog writes to the socket and the command log only
-------------------------------------------------------------------*/
int ClientLog(SConnection * pCon, SicsInterp * pInter, void *pData,
int argc, char *argv[])
{
OutCode eOut = eLog;
int i = 0, iLen;
char *pMessage = NULL;
assert(pCon);
assert(pInter);
if (argc < 2) {
SCWrite(pCon, "Insufficient arguments to ClientLog", eError);
return 0;
}
/* recombine the message */
/* find length */
iLen = 0;
for (i = 1; i < argc; i++) {
iLen += strlen(argv[i]);
}
pMessage = (char *) malloc((iLen + 100) * sizeof(char));
if (!pMessage) {
SCWrite(pCon, "ERROR: out of memory in clientlo", eLogError);
return 0;
}
memset(pMessage, 0, (iLen + 100) * sizeof(char));
Arg2Text(argc - 1, &argv[1], pMessage, (iLen + 100) * sizeof(char));
SCLogWrite(pCon,pMessage, eError);
free(pMessage);
return 1;
}
/*-----------------------------------------------------------------------
A heartbeat command .............
------------------------------------------------------------------------*/
int Poch(SConnection * pCon, SicsInterp * pInter, void *pData,
int argc, char *argv[])
{
SCPureSockWrite(pCon,"Poch", eLog);
return 1;
}
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
int GumPut(SConnection * pCon, SicsInterp * pInter, void *pData, int GumPut(SConnection * pCon, SicsInterp * pInter, void *pData,
int argc, char *argv[]) int argc, char *argv[])

View File

@ -37,6 +37,7 @@ typedef struct __Motor {
int retryCount; /* for retries in status */ int retryCount; /* for retries in status */
int posFaultCount; int posFaultCount;
int stopped; int stopped;
int stopReported;
int errorCount; int errorCount;
int running; int running;
ObPar *ParArray; ObPar *ParArray;

View File

@ -105,6 +105,7 @@ static long SecMotorRun(void *sulf, SConnection * pCon, float fNew)
return 0; return 0;
} }
self->stopped = 0; self->stopped = 0;
self->stopReported = 0;
v = MakeHdbFloat(fNew); v = MakeHdbFloat(fNew);
status = SetHipadabaPar(self->pDescriptor->parNode, v, pCon); status = SetHipadabaPar(self->pDescriptor->parNode, v, pCon);
@ -211,7 +212,10 @@ static int checkPosition(pMotor self, SConnection * pCon)
pHdb node = NULL; pHdb node = NULL;
if (self->stopped) { if (self->stopped) {
SCPrintf(pCon, eWarning, "WARNING: %s stopped", self->name); if(self->stopReported == 0){
SCPrintf(pCon, eLog, "WARNING: %s stopped", self->name);
self->stopReported = 1;
}
return HWFault; return HWFault;
} }
if (SCGetInterrupt(pCon) != eContinue) { if (SCGetInterrupt(pCon) != eContinue) {

View File

@ -553,7 +553,7 @@ typedef struct {
int iTerminal; int iTerminal;
} ParDat; } ParDat;
static void DummyError(void *pData, char *pError) static void DummyError(void *p, char *pError)
{ {
return; return;
} }
@ -720,9 +720,9 @@ static void NXDIAttValue(ParDat * sStat)
int NXDIParsePath(NXhandle hfil, ParDat * pParse) int NXDIParsePath(NXhandle hfil, ParDat * pParse)
{ {
int iRet, iToken; int iRet, iToken;
void (*ErrFunc) (void *pData, char *pErr);
char pName[132], pClass[132]; char pName[132], pClass[132];
char pError[256]; char pError[256];
void *pData = NULL;
/* get the name */ /* get the name */
NXDIDefToken(pParse); /* next token */ NXDIDefToken(pParse); /* next token */
@ -760,12 +760,11 @@ int NXDIParsePath(NXhandle hfil, ParDat * pParse)
strcpy(pClass, pParse->pToken); strcpy(pClass, pParse->pToken);
/* done reading, ACTION, first install dummy error handler */ /* done reading, ACTION, first install dummy error handler */
ErrFunc = NXIReportError; NXMDisableErrorReporting();
NXMSetError(NXpData,DummyError);
/* try opening vGroup */ /* try opening vGroup */
iRet = NXopengroup(hfil, pName, pClass); iRet = NXopengroup(hfil, pName, pClass);
NXMSetError(NXpData,ErrFunc); NXMEnableErrorReporting();
if (iRet == NX_OK) { if (iRet == NX_OK) {
pParse->iDepth++; pParse->iDepth++;
return NX_OK; return NX_OK;
@ -960,7 +959,6 @@ static int NXDIParseSDS(NXhandle hfil, ParDat * pParse)
int iRet, iStat, i; int iRet, iStat, i;
char pError[256]; char pError[256];
char pName[NX_MAXNAMELEN]; char pName[NX_MAXNAMELEN];
void (*ErrFunc) (void *pData, char *pErr);
AttItem sAtt; AttItem sAtt;
@ -1061,12 +1059,11 @@ static int NXDIParseSDS(NXhandle hfil, ParDat * pParse)
/* first install dummy error handler, try open it, then /* first install dummy error handler, try open it, then
deinstall again and create if allowed deinstall again and create if allowed
*/ */
ErrFunc = NXIReportError; NXMDisableErrorReporting();
NXMSetError(NXpData, DummyError);
/* try opening SDS */ /* try opening SDS */
iRet = NXopendata(hfil, pName); iRet = NXopendata(hfil, pName);
NXMSetError(NXpData, ErrFunc); NXMEnableErrorReporting();
if (iRet == NX_OK) { if (iRet == NX_OK) {
LLDdelete(iList); LLDdelete(iList);
return NX_OK; return NX_OK;
@ -1687,16 +1684,15 @@ NXstatus NXUwriteglobals(NXhandle pFile,
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
NXstatus NXUentergroup(NXhandle hFil, char *name, char *class) NXstatus NXUentergroup(NXhandle hFil, char *name, char *class)
{ {
void (*ErrFunc) (void *pData, char *pErr);
int iRet; int iRet;
/* ACTION, first install dummy error handler */ /* ACTION, first install dummy error handler */
ErrFunc = NXIReportError; NXMDisableErrorReporting();
NXMSetError(NXpData, DummyError);
/* try opening vGroup */ /* try opening vGroup */
iRet = NXopengroup(hFil, name, class); iRet = NXopengroup(hFil, name, class);
NXMSetError(NXpData, ErrFunc); NXMEnableErrorReporting();
if (iRet == NX_OK) { if (iRet == NX_OK) {
return NX_OK; return NX_OK;
} else { } else {
@ -1719,16 +1715,14 @@ NXstatus NXUentergroup(NXhandle hFil, char *name, char *class)
NXstatus NXUenterdata(NXhandle hFil, char *label, int datatype, NXstatus NXUenterdata(NXhandle hFil, char *label, int datatype,
int rank, int dim[], char *pUnits) int rank, int dim[], char *pUnits)
{ {
void (*ErrFunc) (void *pData, char *pErr);
int iRet; int iRet;
/* ACTION, first install dummy error handler */ /* ACTION, first install dummy error handler */
ErrFunc = NXIReportError; NXMDisableErrorReporting();
NXMSetError(NXpData, DummyError);
/* try opening SDS */ /* try opening SDS */
iRet = NXopendata(hFil, label); iRet = NXopendata(hFil, label);
NXMSetError(NXpData, ErrFunc); NXMEnableErrorReporting();
if (iRet == NX_OK) { if (iRet == NX_OK) {
return NX_OK; return NX_OK;
} else { } else {

2
ofac.c
View File

@ -68,6 +68,8 @@ static void InitIniCommands(SicsInterp * pInter)
PCMD("broadcast", Broadcast); PCMD("broadcast", Broadcast);
PCMD("Capture", CaptureAction); PCMD("Capture", CaptureAction);
PCMD("ClientPut", ClientPut); PCMD("ClientPut", ClientPut);
PCMD("ClientLog", ClientLog);
PCMD("Poch", Poch);
PCMD("config", ConfigCon); PCMD("config", ConfigCon);
PCMD("db", SICSDebug); PCMD("db", SICSDebug);
PCMD("Dir", ListObjects); PCMD("Dir", ListObjects);

View File

@ -210,7 +210,7 @@ int SctCommand(SConnection * con, SicsInterp * sics, void *object,
SCsetMacro(con, queueData->inMacro); /* take macro flag stored at set callback */ SCsetMacro(con, queueData->inMacro); /* take macro flag stored at set callback */
} }
Arg2Text(argc - 2, argv + 2, value, sizeof value); Arg2Text(argc - 2, argv + 2, value, sizeof value);
SCWrite(con, value, eWarning); SCWrite(con, value, eLog);
SCsetMacro(con, 1); /* we are always in Macro */ SCsetMacro(con, 1); /* we are always in Macro */
return 1; return 1;
} }
@ -469,7 +469,7 @@ static char *SctActionHandler(void *actionData, char *lastReply,
emsg = GetHdbProp(node, eprop); emsg = GetHdbProp(node, eprop);
if (emsg == NULL || con != controller->conn) { if (emsg == NULL || con != controller->conn) {
GetHdbPath(node, path, sizeof path); GetHdbPath(node, path, sizeof path);
SCPrintf(con, eError, SCPrintf(con, eLogError,
"ERROR: action {%s} in {%s} node %s:\nERROR: %s", "ERROR: action {%s} in {%s} node %s:\nERROR: %s",
data->name, origScript, path, result); data->name, origScript, path, result);
if(data != NULL && data->controller != NULL){ if(data != NULL && data->controller != NULL){

View File

@ -818,7 +818,7 @@ static int copyNode(pSICSData self, int argc, char *argv[],
return 0; return 0;
} }
if(argc < 2){ if(argc > 2){
status = Tcl_GetInt(InterpGetTcl(pSics), argv[2], &length); status = Tcl_GetInt(InterpGetTcl(pSics), argv[2], &length);
if (status != TCL_OK) { if (status != TCL_OK) {
SCWrite(pCon, SCWrite(pCon,
@ -827,6 +827,8 @@ static int copyNode(pSICSData self, int argc, char *argv[],
} else { } else {
length = node->value.arrayLength; length = node->value.arrayLength;
} }
} else {
length = node->value.arrayLength;
} }
if(length < 1) { if(length < 1) {
length = 1; length = 1;

View File

@ -3094,10 +3094,12 @@ static hdbCallbackReturn ChainCallback(pHdb node, void *userData,
} }
if (slave != NULL) { if (slave != NULL) {
/*
memset(&vv, 0, sizeof(hdbValue)); memset(&vv, 0, sizeof(hdbValue));
GetHipadabaPar(slave, &vv, mm->callData); GetHipadabaPar(slave, &vv, mm->callData);
UpdateHipadabaPar(slave, vv, mm->callData); */
ReleaseHdbValue(&vv); UpdateHipadabaPar(slave, *(mm->v), mm->callData);
/* ReleaseHdbValue(&vv); */
} }
return hdbContinue; return hdbContinue;
} }

View File

@ -563,12 +563,9 @@ int prepareDataFile(pScanData self)
pTcl = InterpGetTcl(pServ->pSics); pTcl = InterpGetTcl(pServ->pSics);
val = Tcl_GetVar(pTcl,"simMode",TCL_GLOBAL_ONLY); val = Tcl_GetVar(pTcl,"simMode",TCL_GLOBAL_ONLY);
if(val != NULL){ if(val != NULL && strstr(val,"2") != NULL){
if(strstr(val,"2") != NULL){
pPtr = strdup("sicssim.scn"); pPtr = strdup("sicssim.scn");
}
} else { } else {
/* allocate a new data file */ /* allocate a new data file */
pPtr = ScanMakeFileName(pServ->pSics, self->pCon); pPtr = ScanMakeFileName(pServ->pSics, self->pCon);
if (!pPtr) { if (!pPtr) {

View File

@ -40,6 +40,8 @@ static long TASSetValue(void *pData, SConnection * pCon, float value)
{ {
ptasMot self = (ptasMot) pData; ptasMot self = (ptasMot) pData;
assert(self); assert(self);
int qcodes[] = {3,4,5,8}; /* qh,qk,ql, en */
int i;
if (self->code > 5 && self->math->tasMode == ELASTIC) { if (self->code > 5 && self->math->tasMode == ELASTIC) {
SCWrite(pCon, "ERROR: cannot drive this motor in elastic mode", SCWrite(pCon, "ERROR: cannot drive this motor in elastic mode",
@ -48,6 +50,11 @@ static long TASSetValue(void *pData, SConnection * pCon, float value)
} }
setTasPar(&self->math->target, self->math->tasMode, self->code, value); setTasPar(&self->math->target, self->math->tasMode, self->code, value);
self->math->mustDrive = 1; self->math->mustDrive = 1;
for(i = 0; i < 4; i++){
if(self->code == qcodes[i]) {
self->math->mustDriveQ = 1;
}
}
return OKOK; return OKOK;
} }
@ -525,16 +532,25 @@ static int calculateAndDrive(ptasMot self, SConnection * pCon)
driveTilt = 0; driveTilt = 0;
} }
if(self->math->mustDriveQ == 0){
driveQ = 0;
}
if (driveQ != 0) { if (driveQ != 0) {
if (!checkQMotorLimits(self, pCon, angles, driveTilt)) { if (!checkQMotorLimits(self, pCon, angles, driveTilt)) {
driveQ = 0; driveQ = 0;
} }
} }
if (driveQ == 0) { if (driveQ == 0 && self->math->mustDriveQ == 1) {
SCWrite(pCon, "WARNING: NOT driving Q-vector because of errors", SCWrite(pCon, "WARNING: NOT driving Q-vector because of errors",
eError); eError);
} }
/*
* reset the Q flag
*/
self->math->mustDriveQ = 0;
return startMotors(self, angles, pCon, driveQ, driveTilt); return startMotors(self, angles, pCon, driveQ, driveTilt);
} }

View File

@ -656,6 +656,7 @@ static int TASUBScanDrive(pScanData self, int iPoint)
int i, status, iPtr; int i, status, iPtr;
int iTAS = 0; int iTAS = 0;
pMotor pMot; pMotor pMot;
pDynString err;
pTAS->ub->silent = 1; pTAS->ub->silent = 1;
/* /*
@ -665,7 +666,7 @@ static int TASUBScanDrive(pScanData self, int iPoint)
DynarGet(self->pScanVar, i, &pPtr); DynarGet(self->pScanVar, i, &pPtr);
pVar = (pVarEntry) pPtr; pVar = (pVarEntry) pPtr;
if (pVar) { if (pVar) {
StartMotor(pServ->pExecutor, self->pSics, self->pCon, pVar->Name, status = StartMotor(pServ->pExecutor, self->pSics, self->pCon, pVar->Name,
RUNDRIVE, pVar->fStart + iPoint * pVar->fStep); RUNDRIVE, pVar->fStart + iPoint * pVar->fStep);
/* /*
Ignore errors. TAS scans continues when a motor runs into Ignore errors. TAS scans continues when a motor runs into

View File

@ -27,6 +27,7 @@
double targetEn, actualEn; double targetEn, actualEn;
int mustRecalculate; int mustRecalculate;
int mustDrive; int mustDrive;
int mustDriveQ;
pMotor motors[12]; pMotor motors[12];
tasReflection r1, r2; tasReflection r1, r2;
int ubValid; int ubValid;

View File

@ -1,3 +1,4 @@
exe batchpath ./ exe batchpath ./
exe syspath ./ exe syspath ./
@ -218,15 +219,20 @@ tasub r2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
tasub update tasub update
#----- MultiMotor sa #----- MultiMotor sa
sa recovernampos noeff a3 24 a4 48 sa recovernampos noeff a3 24 a4 48
ref anglesheader stt,om,chi,phi ref anglesheader stt,om,chi,phi
ref clear ref clear
singlex cell 0 0 0 0 0 0 singlex cell { 0 0 0 0 0 0}
singlex oldub 0 0 0 0 0 0 0 0 0 singlex oldub { 0 0 0 0 0 0 0 0 0}
singlex ub 0 0 0 0 0 0 0 0 0 singlex ub { 0 0 0 0 0 0 0 0 0}
singlex planenormal 0 0 0 singlex planenormal { 0 0 0}
singlex mode bi singlex mode bi
singlex spacegroup P singlex spacegroup P
singlex peaksearch singlex peaksearch {}
singlex peaksearch/min2t 5 singlex peaksearch/min2t 5
singlex peaksearch/step2t 1 singlex peaksearch/step2t 1
singlex peaksearch/max2t 15 singlex peaksearch/max2t 15
@ -238,6 +244,7 @@ singlex peaksearch/phimin 0
singlex peaksearch/phimax 180 singlex peaksearch/phimax 180
singlex peaksearch/chimin 90 singlex peaksearch/chimin 90
singlex peaksearch/chimax 180 singlex peaksearch/chimax 180
#HKL Settings #HKL Settings
hkl scantolerance 2.500000 hkl scantolerance 2.500000
ubcalcint difftheta 0.300000 ubcalcint difftheta 0.300000
@ -249,13 +256,32 @@ messref clear
fmess weak 0 fmess weak 0
fmess weakthreshold 20 fmess weakthreshold 20
fmess fast 0 fmess fast 0
fmess hkllim -10 -10 10 10 10 10 fmess hkllim { -10 -10 10 10 10 10}
fmess sttlim 5 180 fmess sttlim { 5 180}
fmess table clear fmess table clear
cone target 0 0 0 cone target { 0 0 0}
cone qscale 1 cone qscale 1
cone center unknown cone center unknown
simidx sttlim 0.2 simidx sttlim 0.2
simidx anglim 0.5 simidx anglim 0.5
simi preset 0 simi preset 0
simi mode monitor simi mode monitor
nano targetposition -50
nano sign 1
nano softzero 0
nano softlowerlim -10000
nano softupperlim 10000
nano fixed -1
nano interruptmode 0
nano precision 0.01
nano accesscode 2
nano failafter 3
nano maxretry 3
nano ignorefault 0
nano movecount 10

View File

@ -797,3 +797,21 @@ source ../sim/poldi_sics/zug.tcl
#MakeSPSS7 s7 203 251 129.129.195.55:2005 #MakeSPSS7 s7 203 251 129.129.195.55:2005
#MakeSPSS7 s7 203 251 localhost:8090 #MakeSPSS7 s7 203 251 localhost:8090
set jvl 0
if {$jvl == 1} {
source ../sim/boa_sics/jvl.tcl
makesctcontroller jvlsct jvl localhost:8080
jvlsct debug -1
jvl::make ja 2 jvlsct -10000 10000 120
}
set nanotec 1
if {$nanotec == 1} {
source ../sim/boa_sics/nanotec.tcl
makesctcontroller nanosct std localhost:8080 \r 1 \r
nanosct debug -1
nanotec::make nano 1 nanosct -100000 100000 120
}