Преглед изворни кода

Set the amp to TV @ 5.1 at power on

Zachary Kotlarek пре 13 година
родитељ
комит
c358e28867
2 измењених фајлова са 15 додато и 1 уклоњено
  1. 11 1
      amplifier/amplifierPower.pl
  2. 4 0
      serial/serial.pl

+ 11 - 1
amplifier/amplifierPower.pl

@@ -86,6 +86,16 @@ while (1) {
 			$sock->send($state)
 			  or die('Unable to write command to socket: ' . $CMD_FILE . ': ' . $state . ": ${!}\n");
 		}
+
+		# Reset to TV @ 5.1 at power on
+		if ($state eq 'ON') {
+			# Wait for the amp to boot
+			sleep($DELAY);
+			$sock->send('TV')
+			  or die('Unable to write command to socket: ' . $CMD_FILE . ': TV' . ": ${!}\n");
+			$sock->send('SURROUND')
+			  or die('Unable to write command to socket: ' . $CMD_FILE . ': SURROUND' . ": ${!}\n");
+		}
 	}
 
 	# Wait and loop
@@ -95,4 +105,4 @@ while (1) {
 # Cleanup
 $sock->close();
 undef($sock);
-exit(0);
+exit(0);

+ 4 - 0
serial/serial.pl

@@ -44,6 +44,8 @@ if (basename($0) =~ /PROJECTOR/i) {
 		'DVD'      => 'SIDVD',
 		'SURROUND' => 'MSDOLBY DIGITAL',
 		'STEREO'   => 'MS7CH STEREO',
+		'TV'       => 'SITV',
+		'INPUT'    => 'SI?',
 
 	);
 	$STATUS_ON = 'PWON';
@@ -90,8 +92,10 @@ my $CMD_FILE = $DATA_DIR . uc($DEV) . '.socket';
 my $DEBUG = 0;
 if ($ENV{'DEBUG'}) {
 	$DEBUG = 1;
+	print STDERR "Debug enabled\n";
 }
 
+
 # Command-line arguments
 my ($DELAY) = @ARGV;
 if (!$DELAY) {