Skip to content

Commit

Permalink
Test to ensure that the repetier firmware returns the correct acceler…
Browse files Browse the repository at this point in the history
…ation M code and that the values are set properly.
  • Loading branch information
lordofhyphens committed Jul 20, 2016
1 parent 885f27b commit e56a29a
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion t/gcode.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Test::More tests => 23;
use Test::More tests => 25;
use strict;
use warnings;

Expand Down Expand Up @@ -215,4 +215,31 @@ use Slic3r::Test;
ok !$spiral, 'spiral vase is correctly disabled on layers with multiple loops';
}


{
# Tests that the Repetier flavor produces M201 Xnnn Ynnn for resetting
# acceleration, also that M204 Snnn syntax is not generated.
my $config = Slic3r::Config->new_from_defaults;
$config->set('gcode_flavor', 'repetier');
$config->set('default_acceleration', 1337);
my $print = Slic3r::Test::init_print('cube_with_hole', config => $config);

my $has_accel = 0;
my $has_m204 = 0;
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;

if ($cmd eq 'M201' && exists $args->{X} && exists $args->{Y}) {
if ($args->{X} == 1337 && $args->{Y} == 1337) {
$has_accel = 1;
}
}
if ($cmd eq 'M204' && exists $args->{S}) {
$has_m204 = 1;
}
});
ok $has_accel, 'M201 is generated for repetier firmware.';
ok !$has_m204, 'M204 is not generated for repetier firmware';
}

__END__

0 comments on commit e56a29a

Please sign in to comment.