Browse Source

Merge remote-tracking branch 'origin/Marlin_v1' into Marlin_v1

Erik van der Zalm 13 years ago
parent
commit
c00eefb824
4 changed files with 34 additions and 22 deletions
  1. 4
    4
      Marlin/Configuration.h
  2. 22
    18
      Marlin/Marlin.pde
  3. 7
    0
      Marlin/temperature.cpp
  4. 1
    0
      Marlin/temperature.h

+ 4
- 4
Marlin/Configuration.h View File

@@ -104,11 +104,11 @@
104 104
   // PID_SWING_AT_CRITIAL is the time for a full period of the oscillations at the critical Gain
105 105
   // usually further manual tunine is necessary.
106 106
 
107
-  #define PID_CRITIAL_GAIN 3000
108
-  #define PID_SWING_AT_CRITIAL 45 //seconds
107
+  #define PID_CRITIAL_GAIN 50
108
+  #define PID_SWING_AT_CRITIAL 47 //seconds
109 109
   
110
-  #define PID_PI    //no differentail term
111
-  //#define PID_PID //normal PID
110
+  //#define PID_PI    //no differentail term
111
+  #define PID_PID //normal PID
112 112
 
113 113
   #ifdef PID_PID
114 114
     //PID according to Ziegler-Nichols method

+ 22
- 18
Marlin/Marlin.pde View File

@@ -902,24 +902,28 @@ inline void process_commands()
902 902
 
903 903
     #ifdef PIDTEMP
904 904
     case 301: // M301
905
-      if(code_seen('P')) Kp = code_value();
906
-      if(code_seen('I')) Ki = code_value()*PID_dT;
907
-      if(code_seen('D')) Kd = code_value()/PID_dT;
908
-      #ifdef PID_ADD_EXTRUSION_RATE
909
-      if(code_seen('C')) Kc = code_value();
910
-      #endif
911
-      SERIAL_PROTOCOL("ok p:");
912
-      SERIAL_PROTOCOL(Kp);
913
-      SERIAL_PROTOCOL(" i:");
914
-      SERIAL_PROTOCOL(Ki/PID_dT);
915
-      SERIAL_PROTOCOL(" d:");
916
-      SERIAL_PROTOCOL(Kd*PID_dT);
917
-      #ifdef PID_ADD_EXTRUSION_RATE
918
-      SERIAL_PROTOCOL(" c:");
919
-      SERIAL_PROTOCOL(Kc*PID_dT);
920
-      #endif
921
-      SERIAL_PROTOCOLLN("");
922
-      
905
+      {
906
+        
907
+       
908
+        if(code_seen('P')) Kp = code_value();
909
+        if(code_seen('I')) Ki = code_value()*PID_dT;
910
+        if(code_seen('D')) Kd = code_value()/PID_dT;
911
+        #ifdef PID_ADD_EXTRUSION_RATE
912
+        if(code_seen('C')) Kc = code_value();
913
+        #endif
914
+        updatePID();
915
+        SERIAL_PROTOCOL("ok p:");
916
+        SERIAL_PROTOCOL(Kp);
917
+        SERIAL_PROTOCOL(" i:");
918
+        SERIAL_PROTOCOL(Ki/PID_dT);
919
+        SERIAL_PROTOCOL(" d:");
920
+        SERIAL_PROTOCOL(Kd*PID_dT);
921
+        #ifdef PID_ADD_EXTRUSION_RATE
922
+        SERIAL_PROTOCOL(" c:");
923
+        SERIAL_PROTOCOL(Kc*PID_dT);
924
+        #endif
925
+        SERIAL_PROTOCOLLN("");
926
+      }
923 927
       break;
924 928
     #endif //PIDTEMP
925 929
     case 400: // finish all moves

+ 7
- 0
Marlin/temperature.cpp View File

@@ -114,6 +114,13 @@ static unsigned long previous_millis_heater, previous_millis_bed_heater;
114 114
 //=============================functions         ============================
115 115
 //===========================================================================
116 116
   
117
+void updatePID()
118
+{
119
+#ifdef PIDTEMP
120
+  temp_iState_max = PID_INTEGRAL_DRIVE_MAX / Ki;
121
+#endif
122
+}
123
+  
117 124
 void manage_heater()
118 125
 {
119 126
   #ifdef USE_WATCHDOG

+ 1
- 0
Marlin/temperature.h View File

@@ -87,6 +87,7 @@ inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMP
87 87
 
88 88
 void disable_heater();
89 89
 void setWatch();
90
+void updatePID();
90 91
 
91 92
 #endif
92 93
 

Loading…
Cancel
Save