Index: Slim/Player/SqueezeSlave.pm =================================================================== --- Slim/Player/SqueezeSlave.pm (revision 31) +++ Slim/Player/SqueezeSlave.pm (working copy) @@ -1,6 +1,6 @@ package Slim::Player::SqueezeSlave; -# $Id: Squeezebox2.pm 12808 2007-08-31 04:08:54Z andy $ +# $Id: SqueezeSlave.pm 12808 2007-08-31 04:08:54Z andy $ # SqueezeCenter Copyright 2001-2007 Logitech. # This program is free software; you can redistribute it and/or @@ -30,18 +30,19 @@ use Slim::Utils::Misc; use Slim::Utils::Unicode; use Slim::Utils::Prefs; +use Slim::Display::Text; # For text display support my $prefs = preferences('server'); our $defaultPrefs = { 'replayGainMode' => 0, 'minSyncAdjust' => 30, # ms + 'maxBitrate' => 0, }; # Keep track of direct stream redirects our $redirects = {}; - sub new { my $class = shift; @@ -74,7 +75,7 @@ sub modelName { 'Squeezeslave' } -sub hasIR { return 0; } +sub hasIR { return 1; } # in order of preference based on whether we're connected via wired or wireless... sub formats { @@ -130,6 +131,17 @@ } } +sub canDoReplayGain { + my $client = shift; + my $replay_gain = shift; + + if (defined($replay_gain)) { + return $client->dBToFixed($replay_gain); + } + + return 0; +} + sub volume { my $client = shift; my $newvolume = shift; @@ -304,4 +316,27 @@ } +# We need to implement this to allow us to receive SETD commands +# and we need SETD to support custom display widths +sub directBodyFrame { + return 1; +} + +# Allow the player to define it's display width +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); + } + } +} + 1; Index: Slim/Networking/Slimproto.pm =================================================================== --- Slim/Networking/Slimproto.pm (revision 31) +++ Slim/Networking/Slimproto.pm (working copy) @@ -1078,7 +1078,7 @@ } elsif ($deviceids[$deviceid] eq 'squeezeslave') { $client_class = 'Slim::Player::SqueezeSlave'; - $display_class = 'Slim::Display::NoDisplay'; + $display_class = 'Slim::Display::Text'; } elsif ($deviceids[$deviceid] eq 'squeezeplay' || $deviceids[$deviceid] eq 'controller') { Index: Slim/Display/Text.pm =================================================================== --- Slim/Display/Text.pm (revision 34) +++ Slim/Display/Text.pm (working copy) @@ -14,8 +14,8 @@ =head1 DESCRIPTION L - Display code for text (character) based displays: Slimp3, SB1 - - 40 character x 2 lines + Display code for text (character) based displays: Slimp3, SB1, squeezeslave + - 40 (or client controlled) character x 2 lines - server side animation =cut @@ -33,6 +33,8 @@ my $scroll_pad_scroll = 6; # chars of padding between scrolling text my $scroll_pad_ticker = 8; # chars of padding in ticker mode +my $defaultwidth = 40; # default character width of display (unless client tells us otherwise) + our $defaultPrefs = { 'doublesize' => 0, 'offDisplaySize' => 0, @@ -44,34 +46,7 @@ 'playingDisplayModes' => [0..5] }; -# Display Modes -my @modes = ( - # mode 0 - { desc => ['BLANK'], - bar => 0, secs => 0, width => 40, }, - # mode 1 - { desc => ['ELAPSED'], - bar => 0, secs => 1, width => 40, }, - # mode 2 - { desc => ['REMAINING'], - bar => 0, secs => -1, width => 40, }, - # mode 3 - { desc => ['PROGRESS_BAR'], - bar => 1, secs => 0, width => 40, }, - # mode 4 - { desc => ['ELAPSED', 'AND', 'PROGRESS_BAR'], - bar => 1, secs => 1, width => 40, }, - # mode 5 - { desc => ['REMAINING', 'AND', 'PROGRESS_BAR'], - bar => 1, secs => -1, width => 40, }, - # mode 6 - { desc => ['SETUP_SHOWBUFFERFULLNESS'], - bar => 1, secs => 0, width => 40, fullness => 1, }, -); - -my $nmodes = $#modes; - sub initPrefs { my $display = shift; @@ -79,6 +54,7 @@ $prefs->set('loadFontsText', 1); } + $display->widthOverride(1,$defaultwidth); # Set the display width $prefs->client($display->client)->init($defaultPrefs); $display->SUPER::initPrefs(); @@ -101,7 +77,8 @@ } sub displayWidth { - return 40; + my $width = shift->widthOverride(@_); # Get the width + return $width || $defaultwidth; # If not set (huh, we set it above!) return the default. } sub vfdmodel { @@ -109,7 +86,6 @@ my $client = $display->client; if ($client->isa('Slim::Player::SLIMP3')) { - if ($client->revision >= 2.2) { my $mac = $client->macaddress(); if ($mac eq '00:04:20:03:04:e0') { @@ -124,7 +100,8 @@ } else { return 'noritake-katakana'; } - + } elsif ($client->isa('Slim::Player::SqueezeSlave')) { + return 'squeezeslave'; # New vfdmodel for squeezeslave, with different char map } else { # Squeezebox 1 return 'noritake-european'; @@ -184,6 +161,7 @@ my $screen; # screen definition to render my $sc = $cache->{screen1}; # screen cache for this screen + my $newdisplaysize = 0; # Used to force re-render when line length changes if (!exists($parts->{screen1}) && (exists($parts->{line}) || exists($parts->{center}) || exists($parts->{overlay}) || @@ -199,10 +177,15 @@ $sc->{present} = 1; # force initialisation of cache if size = 0 (used to init cache) - if ($sc->{ssize} != 40) { - $sc->{ssize} = 40; + if ($sc->{ssize} != $display->displayWidth) { $sc->{double} = 0; $sc->{changed} = 1; + + # Size has changed + if ($sc->{ssize} >0) { + $newdisplaysize = 1; + } + $sc->{ssize} = $display->displayWidth; } # check display hash for text size definitions @@ -231,13 +214,14 @@ if ($sc->{changed}) { foreach my $l (0..1) { - $sc->{line}[$l] = undef; $sc->{linetext}[$l] = ''; $sc->{linefinish}[$l] = 0; - $sc->{overlay}[$l] = undef; $sc->{overlaytext}[$l] = ''; $sc->{overlaystart}[$l] = 40; - $sc->{center}[$l] = undef; $sc->{centertext}[$l] = ''; + $sc->{line}[$l] = undef if (!$newdisplaysize); $sc->{linetext}[$l] = ''; $sc->{linefinish}[$l] = 0; + $sc->{overlay}[$l] = undef if (!$newdisplaysize); $sc->{overlaytext}[$l] = ''; $sc->{overlaystart}[$l] = $display->displayWidth; + $sc->{center}[$l] = undef if (!$newdisplaysize); $sc->{centertext}[$l] = ''; } $sc->{scroll} = 0; $sc->{scrollline} = undef; } + if (!$scroll) { $sc->{scroll} = 0; $sc->{scrollline} = undef; @@ -251,20 +235,20 @@ # lines - render if changed foreach my $l (0..1) { if (defined($screen->{line}[$l]) && - (!defined($sc->{line}[$l]) || ($screen->{line}[$l] ne $sc->{line}[$l]))) { + ($newdisplaysize || !defined($sc->{line}[$l]) || ($screen->{line}[$l] ne $sc->{line}[$l]))) { $sc->{line}[$l] = $screen->{line}[$l]; next if ($double && $l == 0); if (!$double) { if (Slim::Utils::Unicode::encodingFromString($screen->{line}[$l]) eq 'raw') { # SliMP3 / Pre-G can't handle wide characters outside the latin1 range - turn off the utf8 flag. - $sc->{linetext}[$l] = Slim::Utils::Unicode::utf8off($screen->{line}[$l]); + $sc->{linetext}[$l] = Slim::Utils::Unicode::utf8off($sc->{line}[$l]); } else { - $sc->{linetext}[$l] = $screen->{line}[$l]; + $sc->{linetext}[$l] = $sc->{line}[$l]; } $sc->{linefinish}[$l] = lineLength($sc->{linetext}[$l]); } else { ($sc->{linetext}[0], $sc->{linetext}[1]) = - Slim::Display::Lib::TextVFD::doubleSize($client,$screen->{line}[1]); + Slim::Display::Lib::TextVFD::doubleSize($client,$sc->{line}[1]); $sc->{linefinish}[0] = lineLength($sc->{linetext}[0]); $sc->{linefinish}[1] = lineLength($sc->{linetext}[1]); } @@ -291,24 +275,24 @@ # overlays - render if changed foreach my $l (0..1) { if (defined($screen->{overlay}[$l]) && - (!defined($sc->{overlay}[$l]) || ($screen->{overlay}[$l] ne $sc->{overlay}[$l]))) { + ($newdisplaysize || !defined($sc->{overlay}[$l]) || ($screen->{overlay}[$l] ne $sc->{overlay}[$l]))) { $sc->{overlay}[$l] = $screen->{overlay}[$l]; if (!$double || $displayoverlays) { - $sc->{overlaytext}[$l] = $screen->{overlay}[$l]; + $sc->{overlaytext}[$l] = $sc->{overlay}[$l]; } else { $sc->{overlaytext}[$l] = ''; } - if (lineLength($sc->{overlaytext}[$l]) > 40 ) { - $sc->{overlaytext}[$l] = subString($sc->{overlaytext}[$l], 0, 40); - $sc->{overlaystart}[$l] = 40; + if (lineLength($sc->{overlaytext}[$l]) > $display->displayWidth ) { + $sc->{overlaytext}[$l] = subString($sc->{overlaytext}[$l], 0, $display->displayWidth); + $sc->{overlaystart}[$l] = $display->displayWidth; } else { - $sc->{overlaystart}[$l] = 40 - lineLength($sc->{overlaytext}[$l]); + $sc->{overlaystart}[$l] = $display->displayWidth - lineLength($sc->{overlaytext}[$l]); } $sc->{changed} = 1; } elsif (!defined($screen->{overlay}[$l]) && defined($sc->{overlay}[$l])) { $sc->{overlay}[$l] = undef; $sc->{overlaytext}[$l] = ''; - $sc->{overlaystart}[$l] = 40; + $sc->{overlaystart}[$l] = $display->displayWidth; $sc->{changed} = 1; } } @@ -316,26 +300,26 @@ # centered lines - render if changed foreach my $l (0..1) { if (defined($screen->{center}[$l]) && - (!defined($sc->{center}[$l]) || ($screen->{center}[$l] ne $sc->{center}[$l]))) { + ($newdisplaysize || (!defined($sc->{center}[$l]) || ($screen->{center}[$l] ne $sc->{center}[$l])))) { $sc->{center}[$l] = $screen->{center}[$l]; next if ($double && $l == 0); if (!$double) { my $len = lineLength($sc->{center}[$l]); - if ($len < 39) { - $sc->{centertext}[$l] = ' ' x ((40 - $len)/2) . $screen->{center}[$l] . - ' ' x (40 - $len - int((40 - $len)/2)); + if ($len < $display->displayWidth-1) { + $sc->{centertext}[$l] = ' ' x (($display->displayWidth - $len)/2) . $sc->{center}[$l] . + ' ' x ($display->displayWidth - $len - int(($display->displayWidth - $len)/2)); } else { - $sc->{centertext}[$l] = subString($sc->{center}[$l] . ' ', 0 ,40); + $sc->{centertext}[$l] = subString($sc->{center}[$l] . ' ', 0 ,$display->displayWidth); } } else { - my ($center1, $center2) = Slim::Display::Lib::TextVFD::doubleSize($client,$screen->{center}[1]); + my ($center1, $center2) = Slim::Display::Lib::TextVFD::doubleSize($client,$sc->{center}[1]); my $len = lineLength($center1); - if ($len < 39) { - $sc->{centertext}[0] = ' ' x ((40 - $len)/2) . $center1 . ' ' x (40 - $len - int((40 - $len)/2)); - $sc->{centertext}[1] = ' ' x ((40 - $len)/2) . $center2 . ' ' x (40 - $len - int((40 - $len)/2)); + if ($len < $display->displayWidth-1) { + $sc->{centertext}[0] = ' ' x (($display->displayWidth - $len)/2) . $center1 . ' ' x ($display->displayWidth - $len - int(($display->displayWidth - $len)/2)); + $sc->{centertext}[1] = ' ' x (($display->displayWidth - $len)/2) . $center2 . ' ' x ($display->displayWidth - $len - int(($display->displayWidth - $len)/2)); } else { - $sc->{centertext}[0] = subString($center1 . ' ', 0 ,40); - $sc->{centertext}[1] = subString($center2 . ' ', 0 ,40); + $sc->{centertext}[0] = subString($center1 . ' ', 0 ,$display->displayWidth); + $sc->{centertext}[1] = subString($center2 . ' ', 0 ,$display->displayWidth); } } $sc->{changed} = 1; @@ -401,21 +385,17 @@ # centered text takes precedence $line = subString($sc->{centertext}[$l], 0, $sc->{overlaystart}[$l]). $sc->{overlaytext}[$l]; - } elsif ($sc->{linefinish}[$l] <= $sc->{overlaystart}[$l] ) { # no need to scroll - assemble line + pad + overlay $line = $sc->{linetext}[$l] . ' ' x ($sc->{overlaystart}[$l] - $sc->{linefinish}[$l]) . $sc->{overlaytext}[$l]; - } elsif (!$scroll || ($sc->{scroll} && $sc->{scrollline} != $l) ) { # scrolling not enabled or already scrolling for another line - truncate line $line = subString($sc->{linetext}[$l], 0, $sc->{overlaystart}[$l]) . $sc->{overlaytext}[$l]; - } elsif ($sc->{scroll} && $sc->{scrollline} == $l) { # scrolling already on this line - add overlay only $line = ' ' x $sc->{overlaystart}[$l] . $sc->{overlaytext}[$l]; - } else { # scrolling allowed and not currently scrolling - create scrolling state @@ -426,11 +406,11 @@ $sc->{scrollstart} = 0; if ($scroll == 1) { # normal wrapped text scrolling - $scrolltext .= ' ' x $scroll_pad_scroll . subString($scrolltext, 0, 40); + $scrolltext .= ' ' x $scroll_pad_scroll . subString($scrolltext, 0, $display->displayWidth); $sc->{scrollend} = $sc->{linefinish}[$l] + $scroll_pad_scroll; } else { # don't wrap text - scroll to end only - $sc->{scrollend} = $sc->{linefinish}[$l] - 40; + $sc->{scrollend} = $sc->{linefinish}[$l] - $display->displayWidth; } if (!$double || $l == 0) { @@ -445,7 +425,6 @@ # add overlay only to static bitmap $line = ' ' x $sc->{overlaystart}[$l] . $sc->{overlaytext}[$l]; } - $sc->{lineref}[$l] = \$line; } @@ -472,7 +451,7 @@ my $line2 = $$line2start . $$line2end; $display->killAnimation(); - $display->pushUpdate([\$line1, \$line2, 0, 5, 40, 0.02]); + $display->pushUpdate([\$line1, \$line2, 0, 4, $display->displayWidth, 0.02]); } sub pushRight { @@ -489,7 +468,7 @@ my $line2 = $$line2end . $$line2start; $display->killAnimation(); - $display->pushUpdate([\$line1, \$line2, 40, -5, 0, 0.02]); + $display->pushUpdate([\$line1, \$line2, $display->displayWidth, -4, 0, 0.02]); } sub pushUp { @@ -536,9 +515,12 @@ my ($line1, $line2, $offset, $delta, $end, $deltatime) = @$params; $offset += $delta; + # With custom widths, offset may not be a factor of the width, so fix up to avoid problems! + $offset=$end if ($delta > 0 && $offset > $end); + $offset=$end if ($delta < 0 && $offset < $end); - my $screenline1 = subString($$line1, $offset, 40); - my $screenline2 = subString($$line2, $offset, 40); + my $screenline1 = subString($$line1, $offset, $display->displayWidth); + my $screenline2 = subString($$line2, $offset, $display->displayWidth); Slim::Display::Lib::TextVFD::vfdUpdate($display->client, $screenline1, $screenline2); @@ -556,7 +538,7 @@ my $render = $display->render($display->renderCache()); my $line1 = ${$render->{screen1}->{lineref}[1]}; - my $line2 = ' ' x 40; + my $line2 = ' ' x $display->displayWidth; Slim::Display::Lib::TextVFD::vfdUpdate($display->client, $line1, $line2); @@ -569,7 +551,7 @@ my $display = shift; my $render = $display->render($display->renderCache()); - my $line1 = ' ' x 40; + my $line1 = ' ' x $display->displayWidth; my $line2 = ${$render->{screen1}->{lineref}[0]}; Slim::Display::Lib::TextVFD::vfdUpdate($display->client, $line1, $line2); @@ -598,11 +580,43 @@ } sub modes { - return \@modes; + my $display = shift; + # Display Modes + + my @modes = ( + # mode 0 + { desc => ['BLANK'], + bar => 0, secs => 0, width => $display->displayWidth, }, + # mode 1 + { desc => ['ELAPSED'], + bar => 0, secs => 1, width => $display->displayWidth, }, + # mode 2 + { desc => ['REMAINING'], + bar => 0, secs => -1, width => $display->displayWidth, }, + # mode 3 + { desc => ['PROGRESS_BAR'], + bar => 1, secs => 0, width => $display->displayWidth, }, + # mode 4 + { desc => ['ELAPSED', 'AND', 'PROGRESS_BAR'], + bar => 1, secs => 1, width => $display->displayWidth, }, + # mode 5 + { desc => ['REMAINING', 'AND', 'PROGRESS_BAR'], + bar => 1, secs => -1, width => $display->displayWidth, }, + # mode 6 + { desc => ['SETUP_SHOWBUFFERFULLNESS'], + bar => 1, secs => 0, width => $display->displayWidth, fullness => 1, }, + ); + + return \@modes; } sub nmodes { - return $nmodes; + my $display = shift; + + my @modes = @{$display->modes}; + my $nmodes = $#modes; + warn ("nmodes = $nmodes\n"); + return $nmodes; } sub scrollUpdateDisplay { @@ -637,11 +651,11 @@ } else { # both lines scrolling if ($padlen) { - $line1 = subString(${$scroll->{scrollline1ref}} . $pad, $scroll->{offset}, 40); - $line2 = subString(${$scroll->{scrollline2ref}} . $pad, $scroll->{offset}, 40); + $line1 = subString(${$scroll->{scrollline1ref}} . $pad, $scroll->{offset}, $display->displayWidth); + $line2 = subString(${$scroll->{scrollline2ref}} . $pad, $scroll->{offset}, $display->displayWidth); } else { - $line1 = subString(${$scroll->{scrollline1ref}}, $scroll->{offset}, 40); - $line2 = subString(${$scroll->{scrollline2ref}}, $scroll->{offset}, 40); + $line1 = subString(${$scroll->{scrollline1ref}}, $scroll->{offset}, $display->displayWidth); + $line2 = subString(${$scroll->{scrollline2ref}}, $scroll->{offset}, $display->displayWidth); } } Index: Slim/Display/Lib/TextVFD.pm =================================================================== --- Slim/Display/Lib/TextVFD.pm (revision 34) +++ Slim/Display/Lib/TextVFD.pm (working copy) @@ -66,7 +66,6 @@ my $vfdReset = $vfdCodeCmd . $vfdCommand{"INCSC"} . $vfdCodeCmd . $vfdCommand{"HOME"}; -my $spaces = ' ' x 40; my %symbolmap = ( 'katakana' => { @@ -86,6 +85,13 @@ 'rightarrow' => chr(0x7e), 'hardspace' => chr(0x20), 'solidblock' => chr(0x1f), + }, + 'squeezeslave' => { # These are from an Imon VFD, but squeezeslave can remap for other types + 'rightarrow' => chr(0x10), + 'hardspace' => chr(0x20), + 'solidblock' => chr(0x0B), + 'notesymbol' => chr(0x91), + 'bell' => chr(0x98), } ); @@ -121,6 +127,21 @@ 'Zbottom' => '/', 'leftvbar' => '|', 'rightvbar' => '|', + 'rightprogress0' => ']', + 'rightprogress1' => ']', + 'rightprogress2' => ']', + 'rightprogress3' => ']', + 'rightprogress4' => ']', + 'leftprogress0' => '[', + 'leftprogress1' => '[', + 'leftprogress2' => '[', + 'leftprogress3' => '[', + 'leftprogress4' => '[', + 'middleprogress0' => ' ', + 'middleprogress1' => '.', + 'middleprogress2' => ':', + 'middleprogress3' => '!', + 'middleprogress4' => '|', ); sub vfdUpdate { @@ -133,6 +154,9 @@ my $cur = -1; my $pos; + my $displaywidth = $client->display->displayWidth; # Get display width (replaces originally hard coded values below) + my $spaces = ' ' x $displaywidth; + # convert to the VFD char set my $lang = $client->vfdmodel; if (!$lang) { @@ -224,8 +248,9 @@ foreach my $custom (keys %newCustom) { my $encodedCustom = "\x1F" . $custom . "\x1F"; + my $maxcustom = $lang eq "squeezeslave" ? 0:8; # squeezeslave doesn't allow any custom character definitions - if ($usedCustom < 8) { # Room to add this one + if ($usedCustom < $maxcustom) { # Room to add this one while(defined $customUsed{$nextChr}) { @@ -266,7 +291,6 @@ delete $newCustom{$custom}; } } - if ($lang eq 'european') { # why can't we all just get along? $line =~ tr{\x1f\x92\xa1\xa2\xa3\xa4\xa5\xa6\xa8\xa9\xab\xad\xaf \xbb\xbf \xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf \xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf \xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef \xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff} @@ -275,8 +299,9 @@ # translate iso8859-1 to vfd charset $line =~ tr{\x1f\x92\x0e\x0f\x5c\x70\x7e\x7f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff} {\xff\x27\x19\x7e\x8c\xf0\x8e\x8f\x20\x98\xec\x92\xeb\x5c\x98\x8f\xde\x63\x61\x3c\xa3\x2d\x72\xb0\xdf\xb7\x32\x33\x60\xe4\xf1\x94\x2c\x31\xdf\x3e\x25\x25\x25\x3f\x81\x81\x82\x82\x80\x81\x90\x99\x45\x45\x45\x45\x49\x49\x49\x49\x44\xee\x4f\x4f\x4f\x4f\x86\x78\x30\x55\x55\x55\x8a\x59\x70\xe2\x84\x83\x84\x84\xe1\x84\x91\x99\x65\x65\x65\x65\x69\x69\x69\x69\x95\xee\x6f\x6f\x6f\x6f\xef\xfd\x88\x75\x75\x75\xf5\x79\xf0\x79}; - } elsif ($lang eq 'latin1') { + } elsif (($lang eq 'latin1') || ($lang eq 'squeezeslave')) { # golly, the latin1 character map _is_ latin1. Also, translate funky windows apostrophes to legal ones. + # squeezeslave uses latin1 too $line =~ tr{\x92} {\x26}; }; @@ -287,9 +312,10 @@ my $vfdmodel = $client->vfdmodel(); # force the display out of 4 bit mode if it got there somehow, then set the brightness + # not used for Squeezeslave if ( $vfdmodel =~ 'futaba') { $vfddata .= $vfdCodeCmd . $vfdBrightFutaba[$brightness]; - } else { + } elsif ( ! ($vfdmodel =~ 'squeezeslave')) { $vfddata .= $noritakeBrightPrelude . $vfdBright[$brightness]; } @@ -310,17 +336,17 @@ $line =~ s/(.)/$vfdCodeChar$1/gos; # split the line in two and move the cursor to the second line - $line = substr($line, 0, 80) . $vfdCodeCmd . $vfdCommand{"HOME2"} . substr($line, 80); + $line = substr($line, 0, 2 * $displaywidth) . $vfdCodeCmd . $vfdCommand{"HOME2"} . substr($line, 2 * $displaywidth); $vfddata .= $line; # set the cursor if ($cur >= 0) { - if ($cur < 40) { + if ($cur < $displaywidth) { $vfddata .= $vfdCodeCmd.(pack 'C', (0b10000000 + $cur)); } else { - $vfddata .= $vfdCodeCmd.(pack 'C', (0b11000000 + $cur - 40)); + $vfddata .= $vfdCodeCmd.(pack 'C', (0b11000000 + $cur - $displaywidth)); } # turn on the cursor