diff --git a/components/display/text.c b/components/display/text.c index b4d9671f..733c617f 100644 --- a/components/display/text.c +++ b/components/display/text.c @@ -23,7 +23,7 @@ #include "esp_log.h" -#define LINELEN 60 +#define LINELEN 40 #define TAG "display" //Change special LCD chars to something more printable on screen @@ -94,7 +94,8 @@ void vfd_data( unsigned short *data, int bytes_read) { int addr = 0; /* counter */ if (bytes_read % 2) bytes_read--; /* even number of bytes */ - display_data = &(data[6]); /* display data starts at byte 12 */ + // if we use Noritake VFD codes, display data starts at 12 + display_data = &(data[5]); /* display data starts at byte 10 */ memset(ddram, ' ', LINELEN * 2); diff --git a/components/squeezelite/slimproto.c b/components/squeezelite/slimproto.c index f4ca0e40..c74db311 100644 --- a/components/squeezelite/slimproto.c +++ b/components/squeezelite/slimproto.c @@ -452,7 +452,7 @@ static void process_dsco(u8_t *pkt, int len) { static void process_vfdc(u8_t *pkt, int len) { LOG_DEBUG("VFDC %u", len); - vfd_data( pkt + 4, len - 4); + vfd_data( pkt, len - 4); } static void process_setd(u8_t *pkt, int len) { diff --git a/plugin/Player.pm b/plugin/Player.pm new file mode 100644 index 00000000..18a7d3ce --- /dev/null +++ b/plugin/Player.pm @@ -0,0 +1,37 @@ +package Plugins::SqueezeESP32::Player; + +use strict; +use base qw(Slim::Player::SqueezePlay); + +use Slim::Utils::Log; +use Slim::Utils::Prefs; + +my $prefs = preferences('plugin.squeezeesp32'); + +sub model { 'squeezeesp32' } +sub modelName { 'SqueezeESP32' } +sub hasIR { 0 } + +# We need to implement this to allow us to receive SETD commands +# and we need SETD to support custom display widths +sub directBodyFrame { 1 } + +# Allow the player to define it's display width (and probably more) +sub playerSettingsFrame { + my $client = shift; + my $data_ref = shift; + + my $value; + my $id = unpack('C', $$data_ref); + + # New SETD command 0xfe for display width + if ($id == 0xfe) { + $value = (unpack('CC', $$data_ref))[1]; + if ($value > 10 && $value < 200) { + $client->display->widthOverride(1, $value); + $client->update; + } + } +} + +1; diff --git a/plugin/Plugin.pm b/plugin/Plugin.pm index 247d10b2..fbd939e7 100644 --- a/plugin/Plugin.pm +++ b/plugin/Plugin.pm @@ -20,8 +20,8 @@ sub initPlugin { my $class = shift; $class->SUPER::initPlugin(@_); - Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeeze2esp32', { client => 'Slim::Player::SqueezePlay', display => 'Slim::Display::Text' }); - LOG_INFO("Added class 100 for SqueezeESP32"); + Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeeze2esp32', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Text' }); + $log->info("Added class 100 for SqueezeESP32"); } 1; diff --git a/plugin/SqueezeESP32.zip b/plugin/SqueezeESP32.zip deleted file mode 100644 index 9dc212e4..00000000 Binary files a/plugin/SqueezeESP32.zip and /dev/null differ diff --git a/plugin/Text.pm b/plugin/Text.pm new file mode 100644 index 00000000..c6e1700d --- /dev/null +++ b/plugin/Text.pm @@ -0,0 +1,10 @@ +package Plugins::SqueezeESP32::Text; + +use strict; + +use base qw(Slim::Display::Text); + +# we don't want the special Noritake codes +sub vfdmodel { 'squeezeslave' } + +1; \ No newline at end of file diff --git a/plugin/strings.txt b/plugin/strings.txt new file mode 100644 index 00000000..539ed1ac --- /dev/null +++ b/plugin/strings.txt @@ -0,0 +1,2 @@ +WELCOME_TO_SQUEEZEESP32 + EN Welcome to SqueezeESP32 \ No newline at end of file