Browse Source

Improve/fix D23 for M2.5/S printers

- Move D23 into it's own function inside Dcodes
- Correctly include a break in the switch statement
- Show the dumper status (enabled/disabled) after toggling
- Allow to generate an immediate dump via g-code using D23 E for
  symmetry with D20 E
Yuri D'Elia 3 years ago
parent
commit
56e531d40a
3 changed files with 18 additions and 3 deletions
  1. 12 0
      Firmware/Dcodes.cpp
  2. 2 1
      Firmware/Dcodes.h
  3. 4 2
      Firmware/Marlin_main.cpp

+ 12 - 0
Firmware/Dcodes.cpp

@@ -974,6 +974,18 @@ void dcode_22()
 
 bool emergency_serial_dump = false;
 
+void dcode_23()
+{
+    if(code_seen('E'))
+        serial_dump_and_reset(dump_crash_reason::manual);
+    else
+    {
+        emergency_serial_dump = !code_seen('R');
+        SERIAL_ECHOPGM("serial dump ");
+        SERIAL_ECHOLNRPGM(emergency_serial_dump? _N("enabled"): _N("disabled"));
+    }
+}
+
 void __attribute__((noinline)) serial_dump_and_reset(dump_crash_reason reason)
 {
     uint16_t sp;

+ 2 - 1
Firmware/Dcodes.h

@@ -37,7 +37,8 @@ extern void dcode_22(); //D22 - Clear crash dump state
 
 #ifdef EMERGENCY_SERIAL_DUMP
 #include "xflash_dump.h"
-extern bool emergency_serial_dump;
+extern void dcode_23(); //D23 - Request/generate an online serial crash dump
+extern bool emergency_serial_dump; //emergency dump enabled flag
 extern void serial_dump_and_reset(dump_crash_reason);
 #endif
 

+ 4 - 2
Firmware/Marlin_main.cpp

@@ -9382,12 +9382,14 @@ Sigma_Exit:
     When online dumps are enabled, the FW will dump memory on the serial before resetting.
     #### Usage
 
-     D23 [R]
+     D23 [E] [R]
     #### Parameters
+    - `E` - Perform an emergency crash dump (resets the printer).
     - `R` - Disable online dumps.
     */
     case 23: {
-        emergency_serial_dump = !code_seen('R');
+        dcode_23();
+        break;
     };
 #endif