🐛 Fix PLR pos/sdpos (#26365)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
		@@ -358,7 +358,9 @@ void PrintJobRecovery::write() {
 | 
				
			|||||||
 * Resume the saved print job
 | 
					 * Resume the saved print job
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void PrintJobRecovery::resume() {
 | 
					void PrintJobRecovery::resume() {
 | 
				
			||||||
  const uint32_t resume_sdpos = info.sdpos; // Get here before the stepper ISR overwrites it
 | 
					  // Get these fields before any moves because stepper.cpp overwrites them
 | 
				
			||||||
 | 
					  const xyze_pos_t resume_pos = info.current_position;
 | 
				
			||||||
 | 
					  const uint32_t resume_sdpos = info.sdpos;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Apply the dry-run flag if enabled
 | 
					  // Apply the dry-run flag if enabled
 | 
				
			||||||
  if (info.flag.dryrun) marlin_debug_flags |= MARLIN_DEBUG_DRYRUN;
 | 
					  if (info.flag.dryrun) marlin_debug_flags |= MARLIN_DEBUG_DRYRUN;
 | 
				
			||||||
@@ -400,7 +402,7 @@ void PrintJobRecovery::resume() {
 | 
				
			|||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Interpret the saved Z according to flags
 | 
					  // Interpret the saved Z according to flags
 | 
				
			||||||
  const float z_print = info.current_position.z,
 | 
					  const float z_print = resume_pos.z,
 | 
				
			||||||
              z_raised = z_print + info.zraise;
 | 
					              z_raised = z_print + info.zraise;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -540,7 +542,7 @@ void PrintJobRecovery::resume() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Move back over to the saved XY
 | 
					  // Move back over to the saved XY
 | 
				
			||||||
  PROCESS_SUBCOMMANDS_NOW(TS(
 | 
					  PROCESS_SUBCOMMANDS_NOW(TS(
 | 
				
			||||||
    F("G1F3000X"), p_float_t(info.current_position.x, 3), 'Y', p_float_t(info.current_position.y, 3)
 | 
					    F("G1F3000X"), p_float_t(resume_pos.x, 3), 'Y', p_float_t(resume_pos.y, 3)
 | 
				
			||||||
  ));
 | 
					  ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Move back down to the saved Z for printing
 | 
					  // Move back down to the saved Z for printing
 | 
				
			||||||
@@ -550,7 +552,7 @@ void PrintJobRecovery::resume() {
 | 
				
			|||||||
  PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
 | 
					  PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Restore E position with G92.9
 | 
					  // Restore E position with G92.9
 | 
				
			||||||
  PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(info.current_position.e, 3)));
 | 
					  PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(resume_pos.e, 3)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TERN_(GCODE_REPEAT_MARKERS, repeat = info.stored_repeat);
 | 
					  TERN_(GCODE_REPEAT_MARKERS, repeat = info.stored_repeat);
 | 
				
			||||||
  TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
 | 
					  TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,6 +65,7 @@ inline void plr_error(FSTR_P const prefix) {
 | 
				
			|||||||
 * M1000: Resume from power-loss (undocumented)
 | 
					 * M1000: Resume from power-loss (undocumented)
 | 
				
			||||||
 *   - With 'S' go to the Resume/Cancel menu
 | 
					 *   - With 'S' go to the Resume/Cancel menu
 | 
				
			||||||
 *     ...unless the bed temperature is already above a configured minimum temperature.
 | 
					 *     ...unless the bed temperature is already above a configured minimum temperature.
 | 
				
			||||||
 | 
					 *   - With 'C' execute a cancel selection
 | 
				
			||||||
 *   - With no parameters, run recovery commands
 | 
					 *   - With no parameters, run recovery commands
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void GcodeSuite::M1000() {
 | 
					void GcodeSuite::M1000() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,6 +91,10 @@ PGM_P GCodeQueue::injected_commands_P; // = nullptr
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
char GCodeQueue::injected_commands[64]; // = { 0 }
 | 
					char GCodeQueue::injected_commands[64]; // = { 0 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Commit the accumulated G-code command to the ring buffer,
 | 
				
			||||||
 | 
					 * also setting its origin info.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void GCodeQueue::RingBuffer::commit_command(const bool skip_ok
 | 
					void GCodeQueue::RingBuffer::commit_command(const bool skip_ok
 | 
				
			||||||
  OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind/*=-1*/)
 | 
					  OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind/*=-1*/)
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,11 +80,11 @@ public:
 | 
				
			|||||||
    void advance_pos(uint8_t &p, const int inc) { if (++p >= BUFSIZE) p = 0; length += inc; }
 | 
					    void advance_pos(uint8_t &p, const int inc) { if (++p >= BUFSIZE) p = 0; length += inc; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void commit_command(const bool skip_ok
 | 
					    void commit_command(const bool skip_ok
 | 
				
			||||||
      OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind = serial_index_t())
 | 
					      OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind=serial_index_t())
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool enqueue(const char *cmd, const bool skip_ok=true
 | 
					    bool enqueue(const char *cmd, const bool skip_ok=true
 | 
				
			||||||
      OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind = serial_index_t())
 | 
					      OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind=serial_index_t())
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void ok_to_send();
 | 
					    void ok_to_send();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user