Skip to content

Commit d678504

Browse files
thinkyheadLCh-77
authored andcommitted
♻️ Encapsulate PID in class (MarlinFirmware#24389)
1 parent af0ab24 commit d678504

File tree

12 files changed

+210
-292
lines changed

12 files changed

+210
-292
lines changed

Marlin/src/MarlinCore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ void idle(bool no_stepper_sleep/*=false*/) {
789789
manage_inactivity(no_stepper_sleep);
790790

791791
// Manage Heaters (and Watchdog)
792-
thermalManager.manage_heater();
792+
thermalManager.task();
793793

794794
// Max7219 heartbeat, animation, etc
795795
TERN_(MAX7219_DEBUG, max7219.idle_tasks());

Marlin/src/core/language.h

-4
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,6 @@
227227
#define STR_PID_DEBUG " PID_DEBUG "
228228
#define STR_PID_DEBUG_INPUT ": Input "
229229
#define STR_PID_DEBUG_OUTPUT " Output "
230-
#define STR_PID_DEBUG_PTERM " pTerm "
231-
#define STR_PID_DEBUG_ITERM " iTerm "
232-
#define STR_PID_DEBUG_DTERM " dTerm "
233-
#define STR_PID_DEBUG_CTERM " cTerm "
234230
#define STR_INVALID_EXTRUDER_NUM " - Invalid extruder number !"
235231
#define STR_MPC_AUTOTUNE "MPC Autotune"
236232
#define STR_MPC_AUTOTUNE_START " start for " STR_E

Marlin/src/core/utility.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ void safe_delay(millis_t ms) {
2929
while (ms > 50) {
3030
ms -= 50;
3131
delay(50);
32-
thermalManager.manage_heater();
32+
thermalManager.task();
3333
}
3434
delay(ms);
35-
thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
35+
thermalManager.task(); // This keeps us safe if too many small safe_delay() calls are made
3636
}
3737

3838
// A delay to provide brittle hosts time to receive bytes

Marlin/src/gcode/motion/G2_G3.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ void plan_arc(
290290

291291
for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times
292292

293-
thermalManager.manage_heater();
293+
thermalManager.task();
294294
const millis_t ms = millis();
295295
if (ELAPSED(ms, next_idle_ms)) {
296296
next_idle_ms = ms + 200UL;

Marlin/src/gcode/queue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ inline bool process_line_done(uint8_t &sis, char (&buff)[MAX_CMD_SIZE], int &ind
384384
buff[ind] = '\0'; // Of course, I'm a Terminator.
385385
const bool is_empty = (ind == 0); // An empty line?
386386
if (is_empty)
387-
thermalManager.manage_heater(); // Keep sensors satisfied
387+
thermalManager.task(); // Keep sensors satisfied
388388
else
389389
ind = 0; // Start a new line
390390
return is_empty; // Inform the caller

Marlin/src/lcd/extui/ui_api.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ namespace ExtUI {
169169
}
170170

171171
void yield() {
172-
if (!flags.printer_killed) thermalManager.manage_heater();
172+
if (!flags.printer_killed) thermalManager.task();
173173
}
174174

175175
void enableHeater(const extruder_t extruder) {

Marlin/src/libs/buzzer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void Buzzer::tone(const uint16_t duration, const uint16_t frequency/*=0*/) {
4848
if (!ui.sound_on) return;
4949
while (buffer.isFull()) {
5050
tick();
51-
thermalManager.manage_heater();
51+
thermalManager.task();
5252
}
5353
tone_t tone = { duration, frequency };
5454
buffer.enqueue(tone);

Marlin/src/module/motion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
970970
next_idle_ms = ms + 200UL;
971971
return idle();
972972
}
973-
thermalManager.manage_heater(); // Returns immediately on most calls
973+
thermalManager.task(); // Returns immediately on most calls
974974
}
975975

976976
#if IS_KINEMATIC

Marlin/src/module/planner_bezier.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void cubic_b_spline(
123123

124124
for (float t = 0; t < 1;) {
125125

126-
thermalManager.manage_heater();
126+
thermalManager.task();
127127
millis_t now = millis();
128128
if (ELAPSED(now, next_idle_ms)) {
129129
next_idle_ms = now + 200UL;

0 commit comments

Comments
 (0)