Graphics.pm 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. sub brightnessMap {
  51. return (65535, 10, 50, 100, 200);
  52. }
  53. =comment
  54. sub bytesPerColumn {
  55. return 4;
  56. }
  57. =cut
  58. sub displayHeight {
  59. return 32;
  60. }
  61. sub displayWidth {
  62. return shift->widthOverride(@_) || $width;
  63. }
  64. sub vfdmodel {
  65. return 'graphic-'.$width.'x32';
  66. }
  67. 1;