-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extra max-temp safety checks #13756
Merged
thinkyhead
merged 8 commits into
MarlinFirmware:bugfix-2.0.x
from
marcio-ao:pr-temp-message-fixes
Apr 20, 2019
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c5fb98a
Fixed temperature error messages
marcio-ao 3dd0fb7
Added optional BED_KILL_TEMP and HEATER_KILL_TEMP
marcio-ao 229a6d0
MSG_E0 is being deleted
thinkyhead ba8d14b
Update temperature.cpp
thinkyhead a791023
No need for extra kill temp
thinkyhead 8fe0293
ibid
thinkyhead 068eaf5
Correction to TEMP_ERR_PSTR repair
thinkyhead 143f58d
Fix bed/chamber error messages
thinkyhead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,17 +86,17 @@ Temperature thermalManager; | |
*/ | ||
|
||
#if HAS_HEATED_BED | ||
#define _BED_PSTR(E) (E) == -1 ? PSTR(MSG ## _BED) : | ||
#define _BED_PSTR(M,E) (E) == -1 ? PSTR(MSG_BED " " M) : | ||
#else | ||
#define _BED_PSTR(E) | ||
#define _BED_PSTR(M,E) | ||
#endif | ||
#if HAS_HEATED_CHAMBER | ||
#define _CHAMBER_PSTR(E) (E) == -2 ? PSTR(MSG ## _CHAMBER) : | ||
#define _CHAMBER_PSTR(M,E) (E) == -2 ? PSTR(MSG_CHAMBER " " M) : | ||
#else | ||
#define _CHAMBER_PSTR(E) | ||
#define _CHAMBER_PSTR(M,E) | ||
#endif | ||
#define _E_PSTR(M,E,N) (HOTENDS >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) : | ||
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(E) _CHAMBER_PSTR(E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M) | ||
#define TEMP_PSTR(M,E) _BED_PSTR(M,E) _CHAMBER_PSTR(M,E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M) | ||
|
||
// public: | ||
|
||
|
@@ -507,10 +507,10 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0 | |
if (current > watch_temp_target) heated = true; // - Flag if target temperature reached | ||
} | ||
else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired | ||
_temp_error(heater, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, heater)); | ||
_temp_error(heater, PSTR(MSG_T_HEATING_FAILED), TEMP_PSTR(MSG_HEATING_FAILED_LCD, heater)); | ||
} | ||
else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far? | ||
_temp_error(heater, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater)); | ||
_temp_error(heater, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_PSTR(MSG_THERMAL_RUNAWAY, heater)); | ||
} | ||
#endif | ||
} // every 2 seconds | ||
|
@@ -738,11 +738,11 @@ void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P | |
} | ||
|
||
void Temperature::max_temp_error(const int8_t heater) { | ||
_temp_error(heater, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, heater)); | ||
_temp_error(heater, PSTR(MSG_T_MAXTEMP), TEMP_PSTR(MSG_ERR_MAXTEMP, heater)); | ||
} | ||
|
||
void Temperature::min_temp_error(const int8_t heater) { | ||
_temp_error(heater, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, heater)); | ||
_temp_error(heater, PSTR(MSG_T_MINTEMP), TEMP_PSTR(MSG_ERR_MINTEMP, heater)); | ||
} | ||
|
||
float Temperature::get_pid_output(const int8_t e) { | ||
|
@@ -949,6 +949,10 @@ void Temperature::manage_heater() { | |
#endif | ||
|
||
HOTEND_LOOP() { | ||
#ifdef HEATER_KILL_TEMP | ||
if (degHotend(e) > HEATER_KILL_TEMP) | ||
max_temp_error(e); | ||
#endif | ||
|
||
#if HEATER_IDLE_HANDLER | ||
hotend_idle[e].update(ms); | ||
|
@@ -965,7 +969,7 @@ void Temperature::manage_heater() { | |
// Make sure temperature is increasing | ||
if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder? | ||
if (degHotend(e) < watch_hotend[e].target) // Failed to increase enough? | ||
_temp_error(e, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e)); | ||
_temp_error(e, PSTR(MSG_T_HEATING_FAILED), TEMP_PSTR(MSG_HEATING_FAILED_LCD, e)); | ||
else // Start again if the target is still far off | ||
start_watching_heater(e); | ||
} | ||
|
@@ -1001,11 +1005,16 @@ void Temperature::manage_heater() { | |
|
||
#if HAS_HEATED_BED | ||
|
||
#ifdef BED_KILL_TEMP | ||
if (degBed() > BED_KILL_TEMP) | ||
max_temp_error(-1); | ||
#endif | ||
|
||
#if WATCH_BED | ||
// Make sure temperature is increasing | ||
if (watch_bed.elapsed(ms)) { // Time to check the bed? | ||
if (degBed() < watch_bed.target) // Failed to increase enough? | ||
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1)); | ||
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_PSTR(MSG_HEATING_FAILED_LCD, -1)); | ||
else // Start again if the target is still far off | ||
start_watching_bed(); | ||
} | ||
|
@@ -1075,7 +1084,7 @@ void Temperature::manage_heater() { | |
// Make sure temperature is increasing | ||
if (watch_chamber.elapsed(ms)) { // Time to check the chamber? | ||
if (degChamber() < watch_chamber.target) // Failed to increase enough? | ||
_temp_error(-2, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -2)); | ||
_temp_error(-2, PSTR(MSG_T_HEATING_FAILED), TEMP_PSTR(MSG_HEATING_FAILED_LCD, -2)); | ||
else | ||
start_watching_chamber(); // Start again if the target is still far off | ||
} | ||
|
@@ -1689,7 +1698,7 @@ void Temperature::init() { | |
sm.state = TRRunaway; | ||
|
||
case TRRunaway: | ||
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater_id)); | ||
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_PSTR(MSG_THERMAL_RUNAWAY, heater_id)); | ||
} | ||
} | ||
|
||
|
@@ -2646,11 +2655,7 @@ void Temperature::isr() { | |
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) | ||
void Temperature::set_heating_message(const uint8_t e) { | ||
const bool heating = isHeatingHotend(e); | ||
#if HOTENDS > 1 | ||
ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1)); | ||
#else | ||
ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING)); | ||
#endif | ||
ui.set_status_P(heating ? TEMP_PSTR(MSG_HEATING, e) : TEMP_PSTR(MSG_COOLING, e)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect this to bloat the size of the binary more than the original code because it produces up to 12 PROGMEM strings where the previous code only generates 2 no matter how many hotends are present. |
||
} | ||
#endif | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tend not to do this kind of appending of strings because in some languages the order of subject-object-modifier is completely different, and we don't want to impose our English-centric word ordering on everyone. That is why the intent here was to concatenate to get the right translation string name and use the translated string which has the correct word-ordering.