- A couple of small fixes for memory and initialization problems.
This is to make valgrind happy SKIPPED: psi/amorscan.c psi/el734hp.c psi/psi.c psi/tasscan.c
This commit is contained in:
27
interface.c
27
interface.c
@@ -41,7 +41,7 @@
|
||||
#include <assert.h>
|
||||
#include "fortify.h"
|
||||
#include "sics.h"
|
||||
|
||||
#include "motor.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
pIDrivable CreateDrivableInterface(void)
|
||||
@@ -108,6 +108,31 @@
|
||||
{
|
||||
return (pIDrivable)FindInterface(pObject,DRIVEID);
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int GetDrivablePosition(void *pObject, SConnection *pCon, float *fPos)
|
||||
{
|
||||
pIDrivable pDriv = NULL;
|
||||
pMotor pMot = NULL;
|
||||
float value;
|
||||
|
||||
pDriv = GetDrivableInterface(pObject);
|
||||
if(pDriv == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(iHasType(pObject,"Motor"))
|
||||
{
|
||||
pMot = (pMotor)pObject;
|
||||
return MotorGetSoftPosition(pMot,pCon,fPos);
|
||||
}
|
||||
value = pDriv->GetValue(pObject,pCon);
|
||||
if(value < 9999.99)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*fPos = value;
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
pICountable GetCountableInterface(void *pObject)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user