瀏覽代碼

Change Max7219_idle_task() to use a column instead of row if Y-Axis as 16 LED's

Roxy-3D 6 年之前
父節點
當前提交
db85ca93c4
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 27 行新增11 行删除
  1. 27
    11
      Marlin/src/feature/Max7219_Debug_LEDs.cpp

+ 27
- 11
Marlin/src/feature/Max7219_Debug_LEDs.cpp 查看文件

425
 // Apply changes to update a marker
425
 // Apply changes to update a marker
426
 inline void Max7219_Mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) {
426
 inline void Max7219_Mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) {
427
   #if MAX7219_X_LEDS == 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));
428
+    #if MAX7219_Y_LEDS == 8
429
+      Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8));
430
+       Max7219_LED_On(v2 & 0x7, y + (v2 >= 8));
431
+    #else
432
+      Max7219_LED_Off(y, v1 & 0xF);  // The Max7219 Y-Axis has at least 16 LED's.  So use a single column
433
+       Max7219_LED_On(y, v2 & 0xF);
434
+    #endif
430
   #else   // LED matrix has at least 16 LED's on the X-Axis.  Use single line of LED's
435
   #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);
436
+    Max7219_LED_Off(v1 & 0xf, y);
437
+     Max7219_LED_On(v2 & 0xf, y);
433
   #endif
438
   #endif
434
 }
439
 }
435
 
440
 
436
 // Apply changes to update a tail-to-head range
441
 // Apply changes to update a tail-to-head range
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) {
442
 inline void Max7219_Range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh) {
438
   #if MAX7219_X_LEDS == 8
443
   #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));
444
+    #if MAX7219_Y_LEDS == 8
445
+      if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
446
+        Max7219_LED_Off(n & 0x7, y + (n >= 8));
447
+      if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
448
+         Max7219_LED_On(n & 0x7, y + (n >= 8));
449
+    #else // The Max7219 Y-Axis has at least 16 LED's.  So use a single column
450
+      if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
451
+        Max7219_LED_Off(y, n & 0xF);
452
+      if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
453
+         Max7219_LED_On(y, n & 0xF);
454
+    #endif
443
   #else   // LED matrix has at least 16 LED's on the X-Axis.  Use single line of LED's
455
   #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)
456
     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);
457
+      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)
458
     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);
459
+       Max7219_LED_On(n & 0xf, y);
448
  #endif
460
  #endif
449
 }
461
 }
450
 
462
 
452
 inline void Max7219_Quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv) {
464
 inline void Max7219_Quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv) {
453
   for (uint8_t i = MIN(nv, ov); i < MAX(nv, ov); i++)
465
   for (uint8_t i = MIN(nv, ov); i < MAX(nv, ov); i++)
454
     #if MAX7219_X_LEDS == 8
466
     #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
467
+      #if MAX7219_Y_LEDS == 8
468
+        Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix.  Use two lines to get 16 LED's
469
+      #else
470
+        Max7219_LED_Set(y, i, nv >= ov);                // The Max7219 Y-Axis has at least 16 LED's.  So use a single column
471
+      #endif
456
     #else
472
     #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
473
       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
474
     #endif

Loading…
取消
儲存