Graphics.pm 1.8 KB

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