瀏覽代碼

Fixes for PID AutoTune from menu

Fixes for #3189

Setting a temp is still missing
WPBack 9 年之前
父節點
當前提交
e3f583a3be
共有 5 個檔案被更改,包括 16 行新增25 行删除
  1. 1
    1
      Marlin/Configuration.h
  2. 1
    1
      Marlin/Marlin_main.cpp
  3. 1
    1
      Marlin/temperature.cpp
  4. 1
    1
      Marlin/temperature.h
  5. 12
    21
      Marlin/ultralcd.cpp

+ 1
- 1
Marlin/Configuration.h 查看文件

718
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
718
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
719
 //#define REVERSE_MENU_DIRECTION // When enabled CLOCKWISE moves UP in the LCD menu
719
 //#define REVERSE_MENU_DIRECTION // When enabled CLOCKWISE moves UP in the LCD menu
720
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
720
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
721
-#define ULTIPANEL  //the UltiPanel as on Thingiverse
721
+//#define ULTIPANEL  //the UltiPanel as on Thingiverse
722
 //#define SPEAKER // The sound device is a speaker - not a buzzer. A buzzer resonates with his own frequency.
722
 //#define SPEAKER // The sound device is a speaker - not a buzzer. A buzzer resonates with his own frequency.
723
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
723
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
724
 //#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
724
 //#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click

+ 1
- 1
Marlin/Marlin_main.cpp 查看文件

5142
 inline void gcode_M303() {
5142
 inline void gcode_M303() {
5143
   int e = code_seen('E') ? code_value_short() : 0;
5143
   int e = code_seen('E') ? code_value_short() : 0;
5144
   int c = code_seen('C') ? code_value_short() : 5;
5144
   int c = code_seen('C') ? code_value_short() : 5;
5145
-  bool u = code_seen('U') && code_value_short() == 1;
5145
+  bool u = code_seen('U') && code_value_short() != 0;
5146
   
5146
   
5147
   float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
5147
   float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
5148
 
5148
 

+ 1
- 1
Marlin/temperature.cpp 查看文件

199
 //================================ Functions ================================
199
 //================================ Functions ================================
200
 //===========================================================================
200
 //===========================================================================
201
 
201
 
202
-void PID_autotune(float temp, int extruder, int ncycles, bool set_result) {
202
+void PID_autotune(float temp, int extruder, int ncycles, bool set_result /* = false */) {
203
   float input = 0.0;
203
   float input = 0.0;
204
   int cycles = 0;
204
   int cycles = 0;
205
   bool heating = true;
205
   bool heating = true;

+ 1
- 1
Marlin/temperature.h 查看文件

141
 void disable_all_heaters();
141
 void disable_all_heaters();
142
 void updatePID();
142
 void updatePID();
143
 
143
 
144
-void PID_autotune(float temp, int extruder, int ncycles, bool set_result);
144
+void PID_autotune(float temp, int extruder, int ncycles, bool set_result = false);
145
 
145
 
146
 void setExtruderAutoFanState(int pin, bool state);
146
 void setExtruderAutoFanState(int pin, bool state);
147
 void checkExtruderAutoFans();
147
 void checkExtruderAutoFans();

+ 12
- 21
Marlin/ultralcd.cpp 查看文件

1189
       raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \
1189
       raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \
1190
       MENU_ITEM_EDIT(float52, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \
1190
       MENU_ITEM_EDIT(float52, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \
1191
       MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I ELABEL, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E ## eindex); \
1191
       MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I ELABEL, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E ## eindex); \
1192
-      MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex); \
1193
-      if (eindex == 0) { \
1194
-        MENU_ITEM(gcode, MSG_PID_AUTOTUNE ELABEL, PSTR("M303 U1")); \
1195
-      } \
1196
-      else if (eindex == 1) { \
1197
-        MENU_ITEM(gcode, MSG_PID_AUTOTUNE ELABEL, PSTR("M303 U1 E1")); \
1198
-      } \
1199
-      else if (eindex == 2) { \
1200
-        MENU_ITEM(gcode, MSG_PID_AUTOTUNE ELABEL, PSTR("M303 U1 E2")); \
1201
-      } \
1202
-      else { \
1203
-        MENU_ITEM(gcode, MSG_PID_AUTOTUNE ELABEL, PSTR("M303 U1 E3")); \
1204
-      }
1192
+      MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex)
1205
       
1193
       
1206
     #if ENABLED(PID_ADD_EXTRUSION_RATE)
1194
     #if ENABLED(PID_ADD_EXTRUSION_RATE)
1207
-      #define PID_MENU_ITEMS(ELABEL, eindex) \
1195
+      #define PID_MENU_ITEMS(ELABEL, eindex, AUTOTUNE_CMD) \
1208
         _PID_MENU_ITEMS(ELABEL, eindex); \
1196
         _PID_MENU_ITEMS(ELABEL, eindex); \
1209
-        MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990)
1197
+        MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990); \
1198
+        MENU_ITEM(gcode, MSG_PID_AUTOTUNE ELABEL, PSTR(AUTOTUNE_CMD))
1210
     #else
1199
     #else
1211
-      #define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex)
1200
+      #define PID_MENU_ITEMS(ELABEL, eindex, AUTOTUNE_CMD) \
1201
+        _PID_MENU_ITEMS(ELABEL, eindex); \
1202
+        MENU_ITEM(gcode, MSG_PID_AUTOTUNE ELABEL, PSTR(AUTOTUNE_CMD))
1212
     #endif
1203
     #endif
1213
 
1204
 
1214
     #if ENABLED(PID_PARAMS_PER_EXTRUDER) && EXTRUDERS > 1
1205
     #if ENABLED(PID_PARAMS_PER_EXTRUDER) && EXTRUDERS > 1
1215
-      PID_MENU_ITEMS(MSG_E1, 0);
1216
-      PID_MENU_ITEMS(MSG_E2, 1);
1206
+      PID_MENU_ITEMS(MSG_E1, 0, "M303 U1");
1207
+      PID_MENU_ITEMS(MSG_E2, 1, "M303 U1 E1");
1217
       #if EXTRUDERS > 2
1208
       #if EXTRUDERS > 2
1218
-        PID_MENU_ITEMS(MSG_E3, 2);
1209
+        PID_MENU_ITEMS(MSG_E3, 2, "M303 U1 E2");
1219
         #if EXTRUDERS > 3
1210
         #if EXTRUDERS > 3
1220
-          PID_MENU_ITEMS(MSG_E4, 3);
1211
+          PID_MENU_ITEMS(MSG_E4, 3, "M303 U1 E3");
1221
         #endif //EXTRUDERS > 3
1212
         #endif //EXTRUDERS > 3
1222
       #endif //EXTRUDERS > 2
1213
       #endif //EXTRUDERS > 2
1223
     #else //!PID_PARAMS_PER_EXTRUDER || EXTRUDERS == 1
1214
     #else //!PID_PARAMS_PER_EXTRUDER || EXTRUDERS == 1
1224
-      PID_MENU_ITEMS("", 0);
1215
+      PID_MENU_ITEMS("", 0, "M303 U1");
1225
     #endif //!PID_PARAMS_PER_EXTRUDER || EXTRUDERS == 1
1216
     #endif //!PID_PARAMS_PER_EXTRUDER || EXTRUDERS == 1
1226
 
1217
 
1227
   #endif //PIDTEMP
1218
   #endif //PIDTEMP

Loading…
取消
儲存