Browse Source

Change openFile default to "not-push" instead of "do-replace"

pull/1/head
Scott Lahteine 9 years ago
parent
commit
27d70599d4
  1. 2
      Marlin/Marlin_main.cpp
  2. 4
      Marlin/cardreader.cpp
  3. 2
      Marlin/cardreader.h

2
Marlin/Marlin_main.cpp

@ -3704,7 +3704,7 @@ inline void gcode_M31() {
bool call_procedure = code_seen('P') && (seen_pointer < namestartpos); bool call_procedure = code_seen('P') && (seen_pointer < namestartpos);
if (card.cardOK) { if (card.cardOK) {
card.openFile(namestartpos, true, !call_procedure); card.openFile(namestartpos, true, call_procedure);
if (code_seen('S') && seen_pointer < namestartpos) // "S" (must occur _before_ the filename!) if (code_seen('S') && seen_pointer < namestartpos) // "S" (must occur _before_ the filename!)
card.setIndex(code_value_short()); card.setIndex(code_value_short());

4
Marlin/cardreader.cpp

@ -300,10 +300,10 @@ void CardReader::getAbsFilename(char *t) {
t[0] = 0; t[0] = 0;
} }
void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/) { void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
if (!cardOK) return; if (!cardOK) return;
if (file.isOpen()) { //replacing current file by new file, or subfile call if (file.isOpen()) { //replacing current file by new file, or subfile call
if (!replace_current) { if (push_current) {
if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) { if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:"); SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");

2
Marlin/cardreader.h

@ -40,7 +40,7 @@ public:
//this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset //this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset
void checkautostart(bool x); void checkautostart(bool x);
void openFile(char* name,bool read,bool replace_current=true); void openFile(char* name, bool read, bool push_current=false);
void openLogFile(char* name); void openLogFile(char* name);
void removeFile(char* name); void removeFile(char* name);
void closefile(bool store_location=false); void closefile(bool store_location=false);

Loading…
Cancel
Save