Browse Source

Add PID, probe offsets to ExtUI (#16792)

InsanityAutomation 5 years ago
parent
commit
a9549f7a08
2 changed files with 68 additions and 0 deletions
  1. 50
    0
      Marlin/src/lcd/extensible_ui/ui_api.cpp
  2. 18
    0
      Marlin/src/lcd/extensible_ui/ui_api.h

+ 50
- 0
Marlin/src/lcd/extensible_ui/ui_api.cpp View File

@@ -826,6 +826,15 @@ namespace ExtUI {
826 826
 
827 827
   #endif // HAS_HOTEND_OFFSET
828 828
 
829
+  #if HAS_BED_PROBE
830
+    float getProbeOffset_mm(const axis_t axis) {
831
+      return probe.offset.pos[axis];
832
+    }
833
+    void setProbeOffset_mm(const float val, const axis_t axis) {
834
+      probe.offset.pos[axis] = val;
835
+    }
836
+  #endif
837
+
829 838
   #if ENABLED(BACKLASH_GCODE)
830 839
     float getAxisBacklash_mm(const axis_t axis)       { return backlash.distance_mm[axis]; }
831 840
     void setAxisBacklash_mm(const float value, const axis_t axis)
@@ -885,6 +894,47 @@ namespace ExtUI {
885 894
 
886 895
   float getFeedrate_percent() { return feedrate_percentage; }
887 896
 
897
+  #if HAS_PID_HEATING
898
+    float getPIDValues_Kp(const extruder_t tool) {
899
+      return PID_PARAM(Kp, tool);
900
+    }
901
+    float getPIDValues_Ki(const extruder_t tool) {
902
+      return unscalePID_i(PID_PARAM(Ki, tool));
903
+    }
904
+    float getPIDValues_Kd(const extruder_t tool) {
905
+      return unscalePID_d(PID_PARAM(Kd, tool));
906
+    }
907
+    float getBedPIDValues_Kp() {
908
+      return thermalManager.temp_bed.pid.Kp;
909
+    }
910
+    float getBedPIDValues_Ki() {
911
+      return unscalePID_i(thermalManager.temp_bed.pid.Ki);
912
+    }
913
+    float getBedPIDValues_Kd() {
914
+      return unscalePID_d(thermalManager.temp_bed.pid.Kd);
915
+    }
916
+
917
+    void setPIDValues(const float p, const float i, const float d, extruder_t tool) {
918
+      thermalManager.temp_hotend[tool].pid.Kp = p;
919
+      thermalManager.temp_hotend[tool].pid.Ki = scalePID_i(i);
920
+      thermalManager.temp_hotend[tool].pid.Kd = scalePID_d(d);
921
+      thermalManager.updatePID();
922
+    }
923
+    void setBedPIDValues(const float p, const float i, const float d) {
924
+      thermalManager.temp_bed.pid.Kp = p;
925
+      thermalManager.temp_bed.pid.Ki = scalePID_i(i);
926
+      thermalManager.temp_bed.pid.Kd = scalePID_d(d);
927
+      thermalManager.updatePID();
928
+    }
929
+
930
+    void startPIDTune(const float temp, extruder_t tool){
931
+      thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true);
932
+    }
933
+    void startBedPIDTune(const float temp) {
934
+      thermalManager.PID_autotune(temp, H_BED, 4, true);
935
+    }
936
+  #endif
937
+
888 938
   void injectCommands_P(PGM_P const gcode) {
889 939
     queue.inject_P(gcode);
890 940
   }

+ 18
- 0
Marlin/src/lcd/extensible_ui/ui_api.h View File

@@ -211,6 +211,11 @@ namespace ExtUI {
211 211
   float getZOffset_mm();
212 212
   void setZOffset_mm(const float);
213 213
 
214
+  #if HAS_BED_PROBE
215
+    float getProbeOffset_mm(const axis_t);
216
+    void setProbeOffset_mm(const float, const axis_t);
217
+  #endif
218
+
214 219
   #if ENABLED(BACKLASH_GCODE)
215 220
     float getAxisBacklash_mm(const axis_t);
216 221
     void setAxisBacklash_mm(const float, const axis_t);
@@ -244,6 +249,19 @@ namespace ExtUI {
244 249
     #endif
245 250
   #endif
246 251
 
252
+  #if HAS_PID_HEATING
253
+    float getPIDValues_Kp(const extruder_t);
254
+    float getPIDValues_Ki(const extruder_t);
255
+    float getPIDValues_Kd(const extruder_t);
256
+    float getBedPIDValues_Kp();
257
+    float getBedPIDValues_Ki();
258
+    float getBedPIDValues_Kd();
259
+    void setPIDValues(const float, const float, const float, extruder_t);
260
+    void setBedPIDValues(const float, const float, const float);
261
+    void startPIDTune(const float, extruder_t);
262
+    void startBedPIDTune(const float);
263
+  #endif
264
+
247 265
   /**
248 266
    * Delay and timing routines
249 267
    * Should be used by the EXTENSIBLE_UI to safely pause or measure time

Loading…
Cancel
Save