From 6c62b0e26342654a9aa52ff1af722fd35a669d3c Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Thu, 19 Jul 2018 16:59:38 -0500 Subject: [PATCH] Change Max7219_idle_task() to use columns if Y-Axis has 16 LED's (#11317) --- Marlin/Max7219_Debug_LEDs.cpp | 30 ++++++++++++++----- .../FolgerTech/i3-2020/Configuration_adv.h | 2 +- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Marlin/Max7219_Debug_LEDs.cpp b/Marlin/Max7219_Debug_LEDs.cpp index 097baa05be..45304a9307 100644 --- a/Marlin/Max7219_Debug_LEDs.cpp +++ b/Marlin/Max7219_Debug_LEDs.cpp @@ -411,8 +411,13 @@ void Max7219_init() { // Apply changes to update a marker inline void Max7219_Mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) { #if MAX7219_X_LEDS == 8 - Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8)); - Max7219_LED_On(v2 & 0x7, y + (v2 >= 8)); + #if MAX7219_Y_LEDS == 8 + Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8)); + Max7219_LED_On(v2 & 0x7, y + (v2 >= 8)); + #else + Max7219_LED_Off(y, v1 & 0xF); // The Max7219 Y-Axis has at least 16 LED's. So use a single column + Max7219_LED_On(y, v2 & 0xF); + #endif #else // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's Max7219_LED_Off(v1 & 0xf, y); Max7219_LED_On(v2 & 0xf, y); @@ -422,10 +427,17 @@ inline void Max7219_Mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) // Apply changes to update a tail-to-head range inline void Max7219_Range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh) { #if MAX7219_X_LEDS == 8 - if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) - Max7219_LED_Off(n & 0x7, y + (n >= 8)); - if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF) - Max7219_LED_On(n & 0x7, y + (n >= 8)); + #if MAX7219_Y_LEDS == 8 + if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) + Max7219_LED_Off(n & 0x7, y + (n >= 8)); + if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF) + Max7219_LED_On(n & 0x7, y + (n >= 8)); + #else // The Max7219 Y-Axis has at least 16 LED's. So use a single column + if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) + Max7219_LED_Off(y, n & 0xF); + if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF) + Max7219_LED_On(y, n & 0xF); + #endif #else // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) Max7219_LED_Off(n & 0xf, y); @@ -438,7 +450,11 @@ inline void Max7219_Range16(const uint8_t y, const uint8_t ot, const uint8_t nt, inline void Max7219_Quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv) { for (uint8_t i = MIN(nv, ov); i < MAX(nv, ov); i++) #if MAX7219_X_LEDS == 8 - Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix. Use two lines to get 16 LED's + #if MAX7219_Y_LEDS == 8 + Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix. Use two lines to get 16 LED's + #else + Max7219_LED_Set(y, i, nv >= ov); // The Max7219 Y-Axis has at least 16 LED's. So use a single column + #endif #else 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 #endif diff --git a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h index e4f7681bd1..de5681f2f3 100644 --- a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h @@ -1673,7 +1673,7 @@ //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) - #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. + #define MAX7219_NUMBER_UNITS 2 // Number of Max7219 units in chain. #define MAX7219_ROTATE -90 // Rotate the display clockwise (in multiples of +/- 90°) // connector at: right=0 bottom=-90 top=90 left=180 /**