Skip to content

Commit

Permalink
Fix fan speed overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed May 20, 2024
1 parent 6e5ac06 commit d1c034a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libslic3r/GCodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,9 @@ std::string GCodeWriter::set_fan(const GCodeFlavor gcode_flavor, bool gcode_comm
std::ostringstream gcode;

//add fan_offset
int8_t fan_speed = int8_t(std::min(uint8_t(100), speed));
int16_t fan_speed = int8_t(std::min(uint8_t(100), speed));
fan_speed += tool_fan_offset;
fan_speed = std::max(int8_t(0), std::min(int8_t(100), fan_speed));
fan_speed = std::max(int16_t(0), std::min(int16_t(100), fan_speed));
const double fan_baseline = (is_fan_percentage ? 100.0 : 255.0);

// write it
Expand Down

0 comments on commit d1c034a

Please sign in to comment.