Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1638,27 +1638,28 @@
/**
* MAX7219 Debug Matrix
*
* Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip, which can be used as a status
* display. Requires 3 signal wires. Some useful debug options are included to demonstrate its usage.
*
* Fully assembled MAX7219 boards can be found on the internet for under $2(US).
* For example, see https://www.ebay.com/sch/i.html?_nkw=332349290049
* Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display.
* Requires 3 signal wires. Some useful debug options are included to demonstrate its usage.
*/
//#define MAX7219_DEBUG
#if ENABLED(MAX7219_DEBUG)
#define MAX7219_CLK_PIN 64 // 77 on Re-ARM // Configuration of the 3 pins to control the display
#define MAX7219_DIN_PIN 57 // 78 on Re-ARM
#define MAX7219_LOAD_PIN 44 // 79 on Re-ARM
#define MAX7219_CLK_PIN 64
#define MAX7219_DIN_PIN 57
#define MAX7219_LOAD_PIN 44

//#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix
#define MAX7219_INIT_TEST // Do a test pattern at initialization (Set to 2 for spiral)
#define MAX7219_ROTATE 0 // Rotate the display counter-clockwise (multiple of +/- 90°)

/**
* Sample debug features
* If you add more debug displays, be careful to avoid conflicts!
*/
#define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning
#define MAX7219_DEBUG_STEPPER_HEAD 3 // Show the stepper queue head position on this and the next LED matrix row
#define MAX7219_DEBUG_STEPPER_TAIL 5 // Show the stepper queue tail position on this and the next LED matrix row
#define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row
#define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row

#define MAX7219_DEBUG_STEPPER_QUEUE 0 // Show the current stepper queue depth on this and the next LED matrix row
#define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row
// If you experience stuttering, reboots, etc. this option can reveal how
// tweaks made to the configuration are affecting the printer in real-time.
#endif
Expand Down
50 changes: 43 additions & 7 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10734,9 +10734,9 @@ inline void gcode_M502() {
/**
* M701: Load filament
*
* T[extruder] - Optional extruder number. Current extruder if omitted.
* Z[distance] - Move the Z axis by this distance
* L[distance] - Extrude distance for insertion (positive value) (manual reload)
* T<extruder> - Optional extruder number. Current extruder if omitted.
* Z<distance> - Move the Z axis by this distance
* L<distance> - Extrude distance for insertion (positive value) (manual reload)
*
* Default values are used for omitted arguments.
*/
Expand Down Expand Up @@ -10793,10 +10793,10 @@ inline void gcode_M502() {
/**
* M702: Unload filament
*
* T[extruder] - Optional extruder number. If omitted, current extruder
* T<extruder> - Optional extruder number. If omitted, current extruder
* (or ALL extruders with FILAMENT_UNLOAD_ALL_EXTRUDERS).
* Z[distance] - Move the Z axis by this distance
* U[distance] - Retract distance for removal (manual reload)
* Z<distance> - Move the Z axis by this distance
* U<distance> - Retract distance for removal (manual reload)
*
* Default values are used for omitted arguments.
*/
Expand Down Expand Up @@ -10865,6 +10865,38 @@ inline void gcode_M502() {

#endif // FILAMENT_LOAD_UNLOAD_GCODES

#if ENABLED(MAX7219_GCODE)
/**
* M7219: Control the Max7219 LED matrix
*
* I - Initialize (clear) the matrix
* C<column> - Set a column to the 8-bit value V
* R<row> - Set a row to the 8-bit value V
* X<pos> - X position of an LED to set or toggle
* Y<pos> - Y position of an LED to set or toggle
* V<value> - The 8-bit value or on/off state to set
*/
inline void gcode_M7219() {
if (parser.seen('I'))
for (uint8_t r = 0; r < 8; r++) Max7219_Set_Row(r, 0);
else if (parser.seenval('R')) {
const uint8_t r = parser.value_int();
Max7219_Set_Row(r, parser.byteval('V'));
}
else if (parser.seenval('C')) {
const uint8_t c = parser.value_int();
Max7219_Set_Column(c, parser.byteval('V'));
}
else if (parser.seenval('X') || parser.seenval('Y')) {
const uint8_t x = parser.byteval('X'), y = parser.byteval('Y');
if (parser.seenval('V'))
Max7219_LED_Set(x, y, parser.boolval('V'));
else
Max7219_LED_Toggle(x, y);
}
}
#endif // MAX7219_GCODE

#if ENABLED(LIN_ADVANCE)
/**
* M900: Get or Set Linear Advance K-factor
Expand Down Expand Up @@ -12508,6 +12540,10 @@ void process_parsed_command() {
case 702: gcode_M702(); break; // M702: Unload Filament
#endif

#if ENABLED(MAX7219_GCODE)
case 7219: gcode_M7219(); break; // M7219: Set LEDs, columns, and rows
#endif

#if ENABLED(DEBUG_GCODE_PARSER)
case 800: parser.debug(); break; // M800: GCode Parser Test for M
#endif
Expand Down Expand Up @@ -14195,7 +14231,7 @@ void idle(
) {
#if ENABLED(MAX7219_DEBUG)
Max7219_idle_tasks();
#endif // MAX7219_DEBUG
#endif

lcd_update();

Expand Down
Loading