From 1409e1ccbe70c5dc7dbfbeb4bf8981f5a2205698 Mon Sep 17 00:00:00 2001 From: philippe44 Date: Tue, 7 Jan 2020 19:56:31 -0800 Subject: [PATCH] improve display --- components/display/text.c | 5 ++-- components/squeezelite/slimproto.c | 2 +- plugin/Player.pm | 37 +++++++++++++++++++++++++++++ plugin/Plugin.pm | 4 ++-- plugin/SqueezeESP32.zip | Bin 885 -> 0 bytes plugin/Text.pm | 10 ++++++++ plugin/strings.txt | 2 ++ 7 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 plugin/Player.pm delete mode 100644 plugin/SqueezeESP32.zip create mode 100644 plugin/Text.pm create mode 100644 plugin/strings.txt 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 9dc212e4801df5f11d7581aaa7f261824d0a9363..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 885 zcmWIWW@Zs#U|`^2_!y!daMSz5>E}S+1V#o1ZXlhRS6q^qlcQIWo0B`i-<#P`;OP6N z`-%D7wmDI{9j8sMHh*tz2=AP|kxjk+%=}HiUfwkm+;-t{_2=Y!XPW<}tguY#xOFpj z_seU!!jrdnP1?L8yWU`1bzL>Hh3Xb{jdQCq9Uiuync^~u(=zI(---s^yN4D|oVDZs zl_h(RZ-4vk0hRY3IO3;_kdc_(l5-3-`vu}n$m-|p+BT2kLO ze0#U=_q%=ix{E4gmvR_~E;BNAYPl`+QP}k2>d{N&>;dNU(VA3A08xbMmP7Zc8$3feW}mC%Ra(*j9 zt4Rlnw=SqHzRVP-{qD-7hYTAh&A92cdimG0_Wp-kS$vjgz9?&|{vfFs_wjI%#jc~r zE-!B_*4eScTgc~t_Tq~hPMOZBDsudwocvbqH&cK&Ba=M?u7s)rj2aM70Fx-mmJ2G# z$RNSsbU*%V=h3T-Qh8Cb(}DCN_V