a->name = name;
a->set = set; // Set read function
a->init = init; // Set init function
- if (init != NULL)
- init(name, user_id); // Call it
+
a->sanity = sanity;
pthread_mutex_init(&(a->mutex), NULL);
+ if (init != NULL)
+ {
+ if (!init(name, user_id))
+ Fatal("Couldn't initialise actuator %s", name);
+ }
+
Actuator_SetValue(a, initial_value, false);
return g_num_actuators;
FCGI_RejectJSON(context, "No id or name supplied");
return;
}
- else if (id < 0 || id >= ACTUATORS_MAX)
+ else if (id < 0 || id >= g_num_actuators)
{
FCGI_RejectJSON(context, "Invalid Actuator id");
return;
return;
}
Actuator_SetControl(a, &c);
-
}
// Begin response