mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-13 23:17:03 +03:00
ledvu-update-clean
This commit is contained in:
@@ -174,6 +174,20 @@ sub setLEDVisu {
|
||||
}
|
||||
|
||||
updateLED($client);
|
||||
|
||||
# display name
|
||||
my $modes = ledVisualizerModes;
|
||||
my $desc = $modes->[$visu]{'desc'};
|
||||
my $name = '';
|
||||
for (my $j = 0; $j < scalar @$desc; $j++) {
|
||||
$name .= ' ' if ($j > 0);
|
||||
$name .= $client->string(@{$desc}[$j]) || @{$desc}[$j];
|
||||
}
|
||||
|
||||
$client->showBriefly( {
|
||||
'line1' => $client->string('PLUGIN_SQUEEZEESP32_LED_VISUALIZER'),
|
||||
'line2' => $name,
|
||||
});
|
||||
}
|
||||
|
||||
sub onNotification {
|
||||
@@ -186,4 +200,62 @@ sub onNotification {
|
||||
}
|
||||
}
|
||||
|
||||
sub setMainMode {
|
||||
my $client = shift;
|
||||
my $method = shift;
|
||||
if ($method eq 'pop') {
|
||||
Slim::Buttons::Common::popMode($client);
|
||||
$client->update();
|
||||
return;
|
||||
}
|
||||
|
||||
Slim::Buttons::Common::pushModeLeft($client, 'INPUT.Choice', {
|
||||
'listRef' => [
|
||||
{
|
||||
name => string('PLUGIN_SQUEEZEESP32_LED_VISUALIZER'),
|
||||
onPlay => sub { Slim::Control::Request::executeRequest($client, ['led_visual']); },
|
||||
},
|
||||
{
|
||||
name => string('PLUGIN_SQUEEZEESP32_LED_BRIGHTNESS'),
|
||||
onPlay => sub { Slim::Buttons::Common::pushModeLeft($client, 'squeezeesp32_ledvu_bright'); },
|
||||
},
|
||||
],
|
||||
'header' => string('PLUGIN_SQUEEZEESP32'),
|
||||
'headerAddCount' => 1,
|
||||
'overlayRef' => sub { return (undef, shift->symbols('rightarrow')) },
|
||||
});
|
||||
}
|
||||
|
||||
sub setLedvuBrightMode {
|
||||
my $client = shift;
|
||||
my $method = shift;
|
||||
if ($method eq 'pop') {
|
||||
Slim::Buttons::Common::popMode($client);
|
||||
$client->update();
|
||||
return;
|
||||
}
|
||||
|
||||
my $bright = $prefs->client($client)->get('led_brightness');
|
||||
|
||||
Slim::Control::Request::executeRequest($client, ['led_visual',1,$bright]);
|
||||
Slim::Buttons::Common::pushMode($client, 'INPUT.Bar', {
|
||||
'header' => 'PLUGIN_SQUEEZEESP32_LED_BRIGHTNESS',
|
||||
'stringHeader' => 1,
|
||||
'headerValue' => 'unscaled',
|
||||
'min' => 1,
|
||||
'max' => 255,
|
||||
'increment' => 1,
|
||||
'onChange' => sub {
|
||||
my ($client, $value) = @_;
|
||||
|
||||
$bright = $bright + $value;
|
||||
if ($bright > 0 && $bright <= 255) {
|
||||
$prefs->client($client)->set('led_brightness', $bright);
|
||||
updateLED($client);
|
||||
}
|
||||
},
|
||||
'valueRef' => $bright,
|
||||
});
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user