Zachary Kotlarek 12 лет назад
Родитель
Сommit
15c921d325
4 измененных файлов с 21 добавлено и 15 удалено
  1. 5 3
      dmx/amplifierPower.pl
  2. 5 3
      dmx/announce.pl
  3. 7 7
      dmx/projectorPower.pl
  4. 4 2
      dmx/stairs.pl

+ 5 - 3
dmx/amplifierPower.pl

@@ -54,14 +54,16 @@ while (1) {
 	# State is calculated; use newState to gather data
 	my $newState = $state;
 
+	# Wait for state updates
+	my $cmdState = DMX::readState($DELAY, \%exists, undef(), undef());
+
 	# Avoid repeated calls to time()
 	my $now = time();
 
-	# Wait for state updates
-	my $cmdState = DMX::readState($DELAY, \%exists, undef(), undef());
+	# Record only valid states
 	if (defined($cmdState)) {
 		$newState = $cmdState;
-		$pullLast = $now;
+		$pullLast = time();
 	}
 
 	# Die if we don't see regular updates

+ 5 - 3
dmx/announce.pl

@@ -39,11 +39,13 @@ while (1) {
 	# Remember the last state, for comparison
 	%last = %exists;
 
-	# Avoid repeated system calls
-	my $now = time();
-
 	# Wait for state updates
 	my $cmdState = DMX::readState($DELAY, \%exists, undef(), undef());
+
+	# Avoid repeated calls to time()
+	my $now = time();
+
+	# Record only valid states
 	if (defined($cmdState)) {
 		$pullLast = $now;
 	}

+ 7 - 7
dmx/projectorPower.pl

@@ -92,16 +92,16 @@ while (1) {
 	# State is calculated; use newState to gather data
 	my $newState = $state;
 
+	# Wait for state updates
+	my $cmdState = DMX::readState($DELAY, \%exists, \%mtime, undef());
+
 	# Avoid repeated calls to time()
 	my $now = time();
 
-	# Wait for state updates
-	{
-		my $cmdState = DMX::readState($DELAY, \%exists, \%mtime, undef());
-		if (defined($cmdState)) {
-			$newState = $cmdState;
-			$pullLast = $now;
-		}
+	# Record only valid states
+	if (defined($cmdState)) {
+		$newState = $cmdState;
+		$pullLast = $now;
 	}
 
 	# Die if we don't see regular updates

+ 4 - 2
dmx/stairs.pl

@@ -58,11 +58,13 @@ while (1) {
 	# State is calculated; use newState to gather data
 	my $newState = $state;
 
+	# Wait for state updates
+	my $cmdState = DMX::readState($DELAY, \%exists, \%mtime, undef());
+
 	# Avoid repeated calls to time()
 	my $now = time();
 
-	# Wait for state updates
-	my $cmdState = DMX::readState($DELAY, \%exists, \%mtime, undef());
+	# Record only valid states
 	if (defined($cmdState)) {
 		$newState = $cmdState;
 		$pullLast = $now;