prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.74k stars 1.93k forks source link

M107 called twice during startup #8671

Open gudvinr opened 2 years ago

gudvinr commented 2 years ago

Description of the bug

During startup routine M107 called twice:

I think second M107 is redundant and in fact, messing with custom g-code which might or might not set fans for some reason which will be disabled.

Project file & How to reproduce

  1. Slice file.

xyzCalibration_cube.zip

Checklist of files included above

Version of PrusaSlicer

2.4.2

Operating system

Arch Linux

Printer model

Artillery Genius Pro

kubispe1 commented 2 years ago

It is theoretical issue that could in some situations cause problem. But you are totally right. I add enhancement label.

gudvinr commented 2 years ago

So, I found out how that happens.

First, set_fan(0) explicitly called in startup code: https://github.com/prusa3d/PrusaSlicer/blob/b62689437ab6fcec8ae940a9664eaf5c83620fec/src/libslic3r/GCode.cpp#L1243

Then, inside process_layers code that checks whether or not you should ramp up the fan sets M107 because object initialized with m_fan_speed = -1: https://github.com/prusa3d/PrusaSlicer/blob/b62689437ab6fcec8ae940a9664eaf5c83620fec/src/libslic3r/GCode/CoolingBuffer.cpp#L737

kubispe1 commented 2 years ago

Thanks for extra info. Hope there will be time to investigate it more.