Fix of a cooling buffer over multiple extruders.
This commit is contained in:
parent
115deee252
commit
bf9027ff2d
16
t/cooling.t
16
t/cooling.t
@ -2,7 +2,7 @@ use Test::More;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
plan tests => 13;
|
||||
plan tests => 15;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
@ -32,7 +32,7 @@ sub buffer {
|
||||
$gcodegen = Slic3r::GCode->new;
|
||||
$gcodegen->apply_print_config($print_config);
|
||||
$gcodegen->set_layer_count(10);
|
||||
$gcodegen->set_elapsed_time(0);
|
||||
$gcodegen->set_extruders([ 0 ]);
|
||||
return Slic3r::GCode::CoolingBuffer->new($gcodegen);
|
||||
}
|
||||
|
||||
@ -124,6 +124,18 @@ $config->set('disable_fan_first_layers', [ 0 ]);
|
||||
like $gcode, qr/M106/, 'fan is activated on all objects printing at different Z';
|
||||
}
|
||||
|
||||
{
|
||||
my $buffer = buffer($config, {
|
||||
'cooling' => [ 1 , 0 ],
|
||||
'fan_below_layer_time' => [ $print_time2 + 1, $print_time2 + 1 ],
|
||||
'slowdown_below_layer_time' => [ $print_time2 + 2, $print_time2 + 2 ]
|
||||
});
|
||||
$buffer->gcodegen->set_extruders([ 0, 1 ]);
|
||||
my $gcode = $buffer->process_layer($gcode1 . "T1\nG1 X0 E1 F3000\n", 0);
|
||||
like $gcode, qr/^M106/, 'fan is activated for the 1st tool';
|
||||
like $gcode, qr/.*M107/, 'fan is disabled for the 2nd tool';
|
||||
}
|
||||
|
||||
{
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->set('cooling', [ 1 ]);
|
||||
|
@ -143,8 +143,6 @@ public:
|
||||
// For Perl bindings, to be used exclusively by unit tests.
|
||||
unsigned int layer_count() const { return m_layer_count; }
|
||||
void set_layer_count(unsigned int value) { m_layer_count = value; }
|
||||
float elapsed_time() const { return m_writer.elapsed_time()->total; }
|
||||
void set_elapsed_time(float value) { std::vector<unsigned int> extruders; extruders.push_back(0); m_writer.set_extruders(extruders); m_writer.set_extruder(0); m_writer.elapsed_time()->total = value; }
|
||||
void apply_print_config(const PrintConfig &print_config);
|
||||
|
||||
protected:
|
||||
|
@ -237,6 +237,7 @@ std::string CoolingBuffer::process_layer(const std::string &gcode, size_t layer_
|
||||
active_speed_modifier = size_t(-1);
|
||||
} else if (boost::starts_with(sline, toolchange_prefix)) {
|
||||
// Switch the tool.
|
||||
line.type = Adjustment::Line::TYPE_SET_TOOL;
|
||||
unsigned int new_extruder = (unsigned int)atoi(sline.c_str() + toolchange_prefix.size());
|
||||
if (new_extruder != m_current_extruder) {
|
||||
m_current_extruder = new_extruder;
|
||||
@ -417,6 +418,7 @@ std::string CoolingBuffer::process_layer(const std::string &gcode, size_t layer_
|
||||
m_current_extruder = new_extruder;
|
||||
change_extruder_set_fan();
|
||||
}
|
||||
new_gcode.append(gcode.c_str() + line->line_start, line->line_end - line->line_start);
|
||||
} else if (line->type & Adjustment::Line::TYPE_BRIDGE_FAN_START) {
|
||||
if (bridge_fan_control)
|
||||
new_gcode += m_gcodegen.writer().set_fan(bridge_fan_speed, true) + "\n";
|
||||
|
@ -38,8 +38,8 @@
|
||||
|
||||
unsigned int layer_count() const;
|
||||
void set_layer_count(unsigned int value);
|
||||
float elapsed_time() const;
|
||||
void set_elapsed_time(float value);
|
||||
void set_extruders(std::vector<unsigned int> extruders)
|
||||
%code{% THIS->writer().set_extruders(extruders); THIS->writer().set_extruder(0); %};
|
||||
|
||||
void apply_print_config(StaticPrintConfig* print_config)
|
||||
%code{%
|
||||
|
Loading…
Reference in New Issue
Block a user