Graphics.pm 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package Plugins::SqueezeESP32::Graphics;
  2. use strict;
  3. use base qw(Slim::Display::Squeezebox2);
  4. use Slim::Utils::Prefs;
  5. use Slim::Utils::Log;
  6. my $prefs = preferences('plugin.squeezeesp32');
  7. my $VISUALIZER_NONE = 0;
  8. my $width = $prefs->get('width') || 128;
  9. my @modes = (
  10. # mode 0
  11. { desc => ['BLANK'],
  12. bar => 0, secs => 0, width => $width,
  13. params => [$VISUALIZER_NONE] },
  14. # mode 1
  15. { desc => ['PROGRESS_BAR'],
  16. bar => 1, secs => 0, width => $width,
  17. params => [$VISUALIZER_NONE] },
  18. # mode 2
  19. { desc => ['ELAPSED'],
  20. bar => 0, secs => 1, width => $width,
  21. params => [$VISUALIZER_NONE] },
  22. # mode 3
  23. { desc => ['ELAPSED', 'AND', 'PROGRESS_BAR'],
  24. bar => 1, secs => 1, width => $width,
  25. params => [$VISUALIZER_NONE] },
  26. # mode 4
  27. { desc => ['REMAINING'],
  28. bar => 0, secs => -1, width => $width,
  29. params => [$VISUALIZER_NONE] },
  30. # mode 5
  31. { desc => ['CLOCK'],
  32. bar => 0, secs => 0, width => $width, clock => 1,
  33. params => [$VISUALIZER_NONE] },
  34. # mode 6
  35. { desc => ['SETUP_SHOWBUFFERFULLNESS'],
  36. bar => 0, secs => 0, width => $width, fullness => 1,
  37. params => [$VISUALIZER_NONE] },
  38. );
  39. sub modes {
  40. return \@modes;
  41. }
  42. sub nmodes {
  43. return $#modes;
  44. }
  45. # I don't think LMS renderer handles properly screens other than 32 pixels. It
  46. # seems that all we get is a 32 pixel-tall data with anything else padded to 0
  47. # i.e. if we try 64 pixels height, bytes 0..3 and 4..7 will contains the same
  48. # pattern than the 32 pixels version, where one would have expected bytes 4..7
  49. # to be empty
  50. =comment
  51. sub bytesPerColumn {
  52. return 4;
  53. }
  54. =cut
  55. sub displayHeight {
  56. return 32;
  57. }
  58. sub displayWidth {
  59. return shift->widthOverride(@_) || $width;
  60. }
  61. sub vfdmodel {
  62. return 'graphic-'.$width.'x32';
  63. }
  64. 1;