Przeglądaj źródła

Wait longer, and trust the state filtering

Zachary Kotlarek 13 lat temu
rodzic
commit
577d4fb6b2
1 zmienionych plików z 9 dodań i 10 usunięć
  1. 9 10
      dmx/projectorPower.pl

+ 9 - 10
dmx/projectorPower.pl

@@ -17,7 +17,7 @@ my $CMD_DELAY   = 5;
 my $COLOR_DELAY = 60;
 my $COLOR_DELAY = 60;
 my $COLOR_HIGH  = 'DYNAMIC';
 my $COLOR_HIGH  = 'DYNAMIC';
 my $COLOR_LOW   = 'THEATER_BLACK_1';
 my $COLOR_LOW   = 'THEATER_BLACK_1';
-my $STATE_DELAY = 10;
+my $STATE_DELAY = 15;
 
 
 # App config
 # App config
 my $DATA_DIR     = DMX::dataDir();
 my $DATA_DIR     = DMX::dataDir();
@@ -233,6 +233,14 @@ while (1) {
 		$proj->send($state)
 		$proj->send($state)
 		  or die('Unable to write command to proj socket: ' . $state . ": ${!}\n");
 		  or die('Unable to write command to proj socket: ' . $state . ": ${!}\n");
 
 
+		# Wait -- the Epson UB6500 does not respond to queries while changing power states
+		# This is pretty long, but we don't set the update clock until it returns so we won't timeout
+		# We should delay until a projector mtime update, but that's a lot of work for this simple script
+		if ($DEBUG) {
+			print STDERR 'Delaying ' . $STATE_DELAY . " seconds while projector changes state\n";
+		}
+		sleep($STATE_DELAY);
+
 		# Annouce the state change, after the fact
 		# Annouce the state change, after the fact
 		say('Projector ' . $state);
 		say('Projector ' . $state);
 
 
@@ -246,15 +254,6 @@ while (1) {
 
 
 		# Clear the update flag
 		# Clear the update flag
 		$update = 0;
 		$update = 0;
-
-		# If the command was 'OFF' wait a while for the projector to catch up
-		# The Epson UB6500 does not respond to queries while changing power states
-		if ($state eq 'OFF') {
-			if ($DEBUG) {
-				print STDERR 'Delaying ' . $STATE_DELAY . " seconds while projector changes state\n";
-			}
-			sleep($STATE_DELAY);
-		}
 	}
 	}
 }
 }