- Added support for accessing the exe file management functions from scripts
- Fixed a bug in hmdata.c - Fixed an issue with tempoerature writing through RemObjects in mesure - Added auxiliary reflections to tasub - Make maximize use soft motor positions
This commit is contained in:
37
maximize.c
37
maximize.c
@ -47,6 +47,7 @@
|
||||
#include "counter.h"
|
||||
#include "drive.h"
|
||||
#include "maximize.h"
|
||||
#include "motor.h"
|
||||
|
||||
#define MAXPTS 100
|
||||
#define DEBUG 1
|
||||
@ -135,7 +136,25 @@
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static float readMPDrivable(void *pVar, SConnection *pCon)
|
||||
{
|
||||
float value = -999.99;
|
||||
pIDrivable pDriv = NULL;
|
||||
pDummy pDum = (pDummy)pVar;
|
||||
|
||||
pDriv = GetDrivableInterface(pVar);
|
||||
assert(pDriv != NULL);
|
||||
if(strcmp(pDum->pDescriptor->name,"Motor") == 0)
|
||||
{
|
||||
MotorGetSoftPosition((pMotor)pVar,pCon,&value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = pDriv->GetValue(pVar,pCon);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int MaximizePeak(pMax self, void *pVar, char *pVarName,
|
||||
float fStep, CounterMode eMode,
|
||||
@ -160,9 +179,9 @@
|
||||
start:
|
||||
lMax = 0;
|
||||
lMin = 0x7fffffff;
|
||||
fStart = pDriv->GetValue(pVar,pCon);
|
||||
fStart = readMPDrivable(pVar,pCon);
|
||||
if(fStart < -999999.)
|
||||
{
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -174,13 +193,13 @@
|
||||
fPos = fStart - (self->maxpts/2 - i)*fStep;
|
||||
fPos = in360(self,fPos);
|
||||
if(maxDrive(pVar,pVarName,fPos,pCon) != 1)
|
||||
{
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
x[i] = pDriv->GetValue(pVar,pCon);
|
||||
x[i] = readMPDrivable(pVar,pCon);
|
||||
/* count */
|
||||
if(maxCount(self->pCount,eMode,fPreset, &lCts,pCon) != 1)
|
||||
{
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* print a message */
|
||||
@ -256,7 +275,7 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
x[i] = pDriv->GetValue(pVar,pCon);
|
||||
x[i] = readMPDrivable(pVar,pCon);
|
||||
/* count */
|
||||
if(maxCount(self->pCount,eMode,fPreset, &lCts,pCon) != 1)
|
||||
{
|
||||
@ -426,7 +445,9 @@
|
||||
AddCommand(pSics,"max",MaximizeAction,MaxKill,pNew);
|
||||
return 1;
|
||||
}
|
||||
/*------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------
|
||||
* max motor step preset mode
|
||||
* ---------------------------------------------------------------------*/
|
||||
int MaximizeAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
|
Reference in New Issue
Block a user