diff --git a/plugin/SqueezeESP32.zip b/plugin/SqueezeESP32.zip
index be686348..863c2e3b 100644
Binary files a/plugin/SqueezeESP32.zip and b/plugin/SqueezeESP32.zip differ
diff --git a/plugin/SqueezeESP32/FirmwareHelper.pm b/plugin/SqueezeESP32/FirmwareHelper.pm
index 55292ae4..0312f7ef 100644
--- a/plugin/SqueezeESP32/FirmwareHelper.pm
+++ b/plugin/SqueezeESP32/FirmwareHelper.pm
@@ -63,6 +63,9 @@ sub initFirmwareDownload {
$cb->() if $cb;
}
}
+ elsif ($cb) {
+ $cb->();
+ }
},
sub {
my ($http, $error) = @_;
@@ -119,10 +122,15 @@ sub prefetchFirmware {
$cb->($releaseInfo, _gh2lmsUrl($url), $customFwUrl) if $cb;
}
+ elsif ($cb) {
+ $cb->();
+ }
},
sub {
my ($http, $error) = @_;
$log->error("Failed to get releases from Github: $error");
+
+ $cb->() if $cb;
},
{
timeout => 10,
diff --git a/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html b/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html
index 85e9d6e8..f5e683d5 100644
--- a/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html
+++ b/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html
@@ -1,3 +1,55 @@
+[% IF useExtJS; extJsScripts = BLOCK %]
+
+[% END; ELSIF !useExtJS; pageHeaderScripts = BLOCK %]
+
+[% END; END %]
+
[% PROCESS settings/header.html %]
[% WRAPPER setting title="PLUGIN_SQUEEZEESP32_FIRMWARE" desc="" %]
@@ -59,62 +111,36 @@
[% "PLUGIN_SQUEEZEESP32_EQUALIZER_SAVE" | string %]
[% END %]
-
[% WRAPPER settingSection %]
[% WRAPPER settingGroup title='31Hz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='62Hz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='125Hz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='250Hz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='500Hz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='1kHz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='2kHz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='4kHz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='8kHz' desc="" %]
-
+
[% END %]
[% WRAPPER settingGroup title='16kHz' desc="" %]
-
+
[% END %]
[% END %]
[% END %]
diff --git a/plugin/SqueezeESP32/Player.pm b/plugin/SqueezeESP32/Player.pm
index d73c2880..cbc32d3b 100644
--- a/plugin/SqueezeESP32/Player.pm
+++ b/plugin/SqueezeESP32/Player.pm
@@ -32,8 +32,8 @@ our $defaultPrefs = {
'analogOutMode' => 0,
'bass' => 0,
'treble' => 0,
- 'lineInAlwaysOn' => 0,
- 'lineInLevel' => 50,
+ 'lineInAlwaysOn' => 0,
+ 'lineInLevel' => 50,
'menuItem' => [qw(
NOW_PLAYING
BROWSE_MUSIC
@@ -67,51 +67,66 @@ sub minBass { -13 }
sub init {
my $client = shift;
my ($id, $caps) = @_;
-
+
my ($depth) = $caps =~ /Depth=(\d+)/;
$client->depth($depth || 16);
-
+
if (!$handlersAdded) {
-
+
# Add a handler for line-in/out status changes
Slim::Networking::Slimproto::addHandler( LIOS => \&lineInOutStatus );
-
+
# Create a new event for sending LIOS updates
Slim::Control::Request::addDispatch(
['lios', '_state'],
[1, 0, 0, undef],
);
-
+
Slim::Control::Request::addDispatch(
['lios', 'linein', '_state'],
[1, 0, 0, undef],
);
-
+
Slim::Control::Request::addDispatch(
['lios', 'lineout', '_state'],
[1, 0, 0, undef],
);
-
+
$handlersAdded = 1;
}
-
+
$client->SUPER::init(@_);
Plugins::SqueezeESP32::FirmwareHelper::init($client);
main::INFOLOG && $log->is_info && $log->info("SqueezeESP player connected: " . $client->id);
-}
+}
sub initPrefs {
my $client = shift;
-
+
$sprefs->client($client)->init($defaultPrefs);
-
- $prefs->client($client)->init( {
+
+ $prefs->client($client)->init( {
equalizer => [(0) x 10],
artwork => undef,
} );
+ $prefs->setValidate({
+ validator => sub {
+ my ($pref, $new, $params, $old, $client) = @_;
+
+ $new ||= [(0) x 10];
+
+ foreach (0..9) {
+ return 0 if $new->[$_] < $client->minBass;
+ return 0 if $new->[$_] > $client->maxBass;
+ }
+
+ return 1;
+ }
+ }, 'equalizer');
+
$client->SUPER::initPrefs;
}
@@ -121,15 +136,15 @@ sub power {
my $res = $client->SUPER::power($on, @_);
return $res unless defined $on;
-
+
if ($on) {
$client->update_artwork(1);
} else {
$client->clear_artwork(1);
}
-
+
return $res;
-}
+}
# Allow the player to define it's display width (and probably more)
sub playerSettingsFrame {
@@ -162,16 +177,16 @@ sub playerSettingsFrame {
sub bass {
my ($client, $new) = @_;
my $value = $client->SUPER::bass($new);
-
+
$client->update_equalizer($value, [2, 1, 3]) if defined $new;
-
+
return $value;
}
sub treble {
my ($client, $new) = @_;
my $value = $client->SUPER::treble($new);
-
+
$client->update_equalizer($value, [8, 9, 7]) if defined $new;
return $value;
@@ -189,8 +204,8 @@ sub send_equalizer {
sub update_equalizer {
my ($client, $value, $index) = @_;
return if $client->tone_update;
-
- my $equalizer = $prefs->client($client)->get('equalizer');
+
+ my $equalizer = $prefs->client($client)->get('equalizer');
$equalizer->[$index->[0]] = $value;
$equalizer->[$index->[1]] = int($value / 2 + 0.5);
$equalizer->[$index->[2]] = int($value / 4 + 0.5);
@@ -203,7 +218,7 @@ sub update_tones {
$client->tone_update(1);
$sprefs->client($client)->set('bass', int(($equalizer->[1] * 2 + $equalizer->[2] + $equalizer->[3] * 4) / 7 + 0.5));
$sprefs->client($client)->set('treble', int(($equalizer->[7] * 4 + $equalizer->[8] + $equalizer->[9] * 2) / 7 + 0.5));
- $client->tone_update(0);
+ $client->tone_update(0);
}
sub update_artwork {
@@ -212,7 +227,7 @@ sub update_artwork {
my $artwork = $cprefs->get('artwork') || return;
return unless $artwork->{'enable'} && $client->display->isa("Plugins::SqueezeESP32::Graphics");
-
+
my $header = pack('Nnn', $artwork->{'enable'}, $artwork->{'x'}, $artwork->{'y'});
$client->sendFrame( grfa => \$header );
$client->display->update;
@@ -267,7 +282,7 @@ sub clear_artwork {
if ((!$artwork->{'x'} && !$artwork->{'y'}) || $force) {
$client->sendFrame(grfa => \("\x00"x4));
$client->display->update;
- }
+ }
}
}
@@ -284,7 +299,7 @@ sub config_artwork {
sub reconnect {
my $client = shift;
$client->SUPER::reconnect(@_);
-
+
$client->pluginData('artwork_md5', '');
$client->config_artwork if $client->display->isa("Plugins::SqueezeESP32::Graphics");
$client->send_equalizer;
@@ -323,18 +338,18 @@ sub lineOutConnected {
sub lineInOutStatus {
my ( $client, $data_ref ) = @_;
-
+
my $state = unpack 'n', $$data_ref;
my $oldState = {
in => $client->lineInConnected(),
out => $client->lineOutConnected(),
};
-
+
Slim::Networking::Slimproto::voltage( $client, $state );
Slim::Control::Request::notifyFromArray( $client, [ 'lios', $state ] );
-
+
if ($oldState->{in} != $client->lineInConnected()) {
Slim::Control::Request::notifyFromArray( $client, [ 'lios', 'linein', $client->lineInConnected() ] );
if ( Slim::Utils::PluginManager->isEnabled('Slim::Plugin::LineIn::Plugin')) {
diff --git a/plugin/SqueezeESP32/PlayerSettings.pm b/plugin/SqueezeESP32/PlayerSettings.pm
index 83be9d07..4265f335 100644
--- a/plugin/SqueezeESP32/PlayerSettings.pm
+++ b/plugin/SqueezeESP32/PlayerSettings.pm
@@ -3,7 +3,7 @@ package Plugins::SqueezeESP32::PlayerSettings;
use strict;
use base qw(Slim::Web::Settings);
use JSON::XS::VersionOneAndTwo;
-use List::Util qw(first);
+use List::Util qw(first min max);
use Slim::Utils::Log;
use Slim::Utils::Prefs;
@@ -79,9 +79,10 @@ sub handler {
if ($client->can('depth') && $client->depth == 16) {
my $equalizer = $cprefs->get('equalizer');
- for my $i (0 .. $#{$equalizer}) {
- $equalizer->[$i] = $paramRef->{"pref_equalizer.$i"} || 0;
+ foreach (0 .. 9) {
+ $equalizer->[$_] = min($client->maxBass, max($client->minBass, $paramRef->{"pref_equalizer.$_"} || 0))
}
+ $equalizer = [ splice(@$equalizer, 0, 10) ];
$cprefs->set('equalizer', $equalizer);
$client->update_tones($equalizer);
}
@@ -97,6 +98,7 @@ sub handler {
$paramRef->{'pref_equalizer'} = $cprefs->get('equalizer') if $client->can('depth') && $client->depth == 16;
$paramRef->{'player_ip'} = $client->ip;
+ require Plugins::SqueezeESP32::FirmwareHelper;
Plugins::SqueezeESP32::FirmwareHelper::initFirmwareDownload($client, sub {
my ($currentFWInfo, $newFWUrl, $customFwUrl) = @_;
diff --git a/plugin/SqueezeESP32/install.xml b/plugin/SqueezeESP32/install.xml
index 7ab3d2d3..b96ab123 100644
--- a/plugin/SqueezeESP32/install.xml
+++ b/plugin/SqueezeESP32/install.xml
@@ -10,6 +10,6 @@
PLUGIN_SQUEEZEESP32
PLUGIN_SQUEEZEESP32_DESC
Plugins::SqueezeESP32::Plugin
- 0.351
+ 0.352
Philippe
diff --git a/plugin/repo.xml b/plugin/repo.xml
index e719805a..6c68fab8 100644
--- a/plugin/repo.xml
+++ b/plugin/repo.xml
@@ -1,10 +1,10 @@
-
+
https://github.com/sle118/squeezelite-esp32
Philippe
- 3209d93e2b02c1c9161572977f03c93938272b30
+ 757946e8aecc05a0600fe887c370996a1a399b4b
philippe_44@outlook.com
SqueezeESP32 additional player id (100/101)
http://github.com/sle118/squeezelite-esp32/raw/master-cmake/plugin/SqueezeESP32.zip