|
@@ -276,19 +276,12 @@ void CardReader::openAndPrintFile(const char *name) {
|
276
|
276
|
}
|
277
|
277
|
|
278
|
278
|
void CardReader::startFileprint() {
|
279
|
|
- if (cardOK)
|
280
|
|
- sdprinting = true;
|
281
|
|
-}
|
282
|
|
-
|
283
|
|
-void CardReader::pauseSDPrint() {
|
284
|
|
- if (sdprinting) sdprinting = false;
|
|
279
|
+ if (cardOK) sdprinting = true;
|
285
|
280
|
}
|
286
|
281
|
|
287
|
282
|
void CardReader::stopSDPrint() {
|
288
|
|
- if (sdprinting) {
|
289
|
|
- sdprinting = false;
|
290
|
|
- file.close();
|
291
|
|
- }
|
|
283
|
+ sdprinting = false;
|
|
284
|
+ if (isFileOpen()) file.close();
|
292
|
285
|
}
|
293
|
286
|
|
294
|
287
|
void CardReader::openLogFile(char* name) {
|
|
@@ -340,7 +333,6 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
|
340
|
333
|
SERIAL_ECHOPGM("Now doing file: ");
|
341
|
334
|
SERIAL_ECHOLN(name);
|
342
|
335
|
}
|
343
|
|
- file.close();
|
344
|
336
|
}
|
345
|
337
|
else { //opening fresh file
|
346
|
338
|
file_subcall_ctr = 0; //resetting procedure depth in case user cancels print while in procedure
|
|
@@ -348,7 +340,8 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
|
348
|
340
|
SERIAL_ECHOPGM("Now fresh file: ");
|
349
|
341
|
SERIAL_ECHOLN(name);
|
350
|
342
|
}
|
351
|
|
- sdprinting = false;
|
|
343
|
+
|
|
344
|
+ stopSDPrint();
|
352
|
345
|
|
353
|
346
|
SdFile myDir;
|
354
|
347
|
curDir = &root;
|
|
@@ -425,8 +418,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
|
425
|
418
|
void CardReader::removeFile(char* name) {
|
426
|
419
|
if (!cardOK) return;
|
427
|
420
|
|
428
|
|
- file.close();
|
429
|
|
- sdprinting = false;
|
|
421
|
+ stopSDPrint();
|
430
|
422
|
|
431
|
423
|
SdFile myDir;
|
432
|
424
|
curDir = &root;
|