Skip to content
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

[1.1.x] M303 thermal runaway protection #8209

Merged
merged 2 commits into from Nov 3, 2017

Conversation

RowanMeara
Copy link
Contributor

@RowanMeara RowanMeara commented Nov 2, 2017

Currently, thermal runaway protection is not available during PID autotuning.
If someone were to plug in their printer's thermistors incorrectly and run M303, serious damage could occur. Although this is not a common problem, I still think it is worth addressing due to issues like #8103.

To add thermal protection to M303, I needed to reimpliment most of the hotend watching logic inside PID_autotune. This led to an increase in size of 812 bytes (115,950->116,762) which is not a problem on my arduino mega but seems like a significant amount of space for 128K boards.

I'd like some feedback on my code and the following:

  1. Do people think this is worth including in Marlin?
  2. If so, should I create an option in the advanced config file for it?

@RowanMeara RowanMeara changed the title M303 thermal runaway protection [1.1.x] M303 thermal runaway protection Nov 2, 2017
@@ -394,6 +427,16 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
#endif

temp_ms = ms + 2000UL;

#if WATCH_THE_BED || WATCH_HOTENDS
heated = heated || input > watch_temp_target;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Copy link
Contributor Author

@RowanMeara RowanMeara Nov 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see I should have been more clear about what my pull request actually does.

Normally when a heater is on, thermal protection currently functions by ensuring that:

  • The heater continually makes progress until the target temperature is reached
  • Once the target temperature is reached, the temperature does not stray outside a specified range

Currently during M303, the only guarantee is that straying outside the min and max temperature range results in an error. My pull request ensures that the above two conditions are also guaranteed during PID tuning.

Currently, thermal runaway protection is not available during M303.
Therefore, if someone plugs the thermistors in incorrectly and goes to
autotune their printer, the printer temperature could runaway and damage
could occur.
@RowanMeara
Copy link
Contributor Author

I see I should have been more clear about what my pull request actually does.

Normally when a heater is on, thermal protection currently functions by ensuring that:

  • The heater continually makes progress until the target temperature is reached
  • Once the target temperature is reached, the temperature does not stray outside a specified range

Currently during M303, the only guarantee is that straying outside the min and max temperature range results in an error. My pull request ensures that the above two conditions are also guaranteed during PID tuning.


#if WATCH_THE_BED || WATCH_HOTENDS
if (!heated && input > next_watch_temp) {
if (input > watch_temp_target) heated = true;
Copy link
Member

@thinkyhead thinkyhead Nov 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original line (and lack of sleep) had me confused. This accomplishes the same thing without being too much like my usual obfuscated coding style.

@thinkyhead thinkyhead merged commit 39cc36d into MarlinFirmware:bugfix-1.1.x Nov 3, 2017
mtm88001 pushed a commit to mtm88001/Marlin that referenced this pull request Dec 9, 2017
* Added M303 thermal runaway protection

Currently, thermal runaway protection is not available during M303.
Therefore, if someone plugs the thermistors in incorrectly and goes to
autotune their printer, the printer temperature could runaway and damage
could occur.

* Replace removed line, clarifying its logic
damicreabox pushed a commit to damicreabox/Marlin that referenced this pull request Sep 14, 2018
* Added M303 thermal runaway protection

Currently, thermal runaway protection is not available during M303.
Therefore, if someone plugs the thermistors in incorrectly and goes to
autotune their printer, the printer temperature could runaway and damage
could occur.

* Replace removed line, clarifying its logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants