Browse Source

Chamber vent/fan followup

Scott Lahteine 4 years ago
parent
commit
2c6ec0c999
1 changed files with 9 additions and 9 deletions
  1. 9
    9
      Marlin/src/module/temperature.cpp

+ 9
- 9
Marlin/src/module/temperature.cpp View File

1205
           #if CHAMBER_FAN_MODE == 0
1205
           #if CHAMBER_FAN_MODE == 0
1206
             fan_chamber_pwm = CHAMBER_FAN_BASE
1206
             fan_chamber_pwm = CHAMBER_FAN_BASE
1207
           #elif CHAMBER_FAN_MODE == 1
1207
           #elif CHAMBER_FAN_MODE == 1
1208
-            fan_chamber_pwm = temp_chamber.celsius > temp_chamber.target ? CHAMBER_FAN_BASE + ((temp_chamber.celsius - temp_chamber.target)  * CHAMBER_FAN_FACTOR ) : 0;
1208
+            fan_chamber_pwm = (temp_chamber.celsius > temp_chamber.target) ? (CHAMBER_FAN_BASE) + (CHAMBER_FAN_FACTOR) * (temp_chamber.celsius - temp_chamber.target) : 0;
1209
           #elif CHAMBER_FAN_MODE == 2
1209
           #elif CHAMBER_FAN_MODE == 2
1210
             fan_chamber_pwm = (CHAMBER_FAN_BASE) + (CHAMBER_FAN_FACTOR) * ABS(temp_chamber.celsius - temp_chamber.target);
1210
             fan_chamber_pwm = (CHAMBER_FAN_BASE) + (CHAMBER_FAN_FACTOR) * ABS(temp_chamber.celsius - temp_chamber.target);
1211
             if (temp_chamber.soft_pwm_amount)
1211
             if (temp_chamber.soft_pwm_amount)
1212
               fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2;
1212
               fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2;
1213
           #endif
1213
           #endif
1214
-          fan_chamber_pwm = _MIN(225, fan_chamber_pwm);
1214
+          NOMORE(fan_chamber_pwm, 225);
1215
           thermalManager.set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan
1215
           thermalManager.set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan
1216
         #endif
1216
         #endif
1217
 
1217
 
1256
       next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL;
1256
       next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL;
1257
 
1257
 
1258
       if (WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
1258
       if (WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
1259
-        if (!flag_chamber_excess_heat){
1259
+        if (flag_chamber_excess_heat) {
1260
+          temp_chamber.soft_pwm_amount = 0;
1261
+          #if ENABLED(CHAMBER_VENT)
1262
+            if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, temp_chamber.celsius <= temp_chamber.target ? 0 : 90);
1263
+          #endif
1264
+        }
1265
+        else {
1260
           #if ENABLED(CHAMBER_LIMIT_SWITCHING)
1266
           #if ENABLED(CHAMBER_LIMIT_SWITCHING)
1261
             if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
1267
             if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
1262
               temp_chamber.soft_pwm_amount = 0;
1268
               temp_chamber.soft_pwm_amount = 0;
1269
             if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, 0);
1275
             if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, 0);
1270
           #endif
1276
           #endif
1271
         }
1277
         }
1272
-        else {
1273
-          temp_chamber.soft_pwm_amount = 0;
1274
-          #if ENABLED(CHAMBER_VENT)
1275
-            if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, temp_chamber.celsius <= temp_chamber.target ? 0 : 90);
1276
-          #endif
1277
-        }
1278
       }
1278
       }
1279
       else {
1279
       else {
1280
         temp_chamber.soft_pwm_amount = 0;
1280
         temp_chamber.soft_pwm_amount = 0;

Loading…
Cancel
Save