Browse Source

Chamber vent/fan followup

Scott Lahteine 4 years ago
parent
commit
6f6901180c
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

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

Loading…
Cancel
Save