compiled DUT stuff
authorstephen
Wed, 08 Mar 2017 12:34:34 +0000
changeset 44 1983a3cc0647
parent 43 7330bec02cfc
child 45 9d35ca12c867
compiled DUT stuff
ker-off.c
ker-on.c
stateManager.h
trypbm.sh
--- a/ker-off.c	Wed Mar 08 12:16:44 2017 +0000
+++ b/ker-off.c	Wed Mar 08 12:34:34 2017 +0000
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <phidget21.h>
 
-int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)
+int  AttachHandler(CPhidgetHandle IFK, void *userptr)
 {
 	int serialNo;
 	const char *name;
@@ -24,7 +24,7 @@
 	return 0;
 }
 
-int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
+int  DetachHandler(CPhidgetHandle IFK, void *userptr)
 {
 	int serialNo;
 	const char *name;
@@ -37,7 +37,7 @@
 	return 0;
 }
 
-int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
+int  ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
 {
 	printf("Error handled. %d - %s", ErrorCode, unknown);
 	return 0;
@@ -45,7 +45,7 @@
 
 //callback that will run if an input changes.
 //Index - Index of the input that generated the event, State - boolean (0 or 1) representing the input state (on or off)
-int CCONV InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
+int  InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
 {
 	printf("Digital Input: %d > State: %d\n", Index, State);
 	return 0;
@@ -53,7 +53,7 @@
 
 //callback that will run if an output changes.
 //Index - Index of the output that generated the event, State - boolean (0 or 1) representing the output state (on or off)
-int CCONV OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
+int  OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
 {
 	printf("Digital Output: %d > State: %d\n", Index, State);
 	return 0;
@@ -61,7 +61,7 @@
 
 //callback that will run if the sensor value changes by more than the OnSensorChange trigger.
 //Index - Index of the sensor that generated the event, Value - the sensor read value
-int CCONV SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
+int  SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
 {
 	printf("Sensor: %d > Value: %d\n", Index, Value);
 	return 0;
--- a/ker-on.c	Wed Mar 08 12:16:44 2017 +0000
+++ b/ker-on.c	Wed Mar 08 12:34:34 2017 +0000
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <phidget21.h>
 
-int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)
+int  AttachHandler(CPhidgetHandle IFK, void *userptr)
 {
 	int serialNo;
 	const char *name;
@@ -24,7 +24,7 @@
 	return 0;
 }
 
-int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
+int  DetachHandler(CPhidgetHandle IFK, void *userptr)
 {
 	int serialNo;
 	const char *name;
@@ -37,7 +37,7 @@
 	return 0;
 }
 
-int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
+int  ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
 {
 	printf("Error handled. %d - %s", ErrorCode, unknown);
 	return 0;
@@ -45,7 +45,7 @@
 
 //callback that will run if an input changes.
 //Index - Index of the input that generated the event, State - boolean (0 or 1) representing the input state (on or off)
-int CCONV InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
+int  InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
 {
 	printf("Digital Input: %d > State: %d\n", Index, State);
 	return 0;
@@ -53,7 +53,7 @@
 
 //callback that will run if an output changes.
 //Index - Index of the output that generated the event, State - boolean (0 or 1) representing the output state (on or off)
-int CCONV OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
+int  OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
 {
 	printf("Digital Output: %d > State: %d\n", Index, State);
 	return 0;
@@ -61,7 +61,7 @@
 
 //callback that will run if the sensor value changes by more than the OnSensorChange trigger.
 //Index - Index of the sensor that generated the event, Value - the sensor read value
-int CCONV SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
+int  SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
 {
 	printf("Sensor: %d > Value: %d\n", Index, Value);
 	return 0;
--- a/stateManager.h	Wed Mar 08 12:16:44 2017 +0000
+++ b/stateManager.h	Wed Mar 08 12:34:34 2017 +0000
@@ -66,6 +66,7 @@
 int updateLogfile(FILE *logfile,
 	int Voltage,
 	int Amps,
+	int dutAmps,
 	int state,
 	int spiking,
 	const char *progName);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trypbm.sh	Wed Mar 08 12:34:34 2017 +0000
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+# script to locally try out a rebuilt pbm with same
+# settins as used in pbm (usually run from /etc/init.d)
+
+set -x
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+DESC="power manager daemon test"
+NAME=pbmd
+DAEMON=./$NAME
+# to set the node to sleep from 22:00 to 06:00 use this
+DAEMON_ARGS="/var/log/battery.log /var/log/battery-snapshot.log /etc/bootflag 60 ABS 22 6"
+# to set the node to sleep from 14:10 to 16:45 use this
+# DAEMON_ARGS="/var/log/battery.log /var/log/battery-snapshot.log /etc/bootflag 60 ABS 14 10 16 45"
+# to set the node to sleep for 10 minutes of every 30 use this
+# DAEMON_ARGS="/var/log/battery.log /var/log/battery-snapshot.log /etc/bootflag 60 REL 30 10"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+$DAEMON $DAEMON_ARGS