add SSD1322 + few tweaks - release

This commit is contained in:
Philippe G
2020-04-01 20:03:57 -07:00
parent 4c546180fd
commit 26330ee69e
8 changed files with 284 additions and 47 deletions

View File

@@ -77,7 +77,7 @@ sub displayWidth {
if ($display->widthOverride) {
my $artwork = $prefs->client($client)->get('artwork');
if ($artwork->{'enable'} && $artwork->{'y'} < 32 && $client->isPlaying) {
if ($artwork->{'enable'} && $artwork->{'y'} < 32 && ($client->isPlaying || $client->isPaused)) {
return $artwork->{x} + ($display->modes->[$mode || 0]{_width} || 0);
} else {
return $display->widthOverride + ($display->modes->[$mode || 0]{_width} || 0);
@@ -168,45 +168,58 @@ sub build_modes {
# mode 9
{ desc => ['VISUALIZER_VUMETER'],
bar => 0, secs => 0, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, 0] },
params => [$VISUALIZER_VUMETER_ESP32, $width, 0] },
# mode 10
{ desc => ['VISUALIZER_ANALOG_VUMETER'],
bar => 0, secs => 0, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, 1] },
params => [$VISUALIZER_VUMETER_ESP32, $width, 1] },
# mode 11
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER'],
bar => 0, secs => 0, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, $width, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
);
my @extra = (
# mode E1
{ desc => ['VISUALIZER_VUMETER', 'AND', 'ELAPSED'],
bar => 0, secs => 1, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, 0] },
params => [$VISUALIZER_VUMETER_ESP32, $width, 0] },
# mode E2
{ desc => ['VISUALIZER_ANALOG_VUMETER', 'AND', 'ELAPSED'],
bar => 0, secs => 1, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, 1] },
params => [$VISUALIZER_VUMETER_ESP32, $width, 1] },
# mode E3
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'ELAPSED'],
bar => 0, secs => 1, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, $width, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
# mode E4
{ desc => ['VISUALIZER_VUMETER', 'AND', 'REMAINING'],
bar => 0, secs => -1, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, 0] },
params => [$VISUALIZER_VUMETER_ESP32, $width, 0] },
# mode E5
{ desc => ['VISUALIZER_ANALOG_VUMETER', 'AND', 'REMAINING'],
bar => 0, secs => -1, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, 1] },
params => [$VISUALIZER_VUMETER_ESP32, $width, 1] },
# mode E6
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'REMAINING'],
bar => 0, secs => -1, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, $width, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
# mode E7
{ desc => ['VISUALIZER_VUMETER', 'AND', 'PROGRESS_BAR', 'AND', 'REMAINING'],
bar => 1, secs => -1, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, $width, 0] },
# mode E8
{ desc => ['VISUALIZER_ANALOG_VUMETER', 'AND', 'PROGRESS_BAR', 'AND', 'REMAINING'],
bar => 1, secs => -1, width => $width,
params => [$VISUALIZER_VUMETER_ESP32, $width, 1] },
# mode E9
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'PROGRESS_BAR', 'AND', 'REMAINING'],
bar => 1, secs => -1, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, $width, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
);
@modes = (@modes, @extra) if $cprefs->get('height') > 32;

View File

@@ -35,8 +35,22 @@ sub initPlugin {
Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['newmetadata'] ] );
Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['playlist'], ['open', 'newsong'] ]);
Slim::Control::Request::subscribe( \&onStopClear, [ ['playlist'], ['stop', 'clear'] ]);
}
sub onStopClear {
my $request = shift;
my $client = $request->client;
my $artwork = $prefs->client($client)->get('artwork');
if ($client->model eq 'squeezeesp32' && $artwork->{'enable'}) {
my $reqstr = $request->getRequestString();
$log->info("artwork stop/clear $reqstr");
$client->pluginData('artwork_md5', '')
}
}
sub onNotification {
my $request = shift;
my $client = $request->client;
@@ -56,8 +70,7 @@ sub update_artwork {
return unless $client->model eq 'squeezeesp32' && $artwork->{'enable'};
my $s = $artwork->{'y'} >= 32 ? $cprefs->get('height') - $artwork->{'y'} : 32;
$s = min($s, $cprefs->get('width') - $artwork->{'x'});
my $s = min($cprefs->get('height') - $artwork->{'y'}, $cprefs->get('width') - $artwork->{'x'});
my $path = 'music/current/cover_' . $s . 'x' . $s . '_o.jpg';
my $body = Slim::Web::Graphics::artworkRequest($client, $path, $params, \&send_artwork, undef, HTTP::Response->new);

View File

@@ -10,6 +10,6 @@
<name>PLUGIN_SQUEEZEESP32</name>
<description>PLUGIN_SQUEEZEESP32_DESC</description>
<module>Plugins::SqueezeESP32::Plugin</module>
<version>0.61</version>
<version>0.70</version>
<creator>Philippe</creator>
</extensions>