Browse Source

Add Multi Unit Support for Max7219 to bugfix_2.0.0 (#11285)

* Add Multi Unit Support for Max7219 to bugfix_2.0.0

* Apply multi-MAX7219 to example configs

* Tweak some spacing, macros
Roxy-3D 7 years ago
parent
commit
9660996cc3
No account linked to committer's email address
51 changed files with 524 additions and 274 deletions
  1. 5
    3
      Marlin/Configuration_adv.h
  2. 5
    3
      Marlin/src/config/default/Configuration_adv.h
  3. 5
    3
      Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
  4. 5
    3
      Marlin/src/config/examples/Anet/A6/Configuration_adv.h
  5. 5
    3
      Marlin/src/config/examples/Anet/A8/Configuration_adv.h
  6. 5
    3
      Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h
  7. 5
    3
      Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
  8. 5
    3
      Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h
  9. 5
    3
      Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
  10. 5
    3
      Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
  11. 5
    3
      Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
  12. 5
    3
      Marlin/src/config/examples/Cartesio/Configuration_adv.h
  13. 5
    3
      Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
  14. 5
    3
      Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h
  15. 5
    3
      Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h
  16. 5
    3
      Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h
  17. 5
    3
      Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h
  18. 5
    3
      Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h
  19. 5
    3
      Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h
  20. 5
    3
      Marlin/src/config/examples/Felix/Configuration_adv.h
  21. 5
    4
      Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
  22. 5
    3
      Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
  23. 5
    3
      Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h
  24. 5
    3
      Marlin/src/config/examples/MakerParts/Configuration_adv.h
  25. 5
    3
      Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
  26. 5
    3
      Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
  27. 5
    3
      Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
  28. 5
    3
      Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
  29. 5
    3
      Marlin/src/config/examples/RigidBot/Configuration_adv.h
  30. 5
    3
      Marlin/src/config/examples/SCARA/Configuration_adv.h
  31. 5
    3
      Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
  32. 5
    3
      Marlin/src/config/examples/TheBorg/Configuration_adv.h
  33. 5
    3
      Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
  34. 5
    3
      Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h
  35. 5
    3
      Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
  36. 5
    3
      Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
  37. 5
    3
      Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
  38. 5
    3
      Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
  39. 5
    3
      Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h
  40. 5
    3
      Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
  41. 5
    3
      Marlin/src/config/examples/delta/generic/Configuration_adv.h
  42. 5
    3
      Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
  43. 5
    3
      Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h
  44. 5
    3
      Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
  45. 5
    3
      Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
  46. 5
    3
      Marlin/src/config/examples/makibox/Configuration_adv.h
  47. 5
    3
      Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
  48. 5
    4
      Marlin/src/config/examples/wt150/Configuration_adv.h
  49. 191
    117
      Marlin/src/feature/Max7219_Debug_LEDs.cpp
  50. 65
    4
      Marlin/src/feature/Max7219_Debug_LEDs.h
  51. 28
    7
      Marlin/src/gcode/feature/leds/M7219.cpp

+ 5
- 3
Marlin/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/default/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Anet/A6/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Anet/A8/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h View File

@@ -1695,9 +1695,11 @@
1695 1695
   #define MAX7219_DIN_PIN   57
1696 1696
   #define MAX7219_LOAD_PIN  44
1697 1697
 
1698
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1699
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1700
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1698
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1699
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1700
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1701
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1702
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1701 1703
 
1702 1704
   /**
1703 1705
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Cartesio/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h View File

@@ -1690,9 +1690,11 @@
1690 1690
   #define MAX7219_DIN_PIN   57
1691 1691
   #define MAX7219_LOAD_PIN  44
1692 1692
 
1693
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1694
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1695
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1693
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1694
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1695
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1696
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1697
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1696 1698
 
1697 1699
   /**
1698 1700
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Felix/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 4
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h View File

@@ -1695,10 +1695,11 @@
1695 1695
 //#define MAX7219_DIN_PIN  P2_13 // for RAMPS E1 on Re-ARM  E1_DIR_PIN     P2_13
1696 1696
 //#define MAX7219_LOAD_PIN P2_08 // for RAMPS E1 on Re-ARM  E1_STEP_PIN    P2_08
1697 1697
 
1698
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1699
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1700
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1701
-
1698
+  #define MAX7219_GCODE            // Add the M7219 G-code to control the LED matrix
1699
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1700
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1701
+  #define MAX7219_ROTATE     -90   // Rotate the display clockwise (in multiples of +/- 90°)
1702
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1702 1703
   /**
1703 1704
    * Sample debug features
1704 1705
    * If you add more debug displays, be careful to avoid conflicts!

+ 5
- 3
Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/MakerParts/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Malyan/M150/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Malyan/M200/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h View File

@@ -1695,9 +1695,11 @@
1695 1695
   #define MAX7219_DIN_PIN   57
1696 1696
   #define MAX7219_LOAD_PIN  44
1697 1697
 
1698
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1699
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1700
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1698
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1699
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1700
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1701
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1702
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1701 1703
 
1702 1704
   /**
1703 1705
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/RigidBot/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/SCARA/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Sanguinololu/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/TheBorg/Configuration_adv.h View File

@@ -1688,9 +1688,11 @@
1688 1688
   #define MAX7219_DIN_PIN   57
1689 1689
   #define MAX7219_LOAD_PIN  44
1690 1690
 
1691
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1692
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1693
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1691
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1692
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1693
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1694
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1695
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1694 1696
 
1695 1697
   /**
1696 1698
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/TinyBoy2/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h View File

@@ -1690,9 +1690,11 @@
1690 1690
   #define MAX7219_DIN_PIN   57
1691 1691
   #define MAX7219_LOAD_PIN  44
1692 1692
 
1693
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1694
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1695
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1693
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1694
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1695
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1696
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1697
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1696 1698
 
1697 1699
   /**
1698 1700
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=18
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -1689,9 +1689,11 @@
1689 1689
   #define MAX7219_DIN_PIN   57
1690 1690
   #define MAX7219_LOAD_PIN  44
1691 1691
 
1692
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1693
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1694
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1692
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1693
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1694
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1695
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1696
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1695 1697
 
1696 1698
   /**
1697 1699
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h View File

@@ -1689,9 +1689,11 @@
1689 1689
   #define MAX7219_DIN_PIN   57
1690 1690
   #define MAX7219_LOAD_PIN  44
1691 1691
 
1692
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1693
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1694
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1692
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1693
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1694
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1695
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1696
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1695 1697
 
1696 1698
   /**
1697 1699
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -1689,9 +1689,11 @@
1689 1689
   #define MAX7219_DIN_PIN   57
1690 1690
   #define MAX7219_LOAD_PIN  44
1691 1691
 
1692
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1693
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1694
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1692
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1693
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1694
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1695
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1696
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1695 1697
 
1696 1698
   /**
1697 1699
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/generic/Configuration_adv.h View File

@@ -1689,9 +1689,11 @@
1689 1689
   #define MAX7219_DIN_PIN   57
1690 1690
   #define MAX7219_LOAD_PIN  44
1691 1691
 
1692
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1693
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1694
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1692
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1693
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1694
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1695
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1696
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1695 1697
 
1696 1698
   /**
1697 1699
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h View File

@@ -1689,9 +1689,11 @@
1689 1689
   #define MAX7219_DIN_PIN   57
1690 1690
   #define MAX7219_LOAD_PIN  44
1691 1691
 
1692
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1693
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1694
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1692
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1693
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1694
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1695
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1696
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1695 1697
 
1696 1698
   /**
1697 1699
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h View File

@@ -1694,9 +1694,11 @@
1694 1694
   #define MAX7219_DIN_PIN   57
1695 1695
   #define MAX7219_LOAD_PIN  44
1696 1696
 
1697
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1698
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1699
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1697
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1698
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1699
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1700
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1701
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1700 1702
 
1701 1703
   /**
1702 1704
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h View File

@@ -1689,9 +1689,11 @@
1689 1689
   #define MAX7219_DIN_PIN   57
1690 1690
   #define MAX7219_LOAD_PIN  44
1691 1691
 
1692
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1693
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1694
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1692
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1693
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1694
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1695
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1696
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1695 1697
 
1696 1698
   /**
1697 1699
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  #define MAX7219_GCODE            // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 2   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE     180   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/makibox/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 3
Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h View File

@@ -1687,9 +1687,11 @@
1687 1687
   #define MAX7219_DIN_PIN   57
1688 1688
   #define MAX7219_LOAD_PIN  44
1689 1689
 
1690
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1691
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1692
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1690
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1691
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1692
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1693
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1694
+                                   // connector at:  right=0   bottom=-90  top=90  left=180
1693 1695
 
1694 1696
   /**
1695 1697
    * Sample debug features

+ 5
- 4
Marlin/src/config/examples/wt150/Configuration_adv.h View File

@@ -1688,10 +1688,11 @@
1688 1688
   #define MAX7219_DIN_PIN   57
1689 1689
   #define MAX7219_LOAD_PIN  44
1690 1690
 
1691
-  //#define MAX7219_GCODE       // Add the M7219 G-code to control the LED matrix
1692
-  #define MAX7219_INIT_TEST     // Do a test pattern at initialization (Set to 2 for spiral)
1693
-  #define MAX7219_ROTATE     0  // Rotate the display clockwise (in multiples of +/- 90°)
1694
-
1691
+  //#define MAX7219_GCODE          // Add the M7219 G-code to control the LED matrix
1692
+  #define MAX7219_INIT_TEST    2   // Do a test pattern at initialization (Set to 2 for spiral)
1693
+  #define MAX7219_NUMBER_UNITS 1   // Number of Max7219 units in chain.
1694
+  #define MAX7219_ROTATE       0   // Rotate the display clockwise (in multiples of +/- 90°)
1695
+                                   // connector at:  right=0   bottom=-90  top=90  left=18
1695 1696
   /**
1696 1697
    * Sample debug features
1697 1698
    * If you add more debug displays, be careful to avoid conflicts!

+ 191
- 117
Marlin/src/feature/Max7219_Debug_LEDs.cpp View File

@@ -48,39 +48,11 @@
48 48
 #include "../Marlin.h"
49 49
 #include "../HAL/Delay.h"
50 50
 
51
-static uint8_t LEDs[8] = { 0 };
51
+uint8_t LEDs[8 * (MAX7219_NUMBER_UNITS)] = { 0 };
52 52
 
53 53
 #ifndef MAX7219_ROTATE
54 54
   #define MAX7219_ROTATE 0
55 55
 #endif
56
-#define _ROT ((MAX7219_ROTATE + 360) % 360)
57
-#if _ROT == 0
58
-  #define _ROW_ y
59
-  #define _COL_ x
60
-  #define XOR_7219(x, y) LEDs[y] ^= _BV(7 - x)
61
-  #define BIT_7219(x, y) TEST(LEDs[y], 7 - x)
62
-  #define SEND_7219(R,V) Max7219(max7219_reg_digit0 + R, V)
63
-#elif _ROT == 90
64
-  #define _ROW_ x
65
-  #define _COL_ y
66
-  #define XOR_7219(x, y) LEDs[x] ^= _BV(y)
67
-  #define BIT_7219(x, y) TEST(LEDs[x], y)
68
-  #define SEND_7219(R,V) Max7219(max7219_reg_digit0 + R, V)
69
-#elif _ROT == 180
70
-  #define _ROW_ y
71
-  #define _COL_ x
72
-  #define XOR_7219(x, y) LEDs[y] ^= _BV(x)
73
-  #define BIT_7219(x, y) TEST(LEDs[y], x)
74
-  #define SEND_7219(R,V) Max7219(max7219_reg_digit7 - R, V)
75
-#elif _ROT == 270
76
-  #define _ROW_ x
77
-  #define _COL_ y
78
-  #define XOR_7219(x, y) LEDs[x] ^= _BV(7 - y)
79
-  #define BIT_7219(x, y) TEST(LEDs[x], 7 - y)
80
-  #define SEND_7219(R,V) Max7219(max7219_reg_digit7 - R, V)
81
-#else
82
-  #error "MAX7219_ROTATE must be a multiple of +/- 90°."
83
-#endif
84 56
 
85 57
 #ifdef CPU_32_BIT
86 58
   // Approximate a 1µs delay on 32-bit ARM
@@ -108,25 +80,24 @@ void Max7219_PutByte(uint8_t data) {
108 80
     CRITICAL_SECTION_END;
109 81
   #endif
110 82
 }
83
+void Max7219_pulse_load() {
84
+  SIG_DELAY();
85
+  WRITE(MAX7219_LOAD_PIN, LOW);  // tell the chip to load the data
86
+  SIG_DELAY();
87
+  WRITE(MAX7219_LOAD_PIN, HIGH);
88
+  SIG_DELAY();
89
+}
111 90
 
112 91
 void Max7219(const uint8_t reg, const uint8_t data) {
113 92
   SIG_DELAY();
114 93
   #ifndef CPU_32_BIT
115 94
     CRITICAL_SECTION_START;
116 95
   #endif
117
-  WRITE(MAX7219_LOAD_PIN, LOW);  // begin
118 96
   SIG_DELAY();
119 97
   Max7219_PutByte(reg);          // specify register
120 98
   SIG_DELAY();
121 99
   Max7219_PutByte(data);         // put data
122
-  SIG_DELAY();
123
-  WRITE(MAX7219_LOAD_PIN, LOW);  // and tell the chip to load the data
124
-  SIG_DELAY();
125
-  WRITE(MAX7219_LOAD_PIN, HIGH);
126
-  #ifndef CPU_32_BIT
127 100
     CRITICAL_SECTION_END;
128
-  #endif
129
-  SIG_DELAY();
130 101
 }
131 102
 
132 103
 #if ENABLED(MAX7219_NUMERIC)
@@ -145,6 +116,7 @@ void Max7219(const uint8_t reg, const uint8_t data) {
145 116
         max7219_reg_digit0 + start + size,
146 117
         minus ? led_minus : blank ? 0x00 : led_numeral[value % 10] | (dec ? led_decimal : 0x00)
147 118
       );
119
+      Max7219_pulse_load();  // tell the chips to load the clocked out data
148 120
       value /= 10;
149 121
       if (!value && !leadzero) blank = true;
150 122
       dec = false;
@@ -176,125 +148,213 @@ inline void Max7219_Error(const char * const func, const int32_t v1, const int32
176 148
   #endif
177 149
 }
178 150
 
179
-inline uint8_t flipped(const uint8_t bits) {
180
-  uint8_t outbits = 0;
181
-  for (uint8_t b = 0; b < 8; b++)
182
-    if (bits & _BV(b)) outbits |= _BV(7 - b);
151
+/**
152
+ * uint32_t flipped(const uint32_t bits, const uint8_t n_bytes) operates on the number
153
+ * of bytes specified in n_bytes.  The lower order bits of the supplied bits are flipped.
154
+ * flipped( x, 1) flips the low 8  bits of x.
155
+ * flipped( x, 2) flips the low 16 bits of x.
156
+ * flipped( x, 3) flips the low 24 bits of x.
157
+ * flipped( x, 4) flips the low 32 bits of x.
158
+ */
159
+
160
+inline uint32_t flipped(const uint32_t bits, const uint8_t n_bytes) {
161
+  uint32_t mask = 1, outbits = 0;
162
+  for (uint8_t b = 0; b < n_bytes * 8; b++) {
163
+    outbits = (outbits << 1);
164
+    if (bits & mask)
165
+      outbits |= 1;
166
+    mask = mask << 1;
167
+  }
183 168
   return outbits;
184 169
 }
185 170
 
186 171
 // Modify a single LED bit and send the changed line
187 172
 void Max7219_LED_Set(const uint8_t x, const uint8_t y, const bool on) {
188
-  if (x > 7 || y > 7) return Max7219_Error(PSTR("Max7219_LED_Set"), x, y);
173
+  if (x > (MAX7219_X_LEDS - 1) || y > (MAX7219_Y_LEDS - 1)) return Max7219_Error(PSTR("Max7219_LED_Set"), x, y);
189 174
   if (BIT_7219(x, y) == on) return;
190 175
   XOR_7219(x, y);
191
-  SEND_7219(_ROW_, LEDs[_ROW_]);
176
+  SEND_7219(MAX7219_UPDATE_AXIS);
192 177
 }
193 178
 
194 179
 void Max7219_LED_On(const uint8_t x, const uint8_t y) {
195
-  if (x > 7 || y > 7) return Max7219_Error(PSTR("Max7219_LED_On"), x, y);
180
+  if (x > (MAX7219_X_LEDS - 1) || y > (MAX7219_Y_LEDS - 1)) return Max7219_Error(PSTR("Max7219_LED_On"), x, y);
196 181
   Max7219_LED_Set(x, y, true);
197 182
 }
198 183
 
199 184
 void Max7219_LED_Off(const uint8_t x, const uint8_t y) {
200
-  if (x > 7 || y > 7) return Max7219_Error(PSTR("Max7219_LED_Off"), x, y);
185
+  if (x > (MAX7219_X_LEDS - 1) || y > (MAX7219_Y_LEDS - 1)) return Max7219_Error(PSTR("Max7219_LED_Off"), x, y);
201 186
   Max7219_LED_Set(x, y, false);
202 187
 }
203 188
 
204 189
 void Max7219_LED_Toggle(const uint8_t x, const uint8_t y) {
205
-  if (x > 7 || y > 7) return Max7219_Error(PSTR("Max7219_LED_Toggle"), x, y);
190
+  if (x > (MAX7219_X_LEDS - 1) || y > (MAX7219_Y_LEDS - 1)) return Max7219_Error(PSTR("Max7219_LED_Toggle"), x, y);
206 191
   Max7219_LED_Set(x, y, !BIT_7219(x, y));
207 192
 }
208 193
 
209
-inline void _Max7219_Set_Reg(const uint8_t reg, const uint8_t val) {
210
-  LEDs[reg] = val;
211
-  SEND_7219(reg, val);
194
+inline void _Max7219_Set_Digit_Segments(const uint8_t digit, const uint8_t val) {
195
+  LEDs[digit] = val;
196
+  SEND_7219(digit);
212 197
 }
213 198
 
214
-void Max7219_Set_Row(const uint8_t _ROW_, const uint8_t val) {
215
-  if (_ROW_ > 7) return Max7219_Error(PSTR("Max7219_Set_Row"), _ROW_);
216
-  #if _ROT == 90
217
-    for (uint8_t _COL_ = 0; _COL_ <= 7; _COL_++) Max7219_LED_Set(7 - _COL_, _ROW_, TEST(val, _COL_));
218
-  #elif _ROT == 180
219
-    _Max7219_Set_Reg(_ROW_, flipped(val));
220
-  #elif _ROT == 270
221
-    for (uint8_t _COL_ = 0; _COL_ <= 7; _COL_++) Max7219_LED_Set(_COL_, _ROW_, TEST(val, _COL_));
199
+/**
200
+ * void Max7219_Set_Row( const uint8_t col, const uint32_t val) plots the low order bits of
201
+ * val to the specified row of the Max7219 matrix.  With 4 Max7219 units in the chain, it
202
+ * is possible to display an entire 32-bit number with one call to the function (if appropriately
203
+ * orientated).
204
+ */
205
+void Max7219_Set_Row(const uint8_t row, const uint32_t val) {
206
+  if (row >= MAX7219_Y_LEDS) return Max7219_Error(PSTR("Max7219_Set_Row"), row);
207
+  uint32_t mask = 0x0000001;
208
+  for (uint8_t x = 0; x < MAX7219_X_LEDS; x++) {
209
+    if (val & mask)
210
+      SET_PIXEL_7219((MAX7219_X_LEDS-1-x), row);
211
+    else
212
+      CLEAR_PIXEL_7219((MAX7219_X_LEDS-1-x), row);
213
+    mask = mask << 1;
214
+  }
215
+
216
+  #if _ROT == 90 || _ROT == 270
217
+    for (uint8_t x = 0; x < 8; x++)
218
+      SEND_7219(x); // force all columns out to the Max7219 chips and strobe them
222 219
   #else
223
-    _Max7219_Set_Reg(_ROW_, val);
220
+    SEND_7219(row); // force the single column out to the Max7219 chips and strobe them
224 221
   #endif
225 222
 }
226 223
 
227
-void Max7219_Clear_Row(const uint8_t _ROW_) {
228
-  if (_ROW_ > 7) return Max7219_Error(PSTR("Max7219_Clear_Row"), _ROW_);
224
+void Max7219_Clear_Row(const uint8_t row) {
225
+  if (row > 7) return Max7219_Error(PSTR("Max7219_Clear_Row"), row);
229 226
   #if _ROT == 90 || _ROT == 270
230
-    for (uint8_t _COL_ = 0; _COL_ <= 7; _COL_++) Max7219_LED_Off(_COL_, _ROW_);
227
+    for (uint8_t col = 0; col < 8; col++) Max7219_LED_Off(col, row);
231 228
   #else
232
-    _Max7219_Set_Reg(_ROW_, 0);
229
+    _Max7219_Set_Digit_Segments(row, 0);
233 230
   #endif
234 231
 }
235 232
 
236
-void Max7219_Set_Column(const uint8_t _COL_, const uint8_t val) {
237
-  if (_COL_ > 7) return Max7219_Error(PSTR("Max7219_Set_Column"), _COL_);
238
-  #if _ROT == 90
239
-    _Max7219_Set_Reg(_COL_, val);
240
-  #elif _ROT == 180
241
-    for (uint8_t _ROW_ = 0; _ROW_ <= 7; _ROW_++) Max7219_LED_Set(_COL_, _ROW_, TEST(val, _ROW_));
242
-  #elif _ROT == 270
243
-    _Max7219_Set_Reg(_COL_, flipped(val));
233
+/**
234
+ * void Max7219_Set_Column( const uint8_t col, const uint32_t val) plots the low order bits of
235
+ * val to the specified column of the Max7219 matrix.  With 4 Max7219 units in the chain, it
236
+ * is possible to display an entire 32-bit number with one call to the function (if appropriately
237
+ * orientated).
238
+ */
239
+void Max7219_Set_Column(const uint8_t col, const uint32_t val) {
240
+  if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Set_Column"), col);
241
+  uint32_t mask = 0x0000001;
242
+  for (uint8_t y = 0; y < MAX7219_Y_LEDS; y++) {
243
+    if (val & mask)
244
+      SET_PIXEL_7219(col, MAX7219_Y_LEDS-1-y);
245
+    else
246
+      CLEAR_PIXEL_7219(col, MAX7219_Y_LEDS-1-y);
247
+    mask = mask << 1;
248
+  }
249
+  #if _ROT == 90 || _ROT == 270
250
+    SEND_7219(col); // force the column out to the Max7219 chips and strobe them
244 251
   #else
245
-    for (uint8_t _ROW_ = 0; _ROW_ <= 7; _ROW_++) Max7219_LED_Set(_COL_, _ROW_, TEST(val, _ROW_));
252
+    for (uint8_t yy = 0; yy < 8; yy++)
253
+      SEND_7219(yy); // force all columns out to the Max7219 chips and strobe them
246 254
   #endif
247 255
 }
248 256
 
249
-void Max7219_Clear_Column(const uint8_t _COL_) {
250
-  if (_COL_ > 7) return Max7219_Error(PSTR("Max7219_Clear_Column"), _COL_);
257
+void Max7219_Clear_Column(const uint8_t col) {
258
+  if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Clear_Column"), col);
259
+
260
+  for (uint8_t yy = 0; yy < MAX7219_Y_LEDS; yy++)
261
+    CLEAR_PIXEL_7219(col, yy);
262
+
251 263
   #if _ROT == 90 || _ROT == 270
252
-    _Max7219_Set_Reg(_COL_, 0);
264
+    SEND_7219(col); // force the column out to the Max7219 chips and strobe them
253 265
   #else
254
-    for (uint8_t _ROW_ = 0; _ROW_ <= 7; _ROW_++) Max7219_LED_Off(_COL_, _ROW_);
266
+    for (uint8_t y = 0; y < 8; y++)
267
+      SEND_7219(y); // force all columns out to the Max7219 chips and strobe them
255 268
   #endif
256 269
 }
257 270
 
258 271
 void Max7219_Clear() {
259
-  for (uint8_t r = 0; r < 8; r++) _Max7219_Set_Reg(r, 0);
272
+  for (uint8_t i = 0; i <= 7; i++) {                  // Clear LED bitmap
273
+    for (uint8_t j = 0; j < MAX7219_NUMBER_UNITS; j++)
274
+      LEDs[i + j * 8] = 0x00;
275
+    SEND_7219(i);
276
+  }
277
+
260 278
 }
261 279
 
262
-void Max7219_Set_2_Rows(const uint8_t y, uint16_t val) {
263
-  if (y > 6) return Max7219_Error(PSTR("Max7219_Set_2_Rows"), y, val);
264
-  Max7219_Set_Row(y + 0, val & 0xFF); val >>= 8;
265
-  Max7219_Set_Row(y + 1, val & 0xFF);
280
+void Max7219_Set_Rows_16bits(const uint8_t y, uint32_t val) {
281
+  #if MAX7219_X_LEDS == 8
282
+    if (y > MAX7219_Y_LEDS - 2) return Max7219_Error(PSTR("Max7219_Set_Rows_16bits"), y, val);
283
+    Max7219_Set_Row(y + 1, val); val >>= 8;
284
+    Max7219_Set_Row(y + 0, val);
285
+  #else // at least 16 bits on each row
286
+    if (y > MAX7219_Y_LEDS - 1) return Max7219_Error(PSTR("Max7219_Set_Rows_16bits"), y, val);
287
+    Max7219_Set_Row(y, val);
288
+  #endif
266 289
 }
267 290
 
268
-void Max7219_Set_4_Rows(const uint8_t y, uint32_t val) {
269
-  if (y > 4) return Max7219_Error(PSTR("Max7219_Set_4_Rows"), y, val);
270
-  Max7219_Set_Row(y + 0, val & 0xFF); val >>= 8;
271
-  Max7219_Set_Row(y + 1, val & 0xFF); val >>= 8;
272
-  Max7219_Set_Row(y + 2, val & 0xFF); val >>= 8;
273
-  Max7219_Set_Row(y + 3, val & 0xFF);
291
+void Max7219_Set_Rows_32bits(const uint8_t y, uint32_t val) {
292
+  #if MAX7219_X_LEDS == 8
293
+    if (y > MAX7219_Y_LEDS - 4) return Max7219_Error(PSTR("Max7219_Set_Rows_32bits"), y, val);
294
+    Max7219_Set_Row(y + 3, val); val >>= 8;
295
+    Max7219_Set_Row(y + 2, val); val >>= 8;
296
+    Max7219_Set_Row(y + 1, val); val >>= 8;
297
+    Max7219_Set_Row(y + 0, val);
298
+  #elif MAX7219_X_LEDS == 16
299
+    if (y > MAX7219_Y_LEDS - 2) return Max7219_Error(PSTR("Max7219_Set_Rows_32bits"), y, val);
300
+    Max7219_Set_Row(y + 1, val); val >>= 16;
301
+    Max7219_Set_Row(y + 0, val);
302
+  #else // at least 24 bits on each row.  In the 3 matrix case, just display the low 24 bits
303
+    if (y > MAX7219_Y_LEDS - 1) return Max7219_Error(PSTR("Max7219_Set_Rows_32bits"), y, val);
304
+    Max7219_Set_Row(y, val);
305
+  #endif
274 306
 }
275 307
 
276
-void Max7219_Set_2_Columns(const uint8_t x, uint16_t val) {
277
-  if (x > 6) return Max7219_Error(PSTR("Max7219_Set_2_Columns"), x, val);
278
-  Max7219_Set_Column(x + 0, val & 0xFF); val >>= 8;
279
-  Max7219_Set_Column(x + 1, val & 0xFF);
308
+void Max7219_Set_Columns_16bits(const uint8_t x, uint32_t val) {
309
+  #if MAX7219_Y_LEDS == 8
310
+    if (x > MAX7219_X_LEDS - 2) return Max7219_Error(PSTR("Max7219_Set_Columns_16bits"), x, val);
311
+    Max7219_Set_Column(x + 0, val); val >>= 8;
312
+    Max7219_Set_Column(x + 1, val);
313
+  #else // at least 16 bits in each column
314
+    if (x > MAX7219_X_LEDS - 1) return Max7219_Error(PSTR("Max7219_Set_Columns_16bits"), x, val);
315
+    Max7219_Set_Column(x, val);
316
+  #endif
280 317
 }
281 318
 
282
-void Max7219_Set_4_Columns(const uint8_t x, uint32_t val) {
283
-  if (x > 4) return Max7219_Error(PSTR("Max7219_Set_4_Columns"), x, val);
284
-  Max7219_Set_Column(x + 0, val & 0xFF); val >>= 8;
285
-  Max7219_Set_Column(x + 1, val & 0xFF); val >>= 8;
286
-  Max7219_Set_Column(x + 2, val & 0xFF); val >>= 8;
287
-  Max7219_Set_Column(x + 3, val & 0xFF);
319
+void Max7219_Set_Columns_32bits(const uint8_t x, uint32_t val) {
320
+  #if MAX7219_Y_LEDS == 8
321
+    if (x > MAX7219_X_LEDS - 4) return Max7219_Error(PSTR("Max7219_Set_Rows_32bits"), x, val);
322
+    Max7219_Set_Column(x + 3, val); val >>= 8;
323
+    Max7219_Set_Column(x + 2, val); val >>= 8;
324
+    Max7219_Set_Column(x + 1, val); val >>= 8;
325
+    Max7219_Set_Column(x + 0, val);
326
+  #elif MAX7219_Y_LEDS == 16
327
+    if (x > MAX7219_X_LEDS - 2) return Max7219_Error(PSTR("Max7219_Set_Rows_32bits"), x, val);
328
+    Max7219_Set_Column(x + 1, val); val >>= 16;
329
+    Max7219_Set_Column(x + 0, val);
330
+  #else // at least 24 bits on each row.  In the 3 matrix case, just display the low 24 bits
331
+    if (x > MAX7219_X_LEDS - 1) return Max7219_Error(PSTR("Max7219_Set_Rows_32bits"), x, val);
332
+    Max7219_Set_Column(x, val);
333
+  #endif
288 334
 }
289 335
 
290 336
 void Max7219_register_setup() {
291 337
   // Initialize the Max7219
292
-  Max7219(max7219_reg_scanLimit, 0x07);
293
-  Max7219(max7219_reg_decodeMode, 0x00);       // using an led matrix (not digits)
294
-  Max7219(max7219_reg_shutdown, 0x01);         // not in shutdown mode
295
-  Max7219(max7219_reg_displayTest, 0x00);      // no display test
296
-  Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set
338
+  for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
339
+    Max7219(max7219_reg_scanLimit, 0x07);
340
+  Max7219_pulse_load();                        // tell the chips to load the clocked out data
341
+
342
+  for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
343
+    Max7219(max7219_reg_decodeMode, 0x00);     // using an led matrix (not digits)
344
+  Max7219_pulse_load();                        // tell the chips to load the clocked out data
345
+
346
+  for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
347
+    Max7219(max7219_reg_shutdown, 0x01);       // not in shutdown mode
348
+  Max7219_pulse_load();                        // tell the chips to load the clocked out data
349
+
350
+  for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
351
+    Max7219(max7219_reg_displayTest, 0x00);    // no display test
352
+  Max7219_pulse_load();                        // tell the chips to load the clocked out data
353
+
354
+  for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
355
+    Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set
297 356
                                                // range: 0x00 to 0x0F
357
+  Max7219_pulse_load();                        // tell the chips to load the clocked out data
298 358
 }
299 359
 
300 360
 #ifdef MAX7219_INIT_TEST
@@ -303,24 +363,21 @@ void Max7219_register_setup() {
303 363
   inline void Max7219_spiral(const bool on, const uint16_t del) {
304 364
     constexpr int8_t way[] = { 1, 0, 0, 1, -1, 0, 0, -1 };
305 365
     int8_t px = 0, py = 0, dir = 0;
306
-    for (uint8_t i = 64; i--;) {
366
+    for (uint8_t i = MAX7219_X_LEDS * MAX7219_Y_LEDS; i--;) {
307 367
       Max7219_LED_Set(px, py, on);
308 368
       delay(del);
309 369
       const int8_t x = px + way[dir], y = py + way[dir + 1];
310
-      if (!WITHIN(x, 0, 7) || !WITHIN(y, 0, 7) || BIT_7219(x, y) == on) dir = (dir + 2) & 0x7;
370
+      if (!WITHIN(x, 0, MAX7219_X_LEDS-1) || !WITHIN(y, 0, MAX7219_Y_LEDS-1) || BIT_7219(x, y) == on) dir = (dir + 2) & 0x7;
311 371
       px += way[dir]; py += way[dir + 1];
312 372
     }
313 373
   }
314 374
 
315 375
 #else
316 376
 
317
-  inline void Max7219_colset(const uint8_t x, const bool on) {
318
-    for (uint8_t y = 0; y <= 7; y++) Max7219_LED_Set(x, y, on);
319
-  }
320 377
   inline void Max7219_sweep(const int8_t dir, const uint16_t ms, const bool on) {
321
-    uint8_t x = dir > 0 ? 0 : 7;
322
-    for (uint8_t i = 8; i--; x += dir) {
323
-      Max7219_Set_Column(x, on ? 0xFF : 0x00);
378
+    uint8_t x = dir > 0 ? 0 : MAX7219_X_LEDS-1;
379
+    for (uint8_t i = MAX7219_X_LEDS; i--; x += dir) {
380
+      Max7219_Set_Column(x, on ? 0xFFFFFFFF : 0x00000000);
324 381
       delay(ms);
325 382
     }
326 383
   }
@@ -339,6 +396,7 @@ void Max7219_init() {
339 396
   for (uint8_t i = 0; i <= 7; i++) {      // Empty registers to turn all LEDs off
340 397
     LEDs[i] = 0x00;
341 398
     Max7219(max7219_reg_digit0 + i, 0);
399
+    Max7219_pulse_load();                 // tell the chips to load the clocked out data
342 400
   }
343 401
 
344 402
   #ifdef MAX7219_INIT_TEST
@@ -366,22 +424,38 @@ void Max7219_init() {
366 424
 
367 425
 // Apply changes to update a marker
368 426
 inline void Max7219_Mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) {
369
-  Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8));
370
-   Max7219_LED_On(v2 & 0x7, y + (v2 >= 8));
427
+  #if MAX7219_X_LEDS == 8
428
+    Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8));
429
+     Max7219_LED_On(v2 & 0x7, y + (v2 >= 8));
430
+  #else   // LED matrix has at least 16 LED's on the X-Axis.  Use single line of LED's
431
+    Max7219_LED_Off(v1 & 0xF, y);
432
+     Max7219_LED_On(v2 & 0xF, y);
433
+  #endif
371 434
 }
372 435
 
373 436
 // Apply changes to update a tail-to-head range
374 437
 inline void Max7219_Range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh) {
375
-  if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
376
-    Max7219_LED_Off(n & 0x7, y + (n >= 8));
377
-  if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
378
-     Max7219_LED_On(n & 0x7, y + (n >= 8));
438
+  #if MAX7219_X_LEDS == 8
439
+    if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
440
+      Max7219_LED_Off(n & 0x7, y + (n >= 8));
441
+    if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
442
+       Max7219_LED_On(n & 0x7, y + (n >= 8));
443
+  #else   // LED matrix has at least 16 LED's on the X-Axis.  Use single line of LED's
444
+    if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
445
+      Max7219_LED_Off(n & 0xF, y);
446
+    if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
447
+       Max7219_LED_On(n & 0xF, y);
448
+ #endif
379 449
 }
380 450
 
381 451
 // Apply changes to update a quantity
382 452
 inline void Max7219_Quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv) {
383 453
   for (uint8_t i = MIN(nv, ov); i < MAX(nv, ov); i++)
384
-    Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov);
454
+    #if MAX7219_X_LEDS == 8
455
+      Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix.  Use two lines to get 16 LED's
456
+    #else
457
+      Max7219_LED_Set(i, y, nv >= ov);                // LED matrix has at least 16 LED's on the X-Axis.  Use single line of LED's
458
+    #endif
385 459
 }
386 460
 
387 461
 void Max7219_idle_tasks() {
@@ -424,7 +498,7 @@ void Max7219_idle_tasks() {
424 498
 
425 499
   #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE)
426 500
     if (do_blink) {
427
-      Max7219_LED_Toggle(7, 7);
501
+      Max7219_LED_Toggle(MAX7219_X_LEDS - 1, MAX7219_Y_LEDS - 1);
428 502
       next_blink = ms + 1000;
429 503
     }
430 504
   #endif

+ 65
- 4
Marlin/src/feature/Max7219_Debug_LEDs.h View File

@@ -33,6 +33,12 @@
33 33
  *
34 34
  * Max7219_init() is called automatically at startup, and then there are a number of
35 35
  * support functions available to control the LEDs in the 8x8 grid.
36
+ *
37
+ * If you are using the Max7219 matrix for firmware debug purposes in time sensitive
38
+ * areas of the code, please be aware that the orientation (rotation) of the display can 
39
+ * affect the speed.   The Max7219 can update a single column fairly fast.  It is much
40
+ * faster to do a Max7219_Set_Column() with a rotation of 90 or 270 degrees than to do
41
+ * a Max7219_Set_Row().    The opposite is true for rotations of 0 or 180 degrees.
36 42
  */
37 43
 
38 44
 #ifndef __MAX7219_DEBUG_LEDS_H__
@@ -59,6 +65,7 @@
59 65
 
60 66
 void Max7219_init();
61 67
 void Max7219_PutByte(uint8_t data);
68
+void Max7219_pulse_load();
62 69
 
63 70
 // Set a single register (e.g., a whole native row)
64 71
 void Max7219(const uint8_t reg, const uint8_t data);
@@ -69,18 +76,72 @@ void Max7219_LED_On(const uint8_t x, const uint8_t y);
69 76
 void Max7219_LED_Off(const uint8_t x, const uint8_t y);
70 77
 void Max7219_LED_Toggle(const uint8_t x, const uint8_t y);
71 78
 
72
-// Set all 8 LEDs in a single column
73
-void Max7219_Set_Column(const uint8_t col, const uint8_t val);
79
+// Set all LEDs in a single column
80
+void Max7219_Set_Column(const uint8_t col, const uint32_t val);
74 81
 void Max7219_Clear_Column(const uint8_t col);
75 82
 
76
-// Set all 8 LEDs in a single row
77
-void Max7219_Set_Row(const uint8_t row, const uint8_t val);
83
+// Set all LEDs in a single row
84
+void Max7219_Set_Row(const uint8_t row, const uint32_t val);
78 85
 void Max7219_Clear_Row(const uint8_t row);
79 86
 
87
+// 16 and 32 bit versions of Row and Column functions
88
+// Multiple rows and columns will be used to display the value if
89
+// the array of matrix LED's is too narrow to accomplish the goal
90
+void Max7219_Set_Rows_16bits(const uint8_t y, uint32_t val);
91
+void Max7219_Set_Rows_32bits(const uint8_t y, uint32_t val);
92
+void Max7219_Set_Columns_16bits(const uint8_t x, uint32_t val);
93
+void Max7219_Set_Columns_32bits(const uint8_t x, uint32_t val);
94
+
80 95
 // Quickly clear the whole matrix
81 96
 void Max7219_Clear();
82 97
 
83 98
 // Apply custom code to update the matrix
84 99
 void Max7219_idle_tasks();
85 100
 
101
+#ifndef MAX7219_ROTATE
102
+  #define MAX7219_ROTATE 0
103
+#endif
104
+#define _ROT ((MAX7219_ROTATE + 360) % 360)
105
+#if _ROT == 0
106
+  #define MAX7219_UPDATE_AXIS     y   // Fast line update axis for this orientation of the matrix display
107
+  #define MAX7219_Y_LEDS          8
108
+  #define MAX7219_X_LEDS          (MAX7219_Y_LEDS * (MAX7219_NUMBER_UNITS))
109
+  #define XOR_7219(x, y)          LEDs[(x & 0xF8) + y] ^= _BV(7 - (x & 0x07))
110
+  #define SET_PIXEL_7219(x, y)    LEDs[(x & 0xF8) + y] |= _BV(7 - (x & 0x07)) 
111
+  #define CLEAR_PIXEL_7219(x, y)  LEDs[(x & 0xF8) + y] &= (_BV(7 - (x & 0x07)) ^ 0xFF)
112
+  #define BIT_7219(x, y)          TEST(LEDs[(x & 0xF8) + y], 7 - (x & 0x07))
113
+  #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0);
114
+#elif _ROT == 90
115
+  #define MAX7219_UPDATE_AXIS     x   // Fast line update axis for this orientation of the matrix display
116
+  #define MAX7219_X_LEDS          8
117
+  #define MAX7219_Y_LEDS          (MAX7219_X_LEDS * (MAX7219_NUMBER_UNITS))
118
+  #define XOR_7219(x, y)          LEDs[x + ((MAX7219_Y_LEDS - 1 - y) & 0xF8)] ^= _BV((y & 0x7))
119
+  #define SET_PIXEL_7219(x, y)    LEDs[x + ((MAX7219_Y_LEDS - 1 - y) & 0xF8)] |= _BV((y & 0x7))
120
+  #define CLEAR_PIXEL_7219(x, y)  LEDs[x + ((MAX7219_Y_LEDS - 1 - y) & 0xF8)] &= (_BV((y & 0x7)) ^ 0xFF)
121
+  #define BIT_7219(x, y)          TEST(LEDs[x + ((MAX7219_Y_LEDS - 1 - y) & 0xF8)], (y & 0x7))
122
+  #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0);
123
+#elif _ROT == 180
124
+  #define MAX7219_UPDATE_AXIS     y   // Fast line update axis for this orientation of the matrix display
125
+  #define MAX7219_Y_LEDS          8
126
+  #define MAX7219_X_LEDS          (MAX7219_Y_LEDS * (MAX7219_NUMBER_UNITS))
127
+  #define XOR_7219(x, y)          LEDs[y + (MAX7219_X_LEDS - 1 - (x)) & 0xF8] ^= _BV((x & 0x07))
128
+  #define SET_PIXEL_7219(x, y)    LEDs[y + (MAX7219_X_LEDS - 1 - (x)) & 0xF8] |= _BV((x & 0x07)) 
129
+  #define CLEAR_PIXEL_7219(x, y)  LEDs[y + (MAX7219_X_LEDS - 1 - (x)) & 0xF8] &= (_BV((x & 0x07)) ^ 0xFF)
130
+  #define BIT_7219(x, y)          TEST(LEDs[y + (MAX7219_X_LEDS - 1 - (x)) & 0xF8], ((x & 0x07)))
131
+  #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0);
132
+#elif _ROT == 270
133
+  #define MAX7219_UPDATE_AXIS     x   // Fast line update axis for this orientation of the matrix display
134
+  #define MAX7219_X_LEDS          8
135
+  #define MAX7219_Y_LEDS          (MAX7219_X_LEDS * (MAX7219_NUMBER_UNITS))
136
+  #define XOR_7219(x, y)          LEDs[x + (y & 0xF8] ^= _BV(7 - (y & 0x7))
137
+  #define SET_PIXEL_7219(x, y)    LEDs[x + (y & 0xF8] |= _BV(7 - (y & 0x7))
138
+  #define CLEAR_PIXEL_7219(x, y)  LEDs[x + (y & 0xF8] &= (_BV(7 - (y & 0x7)) ^ 0xFF)
139
+  #define BIT_7219(x, y)          TEST(LEDs[x + (y & 0xF8)], 7 - (y & 0x7))
140
+  #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0);
141
+#else
142
+  #error "MAX7219_ROTATE must be a multiple of +/- 90°."
143
+#endif
144
+
145
+extern uint8_t LEDs[8*MAX7219_NUMBER_UNITS];
146
+
86 147
 #endif // __MAX7219_DEBUG_LEDS_H__

+ 28
- 7
Marlin/src/gcode/feature/leds/M7219.cpp View File

@@ -31,30 +31,51 @@
31 31
  * M7219: Control the Max7219 LED matrix
32 32
  * 
33 33
  *  I         - Initialize (clear) the matrix
34
+ *  F         - Fill the matrix (set all bits)
35
+ *  P         - Dump the LEDs[] array values
34 36
  *  C<column> - Set a column to the 8-bit value V
35 37
  *  R<row>    - Set a row to the 8-bit value V
36 38
  *  X<pos>    - X position of an LED to set or toggle
37 39
  *  Y<pos>    - Y position of an LED to set or toggle
38
- *  V<value>  - The 8-bit value or on/off state to set
40
+ *  V<value>  - The potentially 32-bit value or on/off state to set
41
+ *              (for example: a chain of 4 Max7219 devices can have 32 bit 
42
+ *               rows or columns depending upon rotation)
39 43
  */
40 44
 void GcodeSuite::M7219() {
41 45
   if (parser.seen('I'))
42 46
     Max7219_Clear();
43
-  else if (parser.seenval('R')) {
44
-    const uint8_t r = parser.value_int();
45
-    Max7219_Set_Row(r, parser.byteval('V'));
47
+
48
+  if (parser.seen('F'))
49
+    for (uint8_t x = 0; x < MAX7219_X_LEDS; x++)
50
+      Max7219_Set_Column(x, 0xFFFFFFFF);
51
+
52
+  if (parser.seenval('R')) {
53
+    const uint32_t r = parser.value_int();
54
+    Max7219_Set_Row(r, parser.ulongval('V'));
55
+    return;
46 56
   }
47 57
   else if (parser.seenval('C')) {
48
-    const uint8_t c = parser.value_int();
49
-    Max7219_Set_Column(c, parser.byteval('V'));
58
+    const uint32_t c = parser.value_int();
59
+    Max7219_Set_Column(c, parser.ulongval('V'));
60
+    return;
50 61
   }
51
-  else if (parser.seenval('X') || parser.seenval('Y')) {
62
+
63
+  if (parser.seenval('X') || parser.seenval('Y')) {
52 64
     const uint8_t x = parser.byteval('X'), y = parser.byteval('Y');
53 65
     if (parser.seenval('V'))
54 66
       Max7219_LED_Set(x, y, parser.boolval('V'));
55 67
     else
56 68
       Max7219_LED_Toggle(x, y);
57 69
   }
70
+
71
+  if (parser.seen('P')) {
72
+    for (uint8_t x = 0; x < COUNT(LEDs); x++) {
73
+      SERIAL_ECHOPAIR("LEDs[", x);
74
+      SERIAL_ECHOPAIR("]=", LEDs[x]);
75
+      SERIAL_EOL();
76
+    }
77
+    return;
78
+  }
58 79
 }
59 80
 
60 81
 #endif // MAX7219_GCODE

Loading…
Cancel
Save