Bugfix: crash when slicing one layer objects with sailfish G-code flavor. Includes regression test. #2335

This commit is contained in:
Alessandro Ranellucci 2014-11-06 21:06:09 +01:00
parent 11bd1e68e2
commit 30b0869595
4 changed files with 22 additions and 4 deletions

View file

@ -129,11 +129,14 @@ sub set_acceleration {
}
sub update_progress {
my ($self, $percent) = @_;
my ($self, $num, $tot, $allow_100) = @_;
return "" if $self->config->gcode_flavor !~ /^(?:makerware|sailfish)$/;
my $percent = int($num/$tot*100);
$percent = min($percent, 99) if !$allow_100;
return sprintf "M73 P%s%s\n",
int($percent),
$percent,
$self->_comment('update progress');
}