- Removed slit 5 from amorset.c
- poldizug now sends all codes all the time - polterwrite writes the filename again - sanswave has been modifed to support the new second generation velocity selector - sinqhttprot has been mdified to copy data to nodes, this for the second generation HM object - tasscan suppressed some output
This commit is contained in:
37
sanswave.c
37
sanswave.c
@ -16,14 +16,32 @@
|
||||
#include "motor.h"
|
||||
#include "velo.h"
|
||||
#include "sanswave.h"
|
||||
#include "sicshipadaba.h"
|
||||
|
||||
#define NOTILT 801
|
||||
|
||||
static int SWGetTilt(void *data, float *fTilt)
|
||||
{
|
||||
pDummy pDum = (pDummy)data;
|
||||
pHdb node = NULL;
|
||||
|
||||
if(strcmp(pDum->pDescriptor->name,"VelocitySelector") == 0) {
|
||||
return VSGetTilt((pVelSel)data, fTilt);
|
||||
} else if(strcmp(pDum->pDescriptor->name,"NVS") == 0){
|
||||
node = GetHipadabaNode(pDum->pDescriptor->parNode,"tilt");
|
||||
assert(node != NULL);
|
||||
*fTilt = (float)node->value.v.doubleValue;
|
||||
return 1;
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
typedef struct __SANSwave {
|
||||
pObjectDescriptor pDes;
|
||||
pIDrivable pDrivInt;
|
||||
pVelSel pSelector;
|
||||
void *pSelector;
|
||||
} SANSWave;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@ -89,7 +107,7 @@ static int SWLimits(void *pData, float fVal, char *error, int iErrLen)
|
||||
assert(pDriv);
|
||||
|
||||
/* get tilt */
|
||||
iRet = VSGetTilt(self->pSelector, &fTilt);
|
||||
iRet = SWGetTilt(self->pSelector, &fTilt);
|
||||
if (!iRet) {
|
||||
strncpy(error, "Failed to obtain tilt angle", iErrLen);
|
||||
return 0;
|
||||
@ -119,7 +137,7 @@ static long SWSet(void *pData, SConnection * pCon, float fVal)
|
||||
/* get tilt */
|
||||
fTilt = -910;
|
||||
for (i = 0; i < 3; i++) {
|
||||
iRet = VSGetTilt(self->pSelector, &fTilt);
|
||||
iRet = SWGetTilt(self->pSelector, &fTilt);
|
||||
if (iRet) {
|
||||
break;
|
||||
} else {
|
||||
@ -169,7 +187,7 @@ static float SWGetValue(void *pData, SConnection * pCon)
|
||||
/* get tilt */
|
||||
fTilt = -910;
|
||||
for (i = 0; i < 3; i++) {
|
||||
iRet = VSGetTilt(self->pSelector, &fTilt);
|
||||
iRet = SWGetTilt(self->pSelector, &fTilt);
|
||||
if (iRet) {
|
||||
break;
|
||||
} else {
|
||||
@ -182,8 +200,8 @@ static float SWGetValue(void *pData, SConnection * pCon)
|
||||
}
|
||||
|
||||
/* get rotation speed */
|
||||
iRet = VSGetRotation(self->pSelector, &fRot);
|
||||
if (!iRet) {
|
||||
fRot = pDriv->GetValue(self->pSelector, pCon);
|
||||
if (fRot < -9999.) {
|
||||
SCWrite(pCon, "ERROR: cannot reading rotation speed", eError);
|
||||
return -99999.99;
|
||||
}
|
||||
@ -262,7 +280,7 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
KillSANSWave(pNew);
|
||||
return 0;
|
||||
}
|
||||
pNew->pSelector = (pVelSel) pCom->pData;
|
||||
pNew->pSelector = pCom->pData;
|
||||
if (!pNew->pSelector) {
|
||||
sprintf(pBueffel, "ERROR: velocity selector %s is invalid", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
@ -270,7 +288,8 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
pDum = (pDummy) pNew->pSelector;
|
||||
if (strcmp(pDum->pDescriptor->name, "VelocitySelector") != 0) {
|
||||
if (strcmp(pDum->pDescriptor->name, "VelocitySelector") != 0
|
||||
&& strcmp(pDum->pDescriptor->name,"NVS") == 0) {
|
||||
sprintf(pBueffel, "ERROR: velocity selector %s is invalid", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillSANSWave(pNew);
|
||||
@ -322,7 +341,7 @@ int SANSWaveAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
if (argc > 2) {
|
||||
strtolower(argv[1]);
|
||||
/* whatever we are asked to do, we need the current tilt angle */
|
||||
iRet = VSGetTilt(self->pSelector, &fTilt);
|
||||
iRet = SWGetTilt(self->pSelector, &fTilt);
|
||||
if (!iRet) {
|
||||
SCWrite(pCon, "ERROR: failed to read tilt angle", eError);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user