Просмотр исходного кода

Only update the amplifer settings if the amp is running

Zachary Kotlarek 13 лет назад
Родитель
Сommit
9beff3f5e2
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      dmx/amplifierPower.pl

+ 4 - 4
dmx/amplifierPower.pl

@@ -69,7 +69,7 @@ while (1) {
 		$state = 'OFF';
 	}
 
-	# Cacluate the channel mode
+	# Calculate the channel mode
 	if ($exists{'STEREO_CMD'} || $state eq 'RAVE') {
 		$mode = 'STEREO';
 	} else {
@@ -105,16 +105,16 @@ while (1) {
 	}
 
 	# Set the channel mode as needed
-	if ($exists{'AMPLIFIER_MODE'} ne $mode) {
+	if ($exists{'AMPLIFIER'} && $exists{'AMPLIFIER_MODE'} ne $mode) {
 		if ($DEBUG) {
 			print STDERR 'Setting mode to: ' . $mode . "\n";
 		}
 		$amp->send($mode)
-		  or die('Unable to write command to amp socket: ' . $input . ": ${!}\n");
+		  or die('Unable to write command to amp socket: ' . $mode . ": ${!}\n");
 	}
 
 	# Set the amplifier input as needed
-	if ($exists{'AMPLIFIER_INPUT'} ne $input) {
+	if ($exists{'AMPLIFIER'} && $exists{'AMPLIFIER_INPUT'} ne $input) {
 		if ($DEBUG) {
 			print STDERR 'Setting input to: ' . $input . "\n";
 		}