Shorter paths to HAL, ExtUI (#17156)
This commit is contained in:
		
							
								
								
									
										39
									
								
								Marlin/src/gcode/sd/M20.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Marlin/src/gcode/sd/M20.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M20: List SD card to serial output
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M20() {
 | 
			
		||||
  SERIAL_ECHOLNPGM(STR_BEGIN_FILE_LIST);
 | 
			
		||||
  card.ls();
 | 
			
		||||
  SERIAL_ECHOLNPGM(STR_END_FILE_LIST);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										40
									
								
								Marlin/src/gcode/sd/M21_M22.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Marlin/src/gcode/sd/M21_M22.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M21: Init SD Card
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M21() { card.mount(); }
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M22: Release SD Card
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M22() { card.release(); }
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										46
									
								
								Marlin/src/gcode/sd/M23.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								Marlin/src/gcode/sd/M23.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
#include "../../lcd/ultralcd.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M23: Open a file
 | 
			
		||||
 *
 | 
			
		||||
 * The path is relative to the root directory
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M23() {
 | 
			
		||||
  // Simplify3D includes the size, so zero out all spaces (#7227)
 | 
			
		||||
  for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
 | 
			
		||||
  card.openFileRead(parser.string_arg);
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
 | 
			
		||||
    ui.set_progress(0);
 | 
			
		||||
  #endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										119
									
								
								Marlin/src/gcode/sd/M24_M25.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								Marlin/src/gcode/sd/M24_M25.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
#include "../../module/printcounter.h"
 | 
			
		||||
#include "../../lcd/ultralcd.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
 | 
			
		||||
  #include "../../feature/pause.h"
 | 
			
		||||
  #include "../queue.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(HOST_ACTION_COMMANDS)
 | 
			
		||||
  #include "../../feature/host_actions.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(POWER_LOSS_RECOVERY)
 | 
			
		||||
  #include "../../feature/powerloss.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "../../MarlinCore.h" // for startOrResumeJob
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M24: Start or Resume SD Print
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M24() {
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(POWER_LOSS_RECOVERY)
 | 
			
		||||
    if (parser.seenval('S')) card.setIndex(parser.value_long());
 | 
			
		||||
    if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(PARK_HEAD_ON_PAUSE)
 | 
			
		||||
    if (did_pause_print) {
 | 
			
		||||
      resume_print(); // will call print_job_timer.start()
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  if (card.isFileOpen()) {
 | 
			
		||||
    card.startFileprint();            // SD card will now be read for commands
 | 
			
		||||
    startOrResumeJob();               // Start (or resume) the print job timer
 | 
			
		||||
    #if ENABLED(POWER_LOSS_RECOVERY)
 | 
			
		||||
      recovery.prepare();
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(HOST_ACTION_COMMANDS)
 | 
			
		||||
    #ifdef ACTION_ON_RESUME
 | 
			
		||||
      host_action_resume();
 | 
			
		||||
    #endif
 | 
			
		||||
    #if ENABLED(HOST_PROMPT_SUPPORT)
 | 
			
		||||
      host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR);
 | 
			
		||||
    #endif
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  ui.reset_status();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M25: Pause SD Print
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M25() {
 | 
			
		||||
 | 
			
		||||
  // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
 | 
			
		||||
  #if ENABLED(SDSUPPORT)
 | 
			
		||||
    if (IS_SD_PRINTING()) card.pauseSDPrint();
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(PARK_HEAD_ON_PAUSE)
 | 
			
		||||
 | 
			
		||||
    M125();
 | 
			
		||||
 | 
			
		||||
  #else
 | 
			
		||||
 | 
			
		||||
    #if ENABLED(POWER_LOSS_RECOVERY)
 | 
			
		||||
      if (recovery.enabled) recovery.save(true);
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    print_job_timer.pause();
 | 
			
		||||
    ui.reset_status();
 | 
			
		||||
 | 
			
		||||
    #if ENABLED(HOST_ACTION_COMMANDS)
 | 
			
		||||
      #if ENABLED(HOST_PROMPT_SUPPORT)
 | 
			
		||||
        host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
 | 
			
		||||
      #endif
 | 
			
		||||
      #ifdef ACTION_ON_PAUSE
 | 
			
		||||
        host_action_pause();
 | 
			
		||||
      #endif
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
  #endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										38
									
								
								Marlin/src/gcode/sd/M26.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Marlin/src/gcode/sd/M26.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M26: Set SD Card file index
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M26() {
 | 
			
		||||
  if (card.isMounted() && parser.seenval('S'))
 | 
			
		||||
    card.setIndex(parser.value_long());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										50
									
								
								Marlin/src/gcode/sd/M27.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Marlin/src/gcode/sd/M27.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M27: Get SD Card status
 | 
			
		||||
 *      OR, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
 | 
			
		||||
 *      OR, with 'C' get the current filename.
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M27() {
 | 
			
		||||
  if (parser.seen('C')) {
 | 
			
		||||
    SERIAL_ECHOPGM("Current file: ");
 | 
			
		||||
    card.printFilename();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(AUTO_REPORT_SD_STATUS)
 | 
			
		||||
    else if (parser.seenval('S'))
 | 
			
		||||
      card.set_auto_report_interval(parser.value_byte());
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  else
 | 
			
		||||
    card.report_status();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										74
									
								
								Marlin/src/gcode/sd/M28_M29.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								Marlin/src/gcode/sd/M28_M29.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
#if NUM_SERIAL > 1
 | 
			
		||||
  #include "../queue.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M28: Start SD Write
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M28() {
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(BINARY_FILE_TRANSFER)
 | 
			
		||||
 | 
			
		||||
    bool binary_mode = false;
 | 
			
		||||
    char *p = parser.string_arg;
 | 
			
		||||
    if (p[0] == 'B' && NUMERIC(p[1])) {
 | 
			
		||||
      binary_mode = p[1] > '0';
 | 
			
		||||
      p += 2;
 | 
			
		||||
      while (*p == ' ') ++p;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Binary transfer mode
 | 
			
		||||
    if ((card.flag.binary_mode = binary_mode)) {
 | 
			
		||||
      SERIAL_ECHO_MSG("Switching to Binary Protocol");
 | 
			
		||||
      #if NUM_SERIAL > 1
 | 
			
		||||
        card.transfer_port_index = queue.port[queue.index_r];
 | 
			
		||||
      #endif
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
      card.openFileWrite(p);
 | 
			
		||||
 | 
			
		||||
  #else
 | 
			
		||||
 | 
			
		||||
    card.openFileWrite(parser.string_arg);
 | 
			
		||||
 | 
			
		||||
  #endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M29: Stop SD Write
 | 
			
		||||
 * (Processed in write-to-file routine)
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M29() {
 | 
			
		||||
  card.flag.saving = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										40
									
								
								Marlin/src/gcode/sd/M30.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Marlin/src/gcode/sd/M30.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M30 <filename>: Delete SD Card file
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M30() {
 | 
			
		||||
  if (card.isMounted()) {
 | 
			
		||||
    card.closefile();
 | 
			
		||||
    card.removeFile(parser.string_arg);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										60
									
								
								Marlin/src/gcode/sd/M32.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								Marlin/src/gcode/sd/M32.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
#include "../../module/planner.h" // for synchronize()
 | 
			
		||||
 | 
			
		||||
#include "../../MarlinCore.h" // for startOrResumeJob
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M32: Select file and start SD Print
 | 
			
		||||
 *
 | 
			
		||||
 * Examples:
 | 
			
		||||
 *
 | 
			
		||||
 *    M32 !PATH/TO/FILE.GCO#      ; Start FILE.GCO
 | 
			
		||||
 *    M32 P !PATH/TO/FILE.GCO#    ; Start FILE.GCO as a procedure
 | 
			
		||||
 *    M32 S60 !PATH/TO/FILE.GCO#  ; Start FILE.GCO at byte 60
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M32() {
 | 
			
		||||
  if (IS_SD_PRINTING()) planner.synchronize();
 | 
			
		||||
 | 
			
		||||
  if (card.isMounted()) {
 | 
			
		||||
    const uint8_t call_procedure = parser.boolval('P');
 | 
			
		||||
 | 
			
		||||
    card.openFileRead(parser.string_arg, call_procedure);
 | 
			
		||||
 | 
			
		||||
    if (parser.seenval('S')) card.setIndex(parser.value_long());
 | 
			
		||||
 | 
			
		||||
    card.startFileprint();
 | 
			
		||||
 | 
			
		||||
    // Procedure calls count as normal print time.
 | 
			
		||||
    if (!call_procedure) startOrResumeJob();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										48
									
								
								Marlin/src/gcode/sd/M33.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								Marlin/src/gcode/sd/M33.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M33: Get the long full path of a file or folder
 | 
			
		||||
 *
 | 
			
		||||
 * Parameters:
 | 
			
		||||
 *   <dospath> Case-insensitive DOS-style path to a file or folder
 | 
			
		||||
 *
 | 
			
		||||
 * Example:
 | 
			
		||||
 *   M33 miscel~1/armchair/armcha~1.gco
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 *   /Miscellaneous/Armchair/Armchair.gcode
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M33() {
 | 
			
		||||
 | 
			
		||||
  card.printLongPath(parser.string_arg);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // LONG_FILENAME_HOST_SUPPORT
 | 
			
		||||
							
								
								
									
										42
									
								
								Marlin/src/gcode/sd/M34.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Marlin/src/gcode/sd/M34.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M34: Set SD Card Sorting Options
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M34() {
 | 
			
		||||
  if (parser.seen('S')) card.setSortOn(parser.value_bool());
 | 
			
		||||
  if (parser.seenval('F')) {
 | 
			
		||||
    const int v = parser.value_long();
 | 
			
		||||
    card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0);
 | 
			
		||||
  }
 | 
			
		||||
  //if (parser.seen('R')) card.setSortReverse(parser.value_bool());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDCARD_SORT_ALPHA && SDSORT_GCODE
 | 
			
		||||
							
								
								
									
										40
									
								
								Marlin/src/gcode/sd/M524.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Marlin/src/gcode/sd/M524.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M524: Abort the current SD print job (started with M24)
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M524() {
 | 
			
		||||
 | 
			
		||||
  if (IS_SD_PRINTING())
 | 
			
		||||
    card.flag.abort_sd_printing = true;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
							
								
								
									
										39
									
								
								Marlin/src/gcode/sd/M928.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Marlin/src/gcode/sd/M928.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SDSUPPORT)
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M928: Start SD Logging
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M928() {
 | 
			
		||||
 | 
			
		||||
  card.openLogFile(parser.string_arg);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // SDSUPPORT
 | 
			
		||||
		Reference in New Issue
	
	Block a user