Browse Source

🐛 Fix PID edit menu for Bed, Chamber (#23987)

Giuliano Zaro 2 years ago
parent
commit
e4c7c550fc
2 changed files with 36 additions and 9 deletions
  1. 35
    8
      Marlin/src/lcd/menu/menu_advanced.cpp
  2. 1
    1
      Marlin/src/module/planner.cpp

+ 35
- 8
Marlin/src/lcd/menu/menu_advanced.cpp View File

@@ -39,7 +39,7 @@
39 39
   #include "../../module/probe.h"
40 40
 #endif
41 41
 
42
-#if ENABLED(PIDTEMP)
42
+#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
43 43
   #include "../../module/temperature.h"
44 44
 #endif
45 45
 
@@ -190,7 +190,12 @@ void menu_backlash();
190 190
       #if ENABLED(PIDTEMPCHAMBER)
191 191
         case H_CHAMBER: tune_temp = autotune_temp_chamber; break;
192 192
       #endif
193
-      default: tune_temp = autotune_temp[hid]; break;
193
+      default:
194
+        #if ENABLED(PIDTEMP)
195
+          tune_temp = autotune_temp[hid]; break;
196
+        #else
197
+          return;
198
+        #endif
194 199
     }
195 200
     sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), hid, tune_temp);
196 201
     queue.inject(cmd);
@@ -206,14 +211,36 @@ void menu_backlash();
206 211
   // Helpers for editing PID Ki & Kd values
207 212
   // grab the PID value out of the temp variable; scale it; then update the PID driver
208 213
   void copy_and_scalePID_i(int16_t e) {
209
-    UNUSED(e);
210
-    PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
211
-    thermalManager.updatePID();
214
+    switch (e) {
215
+      #if ENABLED(PIDTEMPBED)
216
+        case H_BED: thermalManager.temp_bed.pid.Ki = scalePID_i(raw_Ki); break;
217
+      #endif
218
+      #if ENABLED(PIDTEMPCHAMBER)
219
+        case H_CHAMBER: thermalManager.temp_chamber.pid.Ki = scalePID_i(raw_Ki); break;
220
+      #endif
221
+      default:
222
+        #if ENABLED(PIDTEMP)
223
+          PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
224
+          thermalManager.updatePID();
225
+        #endif
226
+        break;
227
+    }
212 228
   }
213 229
   void copy_and_scalePID_d(int16_t e) {
214
-    UNUSED(e);
215
-    PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
216
-    thermalManager.updatePID();
230
+    switch (e) {
231
+      #if ENABLED(PIDTEMPBED)
232
+        case H_BED: thermalManager.temp_bed.pid.Kd = scalePID_d(raw_Kd); break;
233
+      #endif
234
+      #if ENABLED(PIDTEMPCHAMBER)
235
+        case H_CHAMBER: thermalManager.temp_chamber.pid.Kd = scalePID_d(raw_Kd); break;
236
+      #endif
237
+      default:
238
+        #if ENABLED(PIDTEMP)
239
+          PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
240
+          thermalManager.updatePID();
241
+        #endif
242
+        break;
243
+    }
217 244
   }
218 245
 
219 246
   #define _DEFINE_PIDTEMP_BASE_FUNCS(N) \

+ 1
- 1
Marlin/src/module/planner.cpp View File

@@ -2129,7 +2129,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2129 2129
             + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k),
2130 2130
             + sq(steps_dist_mm.u), + sq(steps_dist_mm.v), + sq(steps_dist_mm.w)
2131 2131
           );
2132
-        #elif ENABLED(FOAMCUTTER_XYUV) 
2132
+        #elif ENABLED(FOAMCUTTER_XYUV)
2133 2133
           #if HAS_J_AXIS
2134 2134
           // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane
2135 2135
           _MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j))

Loading…
Cancel
Save