Clear "sdprinting" state only when all SD moves are complete
Ensure card.printingHasFinished sees all the planned moves before clearing sdprinting. To do that, we need to ensure all SD commands exited the command queue.
This commit is contained in:
parent
35ce2896bb
commit
404802b5e6
|
|
@ -582,30 +582,8 @@ void get_command()
|
|||
((serial_char == '#' || serial_char == ':') && comment_mode == false) ||
|
||||
serial_count >= (MAX_CMD_SIZE - 1) || n==-1)
|
||||
{
|
||||
if(card.eof()){
|
||||
SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED
|
||||
stoptime=_millis();
|
||||
char time[30];
|
||||
unsigned long t=(stoptime-starttime-pause_time)/1000;
|
||||
pause_time = 0;
|
||||
int hours, minutes;
|
||||
minutes=(t/60)%60;
|
||||
hours=t/60/60;
|
||||
save_statistics(total_filament_used, t);
|
||||
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLN(time);
|
||||
lcd_setstatus(time);
|
||||
card.printingHasFinished();
|
||||
card.checkautostart(true);
|
||||
if(card.eof()) break;
|
||||
|
||||
if (farm_mode)
|
||||
{
|
||||
prusa_statistics(6);
|
||||
lcd_commands_type = LcdCommands::FarmModeConfirm;
|
||||
}
|
||||
|
||||
}
|
||||
if(serial_char=='#')
|
||||
stop_buffering=true;
|
||||
|
||||
|
|
@ -663,6 +641,37 @@ void get_command()
|
|||
else if(!comment_mode) cmdbuffer[bufindw+CMDHDRSIZE+serial_count++] = serial_char;
|
||||
}
|
||||
}
|
||||
if(card.eof())
|
||||
{
|
||||
// file was fully buffered, but commands might still need to be planned!
|
||||
// do *not* clear sdprinting until all SD commands are consumed to ensure
|
||||
// SD state can be resumed from a saved printing state. sdprinting is only
|
||||
// cleared by printingHasFinished after peforming all remaining moves.
|
||||
if(!cmdqueue_calc_sd_length())
|
||||
{
|
||||
SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED
|
||||
stoptime=_millis();
|
||||
char time[30];
|
||||
unsigned long t=(stoptime-starttime-pause_time)/1000;
|
||||
pause_time = 0;
|
||||
int hours, minutes;
|
||||
minutes=(t/60)%60;
|
||||
hours=t/60/60;
|
||||
save_statistics(total_filament_used, t);
|
||||
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLN(time);
|
||||
lcd_setstatus(time);
|
||||
card.printingHasFinished();
|
||||
card.checkautostart(true);
|
||||
|
||||
if (farm_mode)
|
||||
{
|
||||
prusa_statistics(6);
|
||||
lcd_commands_type = LcdCommands::FarmModeConfirm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //SDSUPPORT
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue