 
 
 void perhaps_update_main_signal() {
-  if (millis() > main_signal_next_time_ms) {
-    main_signal_value += 1;
+  if (millis() > main_signal_next_time_ms && !mainSignalDone) {
+    main_signal_value++;
     if (main_signal_value > MAIN_SIGNAL_MAX) {
+      mainSignalDone=true;
       main_signal.detach();
+      return;
     }
     main_signal_next_time_ms += main_signal_timestep_ms;
     main_signal.writeMicroseconds(main_signal_value);

int MAIN_SIGNAL_MAX = 1750;
int MAIN_SIGNAL_DURATION_MS = 2200;
int main_signal_timestep_ms;
unsigned int main_signal_next_time_ms;
int main_signal_value;


int SECONDARY_SIGNAL_MAX = 1750;
int SECONDARY_SIGNAL_DURATION_MS = 2200;
int secondary_signal_timestep_ms;
boolean secondarySignalDone=false;
unsigned int secondary_signal_next_time_ms;
int secondary_signal_value;

