From 8600cbb01b7fb37cec5944db27f5aae412b32dd2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Jun 2018 11:49:36 -0400 Subject: [PATCH] Clear Max7219 without test pattern --- Marlin/Marlin_main.cpp | 2 +- Marlin/Max7219_Debug_LEDs.cpp | 4 ++++ Marlin/Max7219_Debug_LEDs.h | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index fa9d1742a..7bd45c57a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10882,7 +10882,7 @@ inline void gcode_M502() { */ inline void gcode_M7219() { if (parser.seen('I')) - Max7219_init(); + Max7219_Clear(); else if (parser.seenval('R')) { const uint8_t r = parser.value_int(); Max7219_Set_Row(r, parser.byteval('V')); diff --git a/Marlin/Max7219_Debug_LEDs.cpp b/Marlin/Max7219_Debug_LEDs.cpp index 2defab26c..eba1ffcd2 100644 --- a/Marlin/Max7219_Debug_LEDs.cpp +++ b/Marlin/Max7219_Debug_LEDs.cpp @@ -242,6 +242,10 @@ void Max7219_Clear_Column(const uint8_t _COL_) { #endif } +void Max7219_Clear() { + for (uint8_t r = 0; r < 8; r++) _Max7219_Set_Reg(r, 0); +} + void Max7219_Set_2_Rows(const uint8_t y, uint16_t val) { if (y > 6) return Max7219_Error(PSTR("Max7219_Set_2_Rows"), y, val); Max7219_Set_Row(y + 0, val & 0xFF); val >>= 8; diff --git a/Marlin/Max7219_Debug_LEDs.h b/Marlin/Max7219_Debug_LEDs.h index dec159cee..f00f23174 100644 --- a/Marlin/Max7219_Debug_LEDs.h +++ b/Marlin/Max7219_Debug_LEDs.h @@ -77,6 +77,9 @@ void Max7219_Clear_Column(const uint8_t col); void Max7219_Set_Row(const uint8_t row, const uint8_t val); void Max7219_Clear_Row(const uint8_t row); +// Quickly clear the whole matrix +void Max7219_Clear(); + // Apply custom code to update the matrix void Max7219_idle_tasks();