// Files containing GPIO and PWM definitions
#include "bbb_pin.h"
-
-
-
/** Number of actuators **/
int g_num_actuators = 0;
{
case CONTROL_START:
{
+ // Set filename
char filename[BUFSIZ];
- const char *experiment_name = (const char*) arg;
+ const char *experiment_path = (const char*) arg;
+ int ret;
+
+ ret = snprintf(filename, BUFSIZ, "%s/actuator_%d", experiment_path, a->id);
- if (snprintf(filename, BUFSIZ, "%s_a%d", experiment_name, a->id) >= BUFSIZ)
+ if (ret >= BUFSIZ)
{
- Fatal("Experiment name \"%s\" too long (>%d)", experiment_name, BUFSIZ);
+ Fatal("Experiment path \"%s\" too long (%d, limit %d)",
+ experiment_path, ret, BUFSIZ);
}
Log(LOGDEBUG, "Actuator %d with DataFile \"%s\"", a->id, filename);
*/
void Actuator_SetModeAll(ControlModes mode, void * arg)
{
- for (int i = 0; i < ACTUATORS_MAX; i++)
+ for (int i = 0; i < g_num_actuators; i++)
Actuator_SetMode(&g_actuators[i], mode, arg);
}