Kaynağa Gözat

fixed bug with adjusting ki in realtime.

Bernhard Kubicek 13 yıl önce
ebeveyn
işleme
c57906b627
4 değiştirilmiş dosya ile 34 ekleme ve 22 silme
  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 Dosyayı Görüntüle

@@ -95,11 +95,11 @@
95 95
   // PID_SWING_AT_CRITIAL is the time for a full period of the oscillations at the critical Gain
96 96
   // usually further manual tunine is necessary.
97 97
 
98
-  #define PID_CRITIAL_GAIN 3000
99
-  #define PID_SWING_AT_CRITIAL 45 //seconds
98
+  #define PID_CRITIAL_GAIN 50
99
+  #define PID_SWING_AT_CRITIAL 47 //seconds
100 100
   
101
-  #define PID_PI    //no differentail term
102
-  //#define PID_PID //normal PID
101
+  //#define PID_PI    //no differentail term
102
+  #define PID_PID //normal PID
103 103
 
104 104
   #ifdef PID_PID
105 105
     //PID according to Ziegler-Nichols method

+ 22
- 18
Marlin/Marlin.pde Dosyayı Görüntüle

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

+ 7
- 0
Marlin/temperature.cpp Dosyayı Görüntüle

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

+ 1
- 0
Marlin/temperature.h Dosyayı Görüntüle

@@ -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…
İptal
Kaydet