浏览代码

improve display

philippe44 5 年之前
父节点
当前提交
1409e1ccbe
共有 7 个文件被更改,包括 55 次插入5 次删除
  1. 3 2
      components/display/text.c
  2. 1 1
      components/squeezelite/slimproto.c
  3. 37 0
      plugin/Player.pm
  4. 2 2
      plugin/Plugin.pm
  5. 二进制
      plugin/SqueezeESP32.zip
  6. 10 0
      plugin/Text.pm
  7. 2 0
      plugin/strings.txt

+ 3 - 2
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);
 

+ 1 - 1
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) {

+ 37 - 0
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;

+ 2 - 2
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;

二进制
plugin/SqueezeESP32.zip


+ 10 - 0
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;

+ 2 - 0
plugin/strings.txt

@@ -0,0 +1,2 @@
+WELCOME_TO_SQUEEZEESP32
+	EN	Welcome to SqueezeESP32