+ Log(LOGDEBUG, "Resuming actuator %d", a->id);
+ }
+ break;
+
+ case CONTROL_EMERGENCY: //TODO add proper case for emergency
+ case CONTROL_PAUSE:
+ a->activated = false;
+ Actuator_SetControl(a, NULL);
+ pthread_join(a->thread, NULL); // Wait for thread to exit
+
+ Log(LOGDEBUG, "Paused actuator %d", a->id);
+ break;
+
+ break;
+ case CONTROL_STOP:
+ if (a->activated) //May have been paused before
+ {
+ a->activated = false;
+ Actuator_SetControl(a, NULL);
+ pthread_join(a->thread, NULL); // Wait for thread to exit
+ }
+ Data_Close(&(a->data_file)); // Close DataFile
+
+ Log(LOGDEBUG, "Stopped actuator %d", a->id);
+ break;
+ default:
+ Fatal("Unknown control mode: %d", mode);
+ }