Browse Source

Use #if TEMP_RESIDENCY_TIME > 0 rather than #ifdef TEMP_RESIDENCY_TIME

gralco 9 years ago
parent
commit
8ec8d59df8
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      Marlin/Marlin_main.cpp

+ 10
- 10
Marlin/Marlin_main.cpp View File

4316
   // Try to calculate a ballpark safe margin by halving EXTRUDE_MINTEMP
4316
   // Try to calculate a ballpark safe margin by halving EXTRUDE_MINTEMP
4317
   if (wants_to_cool && degTargetHotend(target_extruder) < (EXTRUDE_MINTEMP)/2) return;
4317
   if (wants_to_cool && degTargetHotend(target_extruder) < (EXTRUDE_MINTEMP)/2) return;
4318
 
4318
 
4319
-  #ifdef TEMP_RESIDENCY_TIME
4319
+  #if TEMP_RESIDENCY_TIME > 0
4320
     millis_t residency_start_ms = 0;
4320
     millis_t residency_start_ms = 0;
4321
     // Loop until the temperature has stabilized
4321
     // Loop until the temperature has stabilized
4322
     #define TEMP_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL))
4322
     #define TEMP_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL))
4323
   #else
4323
   #else
4324
     // Loop until the temperature is very close target
4324
     // Loop until the temperature is very close target
4325
     #define TEMP_CONDITIONS (wants_to_cool ? isCoolingHotend(target_extruder) : isHeatingHotend(target_extruder))
4325
     #define TEMP_CONDITIONS (wants_to_cool ? isCoolingHotend(target_extruder) : isHeatingHotend(target_extruder))
4326
-  #endif //TEMP_RESIDENCY_TIME
4326
+  #endif //TEMP_RESIDENCY_TIME > 0
4327
 
4327
 
4328
   cancel_heatup = false;
4328
   cancel_heatup = false;
4329
   millis_t now, next_temp_ms = 0;
4329
   millis_t now, next_temp_ms = 0;
4334
       #if HAS_TEMP_HOTEND || HAS_TEMP_BED
4334
       #if HAS_TEMP_HOTEND || HAS_TEMP_BED
4335
         print_heaterstates();
4335
         print_heaterstates();
4336
       #endif
4336
       #endif
4337
-      #ifdef TEMP_RESIDENCY_TIME
4337
+      #if TEMP_RESIDENCY_TIME > 0
4338
         SERIAL_PROTOCOLPGM(" W:");
4338
         SERIAL_PROTOCOLPGM(" W:");
4339
         if (residency_start_ms) {
4339
         if (residency_start_ms) {
4340
           long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
4340
           long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
4351
     idle();
4351
     idle();
4352
     refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
4352
     refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
4353
 
4353
 
4354
-    #ifdef TEMP_RESIDENCY_TIME
4354
+    #if TEMP_RESIDENCY_TIME > 0
4355
 
4355
 
4356
       float temp_diff = fabs(degTargetHotend(target_extruder) - degHotend(target_extruder));
4356
       float temp_diff = fabs(degTargetHotend(target_extruder) - degHotend(target_extruder));
4357
 
4357
 
4364
         residency_start_ms = millis();
4364
         residency_start_ms = millis();
4365
       }
4365
       }
4366
 
4366
 
4367
-    #endif //TEMP_RESIDENCY_TIME
4367
+    #endif //TEMP_RESIDENCY_TIME > 0
4368
 
4368
 
4369
   } while (!cancel_heatup && TEMP_CONDITIONS);
4369
   } while (!cancel_heatup && TEMP_CONDITIONS);
4370
 
4370
 
4389
     // Exit if S<lower>, continue if S<higher>, R<lower>, or R<higher>
4389
     // Exit if S<lower>, continue if S<higher>, R<lower>, or R<higher>
4390
     if (no_wait_for_cooling && wants_to_cool) return;
4390
     if (no_wait_for_cooling && wants_to_cool) return;
4391
 
4391
 
4392
-    #ifdef TEMP_BED_RESIDENCY_TIME
4392
+    #if TEMP_BED_RESIDENCY_TIME > 0
4393
       millis_t residency_start_ms = 0;
4393
       millis_t residency_start_ms = 0;
4394
       // Loop until the temperature has stabilized
4394
       // Loop until the temperature has stabilized
4395
       #define TEMP_BED_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_BED_RESIDENCY_TIME) * 1000UL))
4395
       #define TEMP_BED_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_BED_RESIDENCY_TIME) * 1000UL))
4396
     #else
4396
     #else
4397
       // Loop until the temperature is very close target
4397
       // Loop until the temperature is very close target
4398
       #define TEMP_BED_CONDITIONS (wants_to_cool ? isCoolingBed() : isHeatingBed())
4398
       #define TEMP_BED_CONDITIONS (wants_to_cool ? isCoolingBed() : isHeatingBed())
4399
-    #endif //TEMP_BED_RESIDENCY_TIME
4399
+    #endif //TEMP_BED_RESIDENCY_TIME > 0
4400
 
4400
 
4401
     cancel_heatup = false;
4401
     cancel_heatup = false;
4402
     millis_t now, next_temp_ms = 0;
4402
     millis_t now, next_temp_ms = 0;
4407
       if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up.
4407
       if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up.
4408
         next_temp_ms = now + 1000UL;
4408
         next_temp_ms = now + 1000UL;
4409
         print_heaterstates();
4409
         print_heaterstates();
4410
-        #ifdef TEMP_BED_RESIDENCY_TIME
4410
+        #if TEMP_BED_RESIDENCY_TIME > 0
4411
           SERIAL_PROTOCOLPGM(" W:");
4411
           SERIAL_PROTOCOLPGM(" W:");
4412
           if (residency_start_ms) {
4412
           if (residency_start_ms) {
4413
             long rem = (((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
4413
             long rem = (((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
4424
       idle();
4424
       idle();
4425
       refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
4425
       refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
4426
 
4426
 
4427
-      #ifdef TEMP_BED_RESIDENCY_TIME
4427
+      #if TEMP_BED_RESIDENCY_TIME > 0
4428
 
4428
 
4429
         float temp_diff = fabs(degBed() - degTargetBed());
4429
         float temp_diff = fabs(degBed() - degTargetBed());
4430
 
4430
 
4437
           residency_start_ms = millis();
4437
           residency_start_ms = millis();
4438
         }
4438
         }
4439
 
4439
 
4440
-      #endif //TEMP_BED_RESIDENCY_TIME
4440
+      #endif //TEMP_BED_RESIDENCY_TIME > 0
4441
 
4441
 
4442
     } while (!cancel_heatup && TEMP_BED_CONDITIONS);
4442
     } while (!cancel_heatup && TEMP_BED_CONDITIONS);
4443
     LCD_MESSAGEPGM(MSG_BED_DONE);
4443
     LCD_MESSAGEPGM(MSG_BED_DONE);

Loading…
Cancel
Save