#include "sensors/resource.h"
#include "sensors/strain.h"
#include "sensors/pressure.h"
+#include "sensors/dilatometer.h"
void Sensor_Init()
{
//Sensor_Add("cpu_stime", RESOURCE_CPU_SYS, Resource_Read, NULL, NULL, NULL);
//Sensor_Add("pressure1", PRESSURE1, Pressure_Read, Pressure_Init, 5000,0,5000,0);
//Sensor_Add("pressure_feedback", PRESSURE_FEEDBACK, Pressure_Read, Pressure_Init, 5000,0,5000,0);
//Sensor_Add("enclosure", ENCLOSURE, Enclosure_Read, Enclosure_Init, 1,1,1,1);
- //Sensor_Add("dilatometer", DILATOMETER, Dilatometer_Read, Dilatometer_Init, -1,-1,-1,-1);
+ Sensor_Add("dilatometer", 0, Dilatometer_Read, Dilatometer_Init, Dilatometer_Cleanup, NULL);
}
/**
/**
* Cleanup Dilatometer pointers
*/
-void Dilatometer_Cleanup()
+bool Dilatometer_Cleanup(int id)
{
if (g_capture != NULL)
cvReleaseCapture(&g_capture);
cvReleaseMat(&g_srcGray);
if (g_edges != NULL)
cvReleaseMat(&g_edges);
+ return true;
}
/**
* @param val - Will store the read value if successful
* @returns true on successful read
*/
-bool Dilatometer_Read( double * value)
+bool Dilatometer_Read(int id, double * value)
{
bool result = Dilatometer_GetEdge(value, SAMPLES);
return result;
/**
* Initialise the dilatometer
*/
-void Dilatometer_Init()
+bool Dilatometer_Init(const char * name, int id)
{
// Make an initial reading (will allocate memory the first time only).
double val;
Dilatometer_GetEdge(&val, 1);
+ return true;
}
// Overlays a line over the given edge position
* @brief Declarations for functions to deal with dilatometer
*/
-#include "common.h"
+#include "../common.h"
//Threshold to determine the edge of the can
#define THRES 230
//Number of samples of the image to take
#define SAMPLES 600
-extern void Dilatometer_Init(); // Initialise the dilatometer
-extern void Dilatometer_Cleanup(); // Cleanup
-extern bool Dilatometer_Read( double * value); // Read the Dilatometer
+extern bool Dilatometer_Init(const char * name, int id); // Initialise the dilatometer
+extern bool Dilatometer_Cleanup(int id); // Cleanup
+extern bool Dilatometer_Read(int id, double * value); // Read the Dilatometer