Browse Source

plugin change to turn leds off on power down

Wizmo2 1 year ago
parent
commit
959cbe0c38
3 changed files with 5 additions and 1 deletions
  1. BIN
      plugin/SqueezeESP32.zip
  2. 3 0
      plugin/SqueezeESP32/Player.pm
  3. 2 1
      plugin/SqueezeESP32/RgbLed.pm

BIN
plugin/SqueezeESP32.zip


+ 3 - 0
plugin/SqueezeESP32/Player.pm

@@ -150,6 +150,9 @@ sub power {
 		$client->update_artwork(1);
 	} else {
 		$client->clear_artwork(1);
+		if ($client->hasLED) {
+			Plugins::SqueezeESP32::RgbLed::updateLED($client, 0);
+		}
 	}
 
 	return $res;

+ 2 - 1
plugin/SqueezeESP32/RgbLed.pm

@@ -70,12 +70,13 @@ sub ledVisualizerNModes {
 
 sub updateLED {
 	my $client = shift;
+	my $on = shift || 1;
 	my $cprefs = $prefs->client($client);
 	
 	my $visu = $cprefs->get('led_visualizer') || 0;
 	my $bright = $cprefs->get('led_brightness') || 20;
 	
-	$visu = 0 if ($visu < 0 || $visu > ledVisualizerNModes || !(Slim::Player::Source::playmode($client) eq 'play'));
+	$visu = 0 if ($visu < 0 || $visu > ledVisualizerNModes || !(Slim::Player::Source::playmode($client) eq 'play') || !$on);
 	my $modes  = ledVisualizerModes;
 	my $params = $modes->[$visu]{'params'};
 	my $data = pack('CCC', $params->[0], $params->[1], $bright);