Browse Source

Added temperature window to M109. This is needed for systems with no overshoot PID.

Erik van der Zalm 13 years ago
parent
commit
02af69911e
2 changed files with 4 additions and 3 deletions
  1. 1
    0
      Marlin/Configuration.h
  2. 3
    3
      Marlin/Marlin.pde

+ 1
- 0
Marlin/Configuration.h View File

@@ -58,6 +58,7 @@
58 58
 // Actual temperature must be close to target for this long before M109 returns success
59 59
 #define TEMP_RESIDENCY_TIME 10	// (seconds)
60 60
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
61
+#define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
61 62
 
62 63
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
63 64
 // to check that the wiring to the thermistor is not broken. 

+ 3
- 3
Marlin/Marlin.pde View File

@@ -104,12 +104,12 @@
104 104
 // M240 - Trigger a camera to take a photograph
105 105
 // M301 - Set PID parameters P I and D
106 106
 // M302 - Allow cold extrudes
107
+// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
107 108
 // M400 - Finish all moves
108 109
 // M500 - stores paramters in EEPROM
109 110
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
110 111
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
111 112
 // M503 - print the current settings (from memory not from eeprom)
112
-// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
113 113
 // M999 - Restart after being stopped by error
114 114
 
115 115
 //Stepper Movement Variables
@@ -940,8 +940,8 @@ void process_commands()
940 940
         #ifdef TEMP_RESIDENCY_TIME
941 941
             /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
942 942
               or when current temp falls outside the hysteresis after target temp was reached */
943
-          if ((residencyStart == -1 &&  target_direction && !isHeatingHotend(tmp_extruder)) ||
944
-              (residencyStart == -1 && !target_direction && !isCoolingHotend(tmp_extruder)) ||
943
+          if ((residencyStart == -1 &&  target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder)-TEMP_WINDOW))) ||
944
+              (residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder)+TEMP_WINDOW))) ||
945 945
               (residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS) ) 
946 946
           {
947 947
             residencyStart = millis();

Loading…
Cancel
Save