|
|
@@ -54,7 +54,6 @@ my $lastAnnounce = 0;
|
|
|
my $lastUser = time();
|
|
|
my $shutdown = 0;
|
|
|
my $color = $COLOR_LOW;
|
|
|
-my $wentLow = 0;
|
|
|
|
|
|
# Loop forever
|
|
|
while (1) {
|
|
|
@@ -147,20 +146,13 @@ while (1) {
|
|
|
|
|
|
# Calculate the color mode
|
|
|
# Always LOW for playback
|
|
|
- # HIGH when paused, after $COLOR_DELAY seconds
|
|
|
- # LOW again when paused for half the timeout (to save the bulb)
|
|
|
- # HIGH again when paused but there is new activity and we previously went LOW
|
|
|
- if ($newState eq 'PLAY') {
|
|
|
- $wentLow = 0;
|
|
|
- $color = $COLOR_LOW;
|
|
|
- } elsif ($elapsed > $COLOR_DELAY && $newState eq 'PAUSE') {
|
|
|
- if ($elapsed > $TIMEOUT / 2) {
|
|
|
- $wentLow = 1;
|
|
|
- $color = $COLOR_LOW;
|
|
|
- } else {
|
|
|
- $color = $COLOR_HIGH;
|
|
|
- }
|
|
|
- } elsif ($newState eq 'PAUSE' && $wentLow) {
|
|
|
+ # HIGH when the GUI is up
|
|
|
+ # LOW again when the GUI is up for half the timeout (to save the bulb)
|
|
|
+ if (!$exists{'GUI'} || $newState eq 'PLAY') {
|
|
|
+ $color = $COLOR_LOW;
|
|
|
+ } elsif ($elapsed > $TIMEOUT / 2) {
|
|
|
+ $color = $COLOR_LOW;
|
|
|
+ } else {
|
|
|
$color = $COLOR_HIGH;
|
|
|
}
|
|
|
|