mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Bugfix: fan wasn't turned on for bridges when vibration limit or another internal post-processor was enabled. Includes regression test. #1533
This commit is contained in:
		
							parent
							
								
									4f58a1c401
								
							
						
					
					
						commit
						fc5aac0ff6
					
				
					 2 changed files with 38 additions and 2 deletions
				
			
		
							
								
								
									
										38
									
								
								t/cooling.t
									
										
									
									
									
								
							
							
						
						
									
										38
									
								
								t/cooling.t
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2,7 +2,7 @@ use Test::More;
 | 
			
		|||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
 | 
			
		||||
plan tests => 8;
 | 
			
		||||
plan tests => 11;
 | 
			
		||||
 | 
			
		||||
BEGIN {
 | 
			
		||||
    use FindBin;
 | 
			
		||||
| 
						 | 
				
			
			@ -10,6 +10,7 @@ BEGIN {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
use Slic3r;
 | 
			
		||||
use Slic3r::Test;
 | 
			
		||||
 | 
			
		||||
sub buffer {
 | 
			
		||||
    my $config = shift || Slic3r::Config->new_from_defaults;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,4 +87,39 @@ $config->set('disable_fan_first_layers', 0);
 | 
			
		|||
    like $gcode, qr/M106/, 'fan activation is computed on all objects printing at different Z';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    my $config = Slic3r::Config->new_from_defaults;
 | 
			
		||||
    $config->set('cooling', 1);
 | 
			
		||||
    $config->set('bridge_fan_speed', 100);
 | 
			
		||||
    $config->set('fan_below_layer_time', 0);
 | 
			
		||||
    $config->set('slowdown_below_layer_time', 0);
 | 
			
		||||
    $config->set('bridge_speed', 99);
 | 
			
		||||
    $config->set('top_solid_layers', 1);     # internal bridges use solid_infil speed
 | 
			
		||||
    $config->set('bottom_solid_layers', 1);  # internal bridges use solid_infil speed
 | 
			
		||||
    $config->set('vibration_limit', 30);     # test that fan is turned on even when vibration limit (or other G-code post-processor) is enabled
 | 
			
		||||
    
 | 
			
		||||
    my $print = Slic3r::Test::init_print('overhang', config => $config);
 | 
			
		||||
    my $fan = 0;
 | 
			
		||||
    my $fan_with_incorrect_speeds = my $fan_with_incorrect_print_speeds = 0;
 | 
			
		||||
    my $bridge_with_no_fan = 0;
 | 
			
		||||
    Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
 | 
			
		||||
        my ($self, $cmd, $args, $info) = @_;
 | 
			
		||||
        
 | 
			
		||||
        if ($cmd eq 'M106') {
 | 
			
		||||
            $fan = $args->{S};
 | 
			
		||||
            $fan_with_incorrect_speeds++ if $fan != 255;
 | 
			
		||||
        } elsif ($cmd eq 'M107') {
 | 
			
		||||
            $fan = 0;
 | 
			
		||||
        } elsif ($info->{extruding} && $info->{dist_XY} > 0) {
 | 
			
		||||
            $fan_with_incorrect_print_speeds++
 | 
			
		||||
                if ($fan > 0) && ($args->{F} // $self->F) != 60*$config->bridge_speed;
 | 
			
		||||
            $bridge_with_no_fan++
 | 
			
		||||
                if !$fan && ($args->{F} // $self->F) == 60*$config->bridge_speed;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    ok !$fan_with_incorrect_speeds, 'bridge fan speed is applied correctly';
 | 
			
		||||
    ok !$fan_with_incorrect_print_speeds, 'bridge fan is only turned on for bridges';
 | 
			
		||||
    ok !$bridge_with_no_fan, 'bridge fan is turned on for all bridges';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__END__
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue