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

Track the actual amp power state, not our internal one

Zachary Kotlarek 14 лет назад
Родитель
Сommit
adfcb6cda8
1 измененных файлов с 16 добавлено и 1 удалено
  1. 16 1
      amplifier/power.pl

+ 16 - 1
amplifier/power.pl

@@ -45,8 +45,23 @@ while (1) {
 		}
 		}
 	}
 	}
 
 
+	# Monitor the AMPLIFIER file for state only
+	{
+		$stateLast = 'OFF';
+		my $fh;
+		open($fh, $DATA_DIR . '/AMPLIFIER')
+		  or die("Unable to open AMPLIFIER\n");
+		my $text = <$fh>;
+		close($fh);
+		if ($text =~ /1/) {
+			$stateLast = 'ON';
+		}
+		if ($DEBUG) {
+			print STDERR 'Amplifier: ' . $stateLast . "\n";
+		}
+	}
+
 	# Calculate the new state -- track the projector power state
 	# Calculate the new state -- track the projector power state
-	my $stateLast = $state;
 	if ($projector) {
 	if ($projector) {
 		$state = 'ON';
 		$state = 'ON';
 	} else {
 	} else {