♻️ Encapsulate PID in class (#24389)

This commit is contained in:
Scott Lahteine
2022-07-03 10:32:47 -05:00
parent 678955949f
commit e4f85e8fbc
13 changed files with 219 additions and 301 deletions

View File

@ -1202,7 +1202,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
Popup_Handler(ETemp);
else {
if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) {
if (thermalManager.temp_hotend[0].is_below_target(-2)) {
Popup_Handler(Heating);
thermalManager.wait_for_hotend(0);
}
@ -1345,7 +1345,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Popup_Handler(ETemp);
}
else {
if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) {
if (thermalManager.temp_hotend[0].is_below_target(-2)) {
Popup_Handler(Heating);
thermalManager.wait_for_hotend(0);
Redraw_Menu();
@ -1732,7 +1732,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
Popup_Handler(ETemp);
else {
if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) {
if (thermalManager.temp_hotend[0].is_below_target(-2)) {
Popup_Handler(Heating);
thermalManager.wait_for_hotend(0);
}
@ -1751,7 +1751,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Popup_Handler(ETemp);
}
else {
if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) {
if (thermalManager.temp_hotend[0].is_below_target(-2)) {
Popup_Handler(Heating);
thermalManager.wait_for_hotend(0);
}
@ -1769,7 +1769,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
Popup_Handler(ETemp);
else {
if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) {
if (thermalManager.temp_hotend[0].is_below_target(-2)) {
Popup_Handler(Heating);
thermalManager.wait_for_hotend(0);
}
@ -4404,7 +4404,7 @@ void CrealityDWINClass::Popup_Control() {
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
Popup_Handler(ETemp);
else {
if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) {
if (thermalManager.temp_hotend[0].is_below_target(-2)) {
Popup_Handler(Heating);
thermalManager.wait_for_hotend(0);
}

View File

@ -169,7 +169,7 @@ namespace ExtUI {
}
void yield() {
if (!flags.printer_killed) thermalManager.manage_heater();
if (!flags.printer_killed) thermalManager.task();
}
void enableHeater(const extruder_t extruder) {