Do not clear last print fail stats prematurely

M24 was always cleaning the last print failstats. But because M24 is
used to restore a print after power failure (by setting the seek
offset), it would also reset the stats incorrectly after resuming.

Check for the file index position and reset the stats only when a print
is started from the beginning of the file.

Apply the same logic to M32 and similarly handle the LA10->15 conversion
(do not re-apply the adjustment for a resumed print).
This commit is contained in:
Yuri D'Elia 2020-01-31 15:08:24 +01:00
parent d70a147af5
commit 84ecf96be5

View file

@ -5576,10 +5576,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
lcd_resume_print();
else
{
failstats_reset_print();
if (!card.get_sdpos())
{
// A new print has started from scratch, reset stats
failstats_reset_print();
#ifndef LA_NOCOMPAT
la10c_reset();
la10c_reset();
#endif
}
card.startFileprint();
starttime=_millis();
}
@ -5689,12 +5694,19 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
if(code_seen('S'))
if(strchr_pointer<namestartpos) //only if "S" is occuring _before_ the filename
card.setIndex(code_value_long());
#ifndef LA_NOCOMPAT
la10c_reset();
#endif
card.startFileprint();
if(!call_procedure)
starttime=_millis(); //procedure calls count as normal print time.
{
if(!card.get_sdpos())
{
// A new print has started from scratch, reset stats
failstats_reset_print();
#ifndef LA_NOCOMPAT
la10c_reset();
#endif
}
starttime=_millis(); // procedure calls count as normal print time.
}
}
} break;