better screensaver handling - release

This commit is contained in:
philippe44
2020-03-21 13:24:26 -07:00
parent ff40290610
commit fb499982c2
8 changed files with 32 additions and 24 deletions

View File

@@ -736,9 +736,15 @@ static void grfa_handler(u8_t *data, int len) {
artwork.enable = (length != 0);
// clean up if we are disabling previously enabled artwork
if (!artwork.enable) {
if (artwork.size) GDS_ClearWindow(display, artwork.x, artwork.y, -1, -1, GDS_COLOR_BLACK);
// just a config or an actual artwork
if (length < 32) {
if (artwork.enable) {
// this is just to specify artwork coordinates
artwork.x = htons(pkt->x);
artwork.y = htons(pkt->y);
} else if (artwork.size) GDS_ClearWindow(display, artwork.x, artwork.y, -1, -1, GDS_COLOR_BLACK);
// done in any case
return;
}
@@ -1071,11 +1077,3 @@ static void displayer_task(void *args) {
visu.wake -= sleep;
}
}

Binary file not shown.

View File

@@ -42,7 +42,10 @@ sub new {
$display->init_accessor(
modes => $display->build_modes,
vfdmodel => 'graphic-<width>x32', # doesn't matter much
# Only seems to matter for screensaver and update to decide font. Not
# any value is acceptable, so use Boom value which seems to be best
# compromise
vfdmodel => 'graphic-160x32',
);
return $display;

View File

@@ -13,6 +13,12 @@ sub model { 'squeezeesp32' }
sub modelName { 'SqueezeESP32' }
sub hasIR { 0 }
sub init {
my $client = shift;
$client->SUPER::init(@_);
Plugins::SqueezeESP32::Plugin::config_artwork($client);
}
# Allow the player to define it's display width (and probably more)
sub playerSettingsFrame {
my $client = shift;

View File

@@ -59,7 +59,7 @@ sub handler {
if ($artwork->{'enable'}) {
Plugins::SqueezeESP32::Plugin::update_artwork($client, 1);
} else {
Plugins::SqueezeESP32::Plugin::disable_artwork($client);
Plugins::SqueezeESP32::Plugin::config_artwork($client);
}
}

View File

@@ -50,7 +50,7 @@ sub onNotification {
sub update_artwork {
my $client = shift;
my $force = shift || 0;
my $params = { force => shift || 0 };
my $cprefs = $prefs->client($client);
my $artwork = $cprefs->get('artwork');
@@ -60,17 +60,17 @@ sub update_artwork {
$s = min($s, $cprefs->get('width') - $artwork->{'x'});
my $path = 'music/current/cover_' . $s . 'x' . $s . '_o.jpg';
my $body = Slim::Web::Graphics::artworkRequest($client, $path, $force, \&send_artwork, undef, HTTP::Response->new);
my $body = Slim::Web::Graphics::artworkRequest($client, $path, $params, \&send_artwork, undef, HTTP::Response->new);
send_artwork($client, undef, \$body) if $body;
}
sub send_artwork {
my ($client, $force, $dataref) = @_;
my ($client, $params, $dataref) = @_;
# I'm not sure why we are called so often, so only send when needed
my $md5 = md5($$dataref);
return if $client->pluginData('artwork_md5') eq $md5 && !$force;
return if $client->pluginData('artwork_md5') eq $md5 && !$params->{'force'};
$client->pluginData('artwork', $dataref);
$client->pluginData('artwork_md5', $md5);
@@ -95,9 +95,10 @@ sub send_artwork {
}
}
sub disable_artwork {
sub config_artwork {
my ($client) = @_;
my $header = pack('N', 0);
my $artwork = $prefs->client($client)->get('artwork');
my $header = pack('Nnn', $artwork->{'enable'}, $artwork->{'x'}, $artwork->{'y'});
$client->sendFrame( grfa => \$header );
}

View File

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

View File

@@ -1,10 +1,10 @@
<?xml version='1.0' standalone='yes'?>
<extensions>
<plugins>
<plugin version="0.50" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
<plugin version="0.51" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
<link>https://github.com/sle118/squeezelite-esp32</link>
<creator>Philippe</creator>
<sha>47feaf69a40ad4f87c58b34212d71e60dca99d3e</sha>
<sha>22551488cdbe02c7a357b2b520f8d377af9cb7d3</sha>
<email>philippe_44@outlook.com</email>
<desc lang="EN">SqueezeESP32 additional player id (100)</desc>
<url>http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip</url>