Prechádzať zdrojové kódy

Merge pull request #2134 from mkbel/fix_power_panic

Fix repeated power panic restarted print from beginning or jumped at …
DRracer 4 rokov pred
rodič
commit
6aaa40b9a3
2 zmenil súbory, kde vykonal 12 pridanie a 3 odobranie
  1. 10 3
      Firmware/Marlin_main.cpp
  2. 2 0
      Firmware/cmdqueue.h

+ 10 - 3
Firmware/Marlin_main.cpp

@@ -5339,11 +5339,18 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
       card.pauseSDPrint();
       break;
 
-    //! ### M26 - Set SD index
+    //! ### M26 S\<index\> - Set SD index
+    //! Set position in SD card file to index in bytes.
+    //! This command is expected to be called after M23 and before M24.
+    //! Otherwise effect of this command is undefined.
     // ----------------------------------
     case 26: 
       if(card.cardOK && code_seen('S')) {
-        card.setIndex(code_value_long());
+        long index = code_value_long();
+        card.setIndex(index);
+        // We don't disable interrupt during update of sdpos_atomic
+        // as we expect, that SD card print is not active in this moment
+        sdpos_atomic = index;
       }
       break;
 
@@ -9497,7 +9504,7 @@ void serialecho_temperatures() {
 	SERIAL_PROTOCOL_F(degBed(), 1);
 	SERIAL_PROTOCOLLN("");
 }
-extern uint32_t sdpos_atomic;
+
 #ifdef UVLO_SUPPORT
 
 void uvlo_()

+ 2 - 0
Firmware/cmdqueue.h

@@ -45,6 +45,8 @@ extern bool cmdbuffer_front_already_processed;
 // Debugging information will be sent to serial line.
 //#define CMDBUFFER_DEBUG
 
+extern uint32_t sdpos_atomic;
+
 extern int serial_count;
 extern boolean comment_mode;
 extern char *strchr_pointer;