Procházet zdrojové kódy

Delay before switching to pause lighting

Zachary Kotlarek před 12 roky
rodič
revize
ddcb9c768e
1 změnil soubory, kde provedl 9 přidání a 4 odebrání
  1. 9 4
      dmx/projectorPower.pl

+ 9 - 4
dmx/projectorPower.pl

@@ -9,10 +9,11 @@ use lib dirname(abs_path($0));
 use DMX;
 use DMX;
 
 
 # Config
 # Config
-my $TIMEOUT   = 900;
-my $COUNTDOWN = 119;
-my $OFF_DELAY = 15;
-my $CMD_DELAY = 20;
+my $TIMEOUT     = 900;
+my $COUNTDOWN   = 119;
+my $OFF_DELAY   = 15;
+my $CMD_DELAY   = 20;
+my $PAUSE_DELAY = 12;
 
 
 # Available color modes, bright to dark:
 # Available color modes, bright to dark:
 #	DYNAMIC
 #	DYNAMIC
@@ -83,6 +84,7 @@ my $life         = 0;
 my @color_sets   = sort { $a <=> $b } keys(%COLORS);
 my @color_sets   = sort { $a <=> $b } keys(%COLORS);
 my $color_set    = $color_sets[0];
 my $color_set    = $color_sets[0];
 my $color        = $COLORS{$color_set}{'low'};
 my $color        = $COLORS{$color_set}{'low'};
+my $lastPlay     = 0;
 
 
 # Loop forever
 # Loop forever
 while (1) {
 while (1) {
@@ -195,6 +197,9 @@ while (1) {
 	# PLAY if we haven't figured out what else to do
 	# PLAY if we haven't figured out what else to do
 	my $playLights = 0;
 	my $playLights = 0;
 	if ($newState eq 'PLAY') {
 	if ($newState eq 'PLAY') {
+		$lastPlay   = $now;
+		$playLights = 1;
+	} elsif ($newState eq 'PAUSE' && $lastPlay + $PAUSE_DELAY > $now) {
 		$playLights = 1;
 		$playLights = 1;
 	} elsif ($exists{'PLAYING_TYPE'} eq 'audio') {
 	} elsif ($exists{'PLAYING_TYPE'} eq 'audio') {
 		$color = $COLORS{$color_set}{'low'};
 		$color = $COLORS{$color_set}{'low'};