plugin change to turn leds off on power down

This commit is contained in:
Wizmo2
2023-05-01 09:45:10 +01:00
parent 290f4b5cb4
commit 959cbe0c38
3 changed files with 5 additions and 1 deletions

Binary file not shown.

View File

@@ -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;

View File

@@ -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);