Explorar o código

Use the new from

Zachary Kotlarek %!s(int64=13) %!d(string=hai) anos
pai
achega
db1d1a150d
Modificáronse 6 ficheiros con 62 adicións e 44 borrados
  1. 10 7
      dmx/bias.pl
  2. 10 7
      dmx/fan.pl
  3. 10 7
      dmx/garage.pl
  4. 12 9
      dmx/leds.pl
  5. 10 7
      dmx/overhead.pl
  6. 10 7
      dmx/rope.pl

+ 10 - 7
dmx/bias.pl

@@ -64,22 +64,25 @@ while (1) {
 		$pullLast = time();
 	}
 
+	# Die if we don't see regular updates
+	if (time() - $pullLast > $PULL_TIMEOUT) {
+		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
+	}
+
 	# Accept the new state directly
 	$stateLast = $state;
 	$state     = $newState;
 
 	# Force updates on a periodic basis
-	if (time() - $pushLast > $PUSH_TIMEOUT) {
+	if (!$update && time() - $pushLast > $PUSH_TIMEOUT) {
+		if ($DEBUG) {
+			print STDERR "Forcing periodic update\n";
+		}
 		$update = 1;
 	}
 
-	# Die if we don't see regular updates
-	if (time() - $pullLast > $PULL_TIMEOUT) {
-		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
-	}
-
 	# Force updates on any state change
-	if ($stateLast ne $state) {
+	if (!$update && $stateLast ne $state) {
 		if ($DEBUG) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}

+ 10 - 7
dmx/fan.pl

@@ -55,6 +55,11 @@ while (1) {
 		$newState = $cmdState;
 		$pullLast = time();
 	}
+	
+	# Die if we don't see regular updates
+	if (time() - $pullLast > $PULL_TIMEOUT) {
+		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
+	}
 
 	# Calculate the new state
 	$stateLast = $state;
@@ -65,17 +70,15 @@ while (1) {
 	}
 
 	# Force updates on a periodic basis
-	if (time() - $pushLast > $PUSH_TIMEOUT) {
+	if (!$update && time() - $pushLast > $PUSH_TIMEOUT) {
+		if ($DEBUG) {
+			print STDERR "Forcing periodic update\n";
+		}
 		$update = 1;
 	}
 
-	# Die if we don't see regular updates
-	if (time() - $pullLast > $PULL_TIMEOUT) {
-		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
-	}
-
 	# Force updates on any state change
-	if ($stateLast ne $state) {
+	if (!$update && $stateLast ne $state) {
 		if ($DEBUG) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}

+ 10 - 7
dmx/garage.pl

@@ -58,6 +58,11 @@ while (1) {
 		$pullLast = time();
 	}
 
+	# Die if we don't see regular updates
+	if (time() - $pullLast > $PULL_TIMEOUT) {
+		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
+	}
+
 	# Calculate the new state
 	$stateLast = $state;
 	if ($newState eq 'ACTIVATE' || $exists{'GARAGE_CMD'}) {
@@ -67,17 +72,15 @@ while (1) {
 	}
 
 	# Force updates on a periodic basis
-	if (time() - $pushLast > $PUSH_TIMEOUT) {
+	if (!$update && time() - $pushLast > $PUSH_TIMEOUT) {
+		if ($DEBUG) {
+			print STDERR "Forcing periodic update\n";
+		}
 		$update = 1;
 	}
 
-	# Die if we don't see regular updates
-	if (time() - $pullLast > $PULL_TIMEOUT) {
-		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
-	}
-
 	# Force updates on any state change
-	if ($stateLast ne $state) {
+	if (!$update && $stateLast ne $state) {
 		if ($DEBUG) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}

+ 12 - 9
dmx/leds.pl

@@ -139,6 +139,11 @@ while (1) {
 		$newState = $cmdState;
 		$pullLast = time();
 	}
+	
+	# Die if we don't see regular updates
+	if (time() - $pullLast > $PULL_TIMEOUT) {
+		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
+	}
 
 	# Handle "STOP" commands
 	if ($newState eq 'STOP') {
@@ -250,27 +255,25 @@ while (1) {
 	}
 
 	# Force updates on a periodic basis
-	if (time() - $pushLast > $PUSH_TIMEOUT) {
+	if (!$update && time() - $pushLast > $PUSH_TIMEOUT) {
+		if ($DEBUG) {
+			print STDERR "Forcing periodic update\n";
+		}
 		$update = 1;
 	}
 
-	# Die if we don't see regular updates
-	if (time() - $pullLast > $PULL_TIMEOUT) {
-		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
-	}
-
 	# Force updates on any state change
-	if ($stateLast ne $state) {
+	if (!$update && $stateLast ne $state) {
 		if ($DEBUG) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}
 		$update = 1;
-
+		
 		# Reset the color change sequence, so we always spend 1 cycle at white
 		@COLOR       = ();
 		$colorChange = time() + $COLOR_TIME_MIN;
 	}
-
+	
 	# Update the lighting
 	if ($update) {
 

+ 10 - 7
dmx/overhead.pl

@@ -65,6 +65,11 @@ while (1) {
 		$pullLast = time();
 	}
 
+	# Die if we don't see regular updates
+	if (time() - $pullLast > $PULL_TIMEOUT) {
+		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
+	}
+
 	# Skip processing when in RAVE mode
 	if ($exists{'RAVE'}) {
 		if ($DEBUG) {
@@ -88,17 +93,15 @@ while (1) {
 	$state = $newState;
 
 	# Force updates on a periodic basis
-	if (time() - $pushLast > $PUSH_TIMEOUT) {
+	if (!$update && time() - $pushLast > $PUSH_TIMEOUT) {
+		if ($DEBUG) {
+			print STDERR "Forcing periodic update\n";
+		}
 		$update = 1;
 	}
 
-	# Die if we don't see regular updates
-	if (time() - $pullLast > $PULL_TIMEOUT) {
-		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
-	}
-
 	# Force updates on any state change
-	if ($stateLast ne $state) {
+	if (!$update && $stateLast ne $state) {
 		if ($DEBUG) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}

+ 10 - 7
dmx/rope.pl

@@ -109,6 +109,11 @@ while (1) {
 		$newState = $cmdState;
 		$pullLast = time();
 	}
+	
+	# Die if we don't see regular updates
+	if (time() - $pullLast > $PULL_TIMEOUT) {
+		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
+	}
 
 	# Skip processing when in RAVE mode
 	if ($exists{'RAVE'}) {
@@ -133,17 +138,15 @@ while (1) {
 	$state = $newState;
 
 	# Force updates on a periodic basis
-	if (time() - $pushLast > $PUSH_TIMEOUT) {
+	if (!$update && time() - $pushLast > $PUSH_TIMEOUT) {
+		if ($DEBUG) {
+			print STDERR "Forcing periodic update\n";
+		}
 		$update = 1;
 	}
 
-	# Die if we don't see regular updates
-	if (time() - $pullLast > $PULL_TIMEOUT) {
-		die('No update on state socket in past ' . $PULL_TIMEOUT . " seconds. Exiting...\n");
-	}
-
 	# Force updates on any state change
-	if ($stateLast ne $state) {
+	if (!$update && $stateLast ne $state) {
 		if ($DEBUG) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}