Jelajahi Sumber

Announce lamp life when we get close to the end

Zachary Kotlarek 13 tahun lalu
induk
melakukan
d15e476f29
1 mengubah file dengan 16 tambahan dan 0 penghapusan
  1. 16 0
      dmx/projectorPower.pl

+ 16 - 0
dmx/projectorPower.pl

@@ -17,6 +17,7 @@ my $COLOR_DELAY = 60;
 my $COLOR_HIGH  = 'THEATER';
 my $COLOR_PLAY  = 'THEATER_BLACK_1';
 my $COLOR_LOW   = 'THEATER_BLACK_1';
+my $LAMP_LIFE   = 2000;
 
 # App config
 my $DATA_DIR     = DMX::dataDir();
@@ -236,6 +237,21 @@ while (1) {
 		# Annouce the state change, after the fact
 		DMX::say('Projector ' . $state);
 
+		# Announce lamp life status, if near/past $LAMP_LIFE
+		if (exists($exists{'PROJECTOR_LAMP'})) {
+			my $life    = $exists{'PROJECTOR_LAMP'} / $LAMP_LIFE;
+			if ($DEBUG) {
+				print STDERR 'Lamp life: ' . $life . "%\n";
+			}
+
+			if ($life > 0.9) {
+				my $chance = ($life - 0.9) * 10;
+				if (rand(1) <= $chance) {
+					DMX::say('Projector lamp has run for ' . int($life * 100) . '% of its projected life.');
+				}
+			}
+		}
+
 		# No output file
 
 		# Update the push time