Browse Source

Update M7219 comment, tweak parameter code

Scott Lahteine 6 years ago
parent
commit
a3dc1e461b
1 changed files with 13 additions and 9 deletions
  1. 13
    9
      Marlin/src/gcode/feature/leds/M7219.cpp

+ 13
- 9
Marlin/src/gcode/feature/leds/M7219.cpp View File

@@ -33,13 +33,16 @@
33 33
  *  I         - Initialize (clear) the matrix
34 34
  *  F         - Fill the matrix (set all bits)
35 35
  *  P         - Dump the led_line[] array values
36
- *  C<column> - Set a column to the 8-bit value V
37
- *  R<row>    - Set a row to the 8-bit value V
38
- *  X<pos>    - X position of an LED to set or toggle
39
- *  Y<pos>    - Y position of an LED to set or toggle
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)
36
+ *  C<column> - Set a column to the bitmask given by 'V' (Units 0-3 in portrait layout)
37
+ *  R<row>    - Set a row to the bitmask given by 'V' (Units 0-3 in landscape layout)
38
+ *  X<pos>    - X index of an LED to set or toggle
39
+ *  Y<pos>    - Y index of an LED to set or toggle
40
+ *  V<value>  - LED on/off state or row/column bitmask (8, 16, 24, or 32-bits)
41
+ *              ('C' / 'R' can be used to update up to 4 units at once)
42
+ *
43
+ * Directly set a native matrix row to the 8-bit value 'V':
44
+ *  D<line>   - Display line (0..7)
45
+ *  U<unit>   - Unit index (0..MAX7219_NUMBER_UNITS-1)
43 46
  */
44 47
 void GcodeSuite::M7219() {
45 48
   if (parser.seen('I')) {
@@ -62,12 +65,13 @@ void GcodeSuite::M7219() {
62 65
   else if (parser.seenval('X') || parser.seenval('Y')) {
63 66
     const uint8_t x = parser.byteval('X'), y = parser.byteval('Y');
64 67
     if (parser.seenval('V'))
65
-      max7219.led_set(x, y, parser.boolval('V'));
68
+      max7219.led_set(x, y, v > 0);
66 69
     else
67 70
       max7219.led_toggle(x, y);
68 71
   }
69 72
   else if (parser.seen('D')) {
70
-    const uint8_t line = parser.byteval('D') + (parser.byteval('U') << 3);
73
+    const uint8_t uline = parser.value_byte() & 0x7,
74
+                  line = uline + parser.byteval('U') << 3;
71 75
     if (line < MAX7219_LINES) {
72 76
       max7219.led_line[line] = v;
73 77
       return max7219.refresh_line(line);

Loading…
Cancel
Save