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

Remember to reset the color sequence

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

+ 9 - 4
dmx/leds.pl

@@ -268,15 +268,20 @@ while (1) {
 			print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
 		}
 		$update = 1;
-		
-		# Reset the color change sequence, so we always spend 1 cycle at white
-		@COLOR       = ();
-		$colorChange = time() + $COLOR_TIME_MIN;
 	}
 	
 	# Update the lighting
 	if ($update) {
 
+		# Reset the color change sequence on any state change, so we always spend 1 cycle at white
+		if ($stateLast ne $state) {
+			if ($DEBUG) {
+				print STDERR "Reset color sequence\n";
+			}
+			@COLOR       = ();
+			$colorChange = time() + $COLOR_TIME_MIN;
+		}
+
 		# Select a data set (color or standard)
 		my @data_set    = ();
 		my $local_state = $state;