From 91baca6abb95a4e1eac1f14ac3f1bbf9d2a8f88e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 13 Nov 2017 03:32:39 -0600 Subject: [PATCH] Patches for compiler warnings/errors --- Marlin/src/gcode/temperature/M106_M107.cpp | 3 +-- Marlin/src/module/temperature.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 3fec55919d..dccf3234bf 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -45,7 +45,6 @@ void GcodeSuite::M106() { if (p < FAN_COUNT) { #if ENABLED(EXTRA_FAN_SPEED) const int16_t t = parser.intval('T'); - NOMORE(t, 255); if (t > 0) { switch (t) { case 1: @@ -56,7 +55,7 @@ void GcodeSuite::M106() { fanSpeeds[p] = new_fanSpeeds[p]; break; default: - new_fanSpeeds[p] = t; + new_fanSpeeds[p] = min(t, 255); break; } return; diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 1ab6b4bf97..e3ebd4e5e5 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1717,15 +1717,15 @@ void Temperature::isr() { #if ENABLED(FAN_SOFT_PWM) #if HAS_FAN0 - soft_pwm_count_fan[0] = (soft_pwm_count_fan[0] & pwm_mask) + soft_pwm_amount_fan[0] >> 1; + soft_pwm_count_fan[0] = ((soft_pwm_count_fan[0] & pwm_mask) + soft_pwm_amount_fan[0]) >> 1; WRITE_FAN(soft_pwm_count_fan[0] > pwm_mask ? HIGH : LOW); #endif #if HAS_FAN1 - soft_pwm_count_fan[1] = (soft_pwm_count_fan[1] & pwm_mask) + soft_pwm_amount_fan[1] >> 1; + soft_pwm_count_fan[1] = ((soft_pwm_count_fan[1] & pwm_mask) + soft_pwm_amount_fan[1]) >> 1; WRITE_FAN1(soft_pwm_count_fan[1] > pwm_mask ? HIGH : LOW); #endif #if HAS_FAN2 - soft_pwm_count_fan[2] = (soft_pwm_count_fan[2] & pwm_mask) + soft_pwm_amount_fan[2] >> 1; + soft_pwm_count_fan[2] = ((soft_pwm_count_fan[2] & pwm_mask) + soft_pwm_amount_fan[2]) >> 1; WRITE_FAN2(soft_pwm_count_fan[2] > pwm_mask ? HIGH : LOW); #endif #endif