Skip to content

[1.1.x] Add new capability to report if Thermal Protection is enabled#10465

Merged
thinkyhead merged 2 commits intoMarlinFirmware:bugfix-1.1.xfrom
andrivet:add_cap_thermal_protection
Apr 20, 2018
Merged

[1.1.x] Add new capability to report if Thermal Protection is enabled#10465
thinkyhead merged 2 commits intoMarlinFirmware:bugfix-1.1.xfrom
andrivet:add_cap_thermal_protection

Conversation

@andrivet
Copy link
Contributor

Description

This code add a new capability to report if Thermal Protection is enabled (value 1) or not (value 0). Capabilities are reported by the M115 command. Thermal Protection is a feature of Marlin and is enabled with THERMAL_PROTECTION_HOTENDS and THERMAL_PROTECTION_BED macros.

The idea behind this new capability is to increase the awareness of users regarding Thermal Protection and the danger to disable it. Thanks to this new capability, software such as OctoPrint (more precisely the Printer Safety Check plugin) will be able to warn users when Thermal Protection is not enabled in the firmware.

Benefits

It is a very minor and simple modification and it can increase the awareness of users regarding Thermal Protection and the danger to disable it.

Related Issues

  • A PR will be submitted to OctoPrint to detect this new capability and warn users.
  • A PR will be submitted to a firmware based on Marlin: ADVi3++ (I am the author).

@thinkyhead thinkyhead force-pushed the bugfix-1.1.x branch 3 times, most recently from 0bebc14 to 0c1be96 Compare April 20, 2018 18:19
@thinkyhead
Copy link
Member

thinkyhead commented Apr 20, 2018

Capabilities are not so much for announcing features, but to tell the host that it can or should modify its behavior to accommodate the feature. Thermal protection doesn't change any behavior w/r/t hosts, nor does it add any G-codes.

@MarlinFirmware/host-software-team — Will this be useful to your efforts?

@foosel
Copy link
Contributor

foosel commented Apr 20, 2018

While I agree that this is less of a capability relevant for the protocol layer and more a case of making the blackbox that is the firmware less blackboxy, it certainly would help a lot in identifying printers with unsafe configuration down the road (once this migrates a bit through the various forks) and educate/warn users accordingly. The constant flow of "Oops, an Anet A8 caught fire" posts on social media show that there's not a whole lot of awareness on this.

In fact, I suggested to @andrivet to send a PR upstream when he approached me about adding this report to his own fork and if he hadn't filed this PR, I would have.

@andrivet
Copy link
Contributor Author

andrivet commented Apr 20, 2018

@thinkyhead Even if I understand your point of view, I think that in some cases, this PR fit the "tell the host that it can or should modify its behavior to accommodate the feature". In case of my firmware (ADVi3++), the user has the possibility to enable or disable the Thermal Runaway Protection (it is ON by default). So the new capability allow the host (such as OctoPrint) accommodate to this. But it is true it is a corner case.

In response to `M115` the firmware reports if Thermal Protection is enabled (value 1) or not (value 0). This information can be used by software such as OctoPrint (more precisely the Printer Safety Check plugin) to warn users when Thermal Protection is not enabled in the firmware.
@thinkyhead
Copy link
Member

Naturally. My post doesn't reflect my own point-of-view, per se. Part of my role is to state counter-examples, consider potential points-of-view, and solicit feedback while keeping my own view in suspension (as far as that is possible).

Since this is obviously useful going forward, I support it. But note that it could be a year or more before vendors start shipping machines with Marlin 1.1.9, and if they fail to enable the capabilities report, or if they alter the report to suppress the host warning, then hosts and users will still be in the dark.

So, if I may play the Devil's advocate again…
Should hosts report "WARNING! Thermal Protection may not be enabled! Please contact the vendor." for all machines that fail to report Cap: THERMAL_PROTECTION 1, even those that are out there now that may have thermal protection enabled, and which don't present the capability?

@andrivet
Copy link
Contributor Author

In my mind "your point of view" means the point of view of Marlin Team, the point of view of your role.

For your question ("Should hosts report "WARNING!..."), for me the answer is clearly no. The host has to report WARNING only if the capability is 0. Not if the capability is not there.

@thinkyhead
Copy link
Member

…a putative point of view floating in the aether…

@thinkyhead thinkyhead merged commit 4cc2bc1 into MarlinFirmware:bugfix-1.1.x Apr 20, 2018
thinkyhead added a commit that referenced this pull request Apr 20, 2018
Based on #10465

In response to `M115` the firmware reports if Thermal Protection is enabled (1) or not (0). This information can be used by software such as OctoPrint (more precisely the Printer Safety Check plugin) to warn users when Thermal Protection is not enabled in the firmware.

Co-Authored-By: andrivet <sebastien@advtools.com>
@andrivet andrivet deleted the add_cap_thermal_protection branch April 20, 2018 22:09
@repetier
Copy link

repetier commented Apr 22, 2018

If I see this correctly, you now start mixing capability with configuration.
Not sure if this is the right way. Capabilities are fixed and do not change while firmware are running. Hosts will check them at startup and do not expect them to change.

On the other side thermal protection can change. In repetier-firmware you can disable it if required and @andrivet also made it changeable if I understood him correctly.

In the sense of capability report it would make more sense that this only announces that a certain set of M codes is supported to query if it is enabled and maybe even to enable/disable them so hosts can offer a switch in case they see it is enabled. For configurations there is M360 in repetier-firmware that reports its configuration. I guess Marlin has a similar command.

Then it would make sense to show a warning in host that it currently disabled knowing that firmware allows enabling.

This function is surely an important point as it is a security function. And having a security checklist in hosts might be a good thing to have in future. One problem are as always old firmwares. And we all should know that there are users not daring to update firmwares and vendors never updating, while others offer updates. So each check we want to implement has four states:

  1. Can not determine
  2. Known but disabled
  3. Changeable and disabled
  4. Changeable and enabled

Not having a capability is 1). Cap 0 is 2) and 3 and 4 should be cap 1 determinable and changeable by commands.

Knowing many vendors they also might want to enforce 4) removing the changeable option as it is their reputation that goes when users can disable safety features.

@andrivet
Copy link
Contributor Author

When I made this PR, my intention was not to treat this as a configuration (something that can change often), but as a capability (something the host can check at startup). It is true that the user can change it while running, but we can assume that the user will not change this again and again. It is enough to warn her about the danger when booting. Again, I agree that this is a corner case.

@thinkyhead
Copy link
Member

thinkyhead commented Apr 26, 2018

Capabilities are fixed and do not change while firmware are running.

Yes, capabilities will announce to the host, for example, that there's a light on the printer that can be turned on and off. The light is assumed by the host to be there if the capability announces it, so the host knows it can always turn it on and off.

For configurations there is M360 … I guess Marlin has a similar command.

There's no command in Marlin to announce configuration. It would be a prohibitively large number of strings to fit on modest boards such as the common Melzi.

So each check we want to implement has four states…

A fifth state is missing: "Always enabled."

On the other side thermal protection can change.

No. The thermal runaway values set in the configuration are fixed and cannot be altered by G-code. Once thermal protection is enabled in Marlin and flashed, it is always turned on for all heating operations and cannot be disabled by a host. That is as it should be.

I realize you're not proposing an extension to M115 Capabilities, but your list does suggest one would be possible. Instead of just Cap:SOME_FEATURE:0 and Cap:SOME_FEATURE:1 it could use other code numbers to indicate the disposition of the capability.

@foosel
Copy link
Contributor

foosel commented Apr 26, 2018

Should hosts report "WARNING! Thermal Protection may not be enabled! Please contact the vendor." for all machines that fail to report Cap: THERMAL_PROTECTION 1, even those that are out there now that may have thermal protection enabled, and which don't present the capability?

No. But if the host reports Cap:THERMAL_PROTECTION and it's set to 0, displaying a warning should be fair game.

But note that it could be a year or more before vendors start shipping machines with Marlin 1.1.9, and if they fail to enable the capabilities report, or if they alter the report to suppress the host warning, then hosts and users will still be in the dark.

Yep, agreed. Based on past observations of vendor firmware though, I'd not be surprised if they'd happily disable thermal runaway protection for better stability with sub par sensors but leave this report in. Least effort approach, as always ;)

@foosel
Copy link
Contributor

foosel commented Apr 26, 2018

@repetier is there documentation available for the M360 output on Repetier Firmware? I got reports of a couple of printers shipped with more or less stock Repetier Firmware, but with thermal runaway protection disabled. Being able to query the configuration in any way would possibly allow me to identify those even though they are otherwise indistinguishable from safe stock versions.

@repetier
Copy link

@thinkyhead Capabilities are fixed. 0 = know it bot do not support, 1 = support. If it is clearly stated in the description on http://reprap.org/wiki/Firmware_Capabilities_Protocol there is problem adding a 2 as e.g. switchable through commands xy. Speaking of the wiki, could you add the new capabilities so we host developers still have a 1 place checkup page to see if we catched all or if there are new ones we should start supporting.

@foosel At the moment there is no report of this setting except if you query eeprom and that may change description/position especially if V2 is ready. I think I will switch over to report it as capability and make it non changeable once the exact format is known. Regarding testing firmware settings you can always have a look at repetier.xml in firmware folder in server installation. It shows how we query for settings of repetier-firmware. Here as copy the current config with it's regular expressions:

    <getSettings>
    M115
    M205
    M27
    M106 S20
    M107
    M105
    M360
    </getSettings>
    <setting type="xPrintAcceleration">Config:XPrintAccel:(\d+\.?\d*)</setting>
    <setting type="yPrintAcceleration">Config:YPrintAccel:(\d+\.?\d*)</setting>
    <setting type="zPrintAcceleration">Config:ZPrintAccel:(\d+\.?\d*)</setting>
    <setting type="xPrintAcceleration"> (\d+\.?\d*) X-axis acceleration</setting>
    <setting type="yPrintAcceleration"> (\d+\.?\d*) Y-axis acceleration</setting>
    <setting type="zPrintAcceleration"> (\d+\.?\d*) Z-axis acceleration</setting>
    <setting type="xPrintAcceleration"> (\d+\.?\d*) acceleration </setting>
    <setting type="yPrintAcceleration"> (\d+\.?\d*) acceleration </setting>
    <setting type="zPrintAcceleration"> (\d+\.?\d*) acceleration </setting>
    <setting type="xTravelAcceleration">Config:XTravelAccel:(\d+\.?\d*)</setting>
    <setting type="yTravelAcceleration">Config:YTravelAccel:(\d+\.?\d*)</setting>
    <setting type="zTravelAcceleration">Config:ZTravelAccel:(\d+\.?\d*)</setting>
    <setting type="xTravelAcceleration"> (\d+\.?\d*) X-axis travel acceleration</setting>
    <setting type="yTravelAcceleration"> (\d+\.?\d*) Y-axis travel acceleration</setting>
    <setting type="zTravelAcceleration"> (\d+\.?\d*) Z-axis travel acceleration</setting>
    <setting type="xTravelAcceleration"> (\d+\.?\d*) travel acceleration</setting>
    <setting type="yTravelAcceleration"> (\d+\.?\d*) travel acceleration</setting>
    <setting type="zTravelAcceleration"> (\d+\.?\d*) travel acceleration</setting>

    <setting type="xyJerk"> (\d+\.?\d*) Max. jerk</setting>
    <setting type="zJerk"> (\d+\.?\d*) Max. Z-jerk</setting>
    <setting type="maxXSpeed"> (\d+\.?\d*) X-axis max. feedrate</setting>
    <setting type="maxYSpeed"> (\d+\.?\d*) Y-axis max. feedrate</setting>
    <setting type="maxZSpeed"> (\d+\.?\d*) Z-axis max. feedrate</setting>
    <setting type="maxXSpeed"> (\d+\.?\d*) Max. feedrate</setting>
    <setting type="maxYSpeed"> (\d+\.?\d*) Max. feedrate</setting>
    <setting type="maxZSpeed"> (\d+\.?\d*) Max. feedrate</setting>

    <setting type="XStepsPerMM"> (\d+\.?\d*) X-axis steps per mm</setting>
    <setting type="YStepsPerMM"> (\d+\.?\d*) Y-axis steps per mm</setting>
    <setting type="ZStepsPerMM"> (\d+\.?\d*) Z-axis steps per mm</setting>
    <setting type="XMin"> ([+-]?\d+\.?\d*) X (home|min) pos \[mm\]</setting>
    <setting type="YMin"> ([+-]?\d+\.?\d*) Y (home|min) pos \[mm\]</setting>
    <setting type="ZMin"> ([+-]?\d+\.?\d*) Z (home|min) pos \[mm\]</setting>
    <setting type="XLength"> (\d+\.?\d*) X max length \[mm\]</setting>
    <setting type="YLength"> (\d+\.?\d*) Y max length \[mm\]</setting>
    <setting type="ZLength"> (\d+\.?\d*) Z max length \[mm\]</setting>
    <setting type="baudrate"> (\d+) Baudrate</setting>
    <setting type="extrStepsPerMM" indexAdd="-1" index=" Extr.(\d+) "> (\d+\.?\d*) Extr.\d+ steps per mm</setting>
    <setting type="extrMaxSpeed" indexAdd="-1" index=" Extr.(\d+) "> (\d+\.?\d*) Extr.\d+ max. feedrate \[mm/s\]</setting>
    <setting type="extrJerk" indexAdd="-1" index=" Extr.(\d+) "> (\d+\.?\d*) Extr.\d+ start feedrate \[mm/s\]</setting>
    <setting type="extrAcceleration" indexAdd="-1" index=" Extr.(\d+) "> (\d+\.?\d*) Extr.\d+ acceleration \[mm/s\^2\]</setting>
    <setting type="hasHeatedBed" value="1"> B:\d+.?\d* </setting>
    <setting type="printableRadius"> (\d+\.?\d*) Max printable radius</setting>
    <setting type="printerType" value="1">Z\-axis acceleration</setting>
    <setting type="printerType" value="2">Diagonal rod length</setting>
    <setting type="extruderCountSend">EXTRUDER_COUNT:\s*(\d+)</setting>
    <setting type="sdInstalled" value="1">^SD printing byte</setting>
    <setting type="fansInstalled" value="1">^Fanspeed:</setting>
    <setting type="fansInstalled" value="1">^Config:Fan:(\d)</setting>
    <setting type="fansInstalled" value="1">^Config:Fan2:(\d)</setting>
    <setting type="fansInstalled">^Config:NumFans:(\d)</setting>
    <setting type="mixingExtruder">^Config:MixingExtruder:(\d)</setting>
    <setting type="hasHeatedBed">^Config:HeatedBed:(\d)</setting>
    <setting type="hasHeatedChamber">^Config:HeatedChamber:(\d)</setting>
    <setting type="LCD">^Config:LCD:(\d)</setting>
    <setting type="sdInstalled">^Config:SDCard:(\d)</setting>
    <setting type="softwarePowerSwitch">^Config:SoftwarePowerSwitch:(\d)</setting>
    <setting type="supportG10G11">^Config:SupportG10G11:(\d)</setting>
    <setting type="supportLocalFilamentchange">^Config:SupportLocalFilamentchange:(\d)</setting>
    <setting type="CaseLights">^Config:CaseLights:(\d)</setting>
    <setting type="EEPROM">^Config:EEPROM:(\d)</setting>
    <setting type="Autolevel">^Config:Autolevel:(\d)</setting>
    <setting type="ZProbe">^Config:ZProbe:(\d)</setting>
    <setting type="baudrate">^Config:Baudrate:(\d+)</setting>
    <setting type="InputBuffer">^Config:InputBuffer:(\d+)</setting>
    <setting type="extruderCountSend">^Config:NumExtruder:(\d+)</setting>
    <setting type="PrintlineCache">^Config:PrintlineCache:(\d+)</setting>
    <setting type="printerType" value="1">Config:PrinterType:Cartesian</setting>
    <setting type="printerType" value="2">^Config:PrinterType:Delta</setting>
    <setting type="XMin">^Config:XMin:([+-]?\d+\.?\d*)</setting>
    <setting type="YMin">^Config:YMin:([+-]?\d+\.?\d*)</setting>
    <setting type="ZMin">^Config:ZMin:([+-]?\d+\.?\d*)</setting>
    <setting type="XMax">^Config:XMax:([+-]?\d+\.?\d*)</setting>
    <setting type="YMax">^Config:YMax:([+-]?\d+\.?\d*)</setting>
    <setting type="ZMax">^Config:ZMax:([+-]?\d+\.?\d*)</setting>
    <setting type="XLength">^Config:XSize:([+-]?\d+\.?\d*)</setting>
    <setting type="YLength">^Config:YSize:([+-]?\d+\.?\d*)</setting>
    <setting type="ZLength">^Config:ZSize:([+-]?\d+\.?\d*)</setting>
    <setting type="XHomeDir">^Config:XHomeDir:(\d+)</setting>
    <setting type="YHomeDir">^Config:YHomeDir:(\d+)</setting>
    <setting type="ZHomeDir">^Config:ZHomeDir:(\d+)</setting>
    <setting type="XHomePos">^Config:XHomePos:(\d+)</setting>
    <setting type="YHomePos">^Config:YHomePos:(\d+)</setting>
    <setting type="ZHomePos">^Config:ZHomePos:(\d+)</setting>
    <setting type="xyJerk">^Config:JerkXY:(\d+\.?\d*)</setting>
    <setting type="zJerk">^Config:JerkZ:(\d+\.?\d*)</setting>
    <setting type="RetractionLength">^Config:RetractionLength:(\d+\.?\d*)</setting>
    <setting type="RetractionLongLength">^Config:RetractionLongLength:(\d+\.?\d*)</setting>
    <setting type="RetractionSpeed">^Config:RetractionSpeed:(\d+\.?\d*)</setting>
    <setting type="RetractionZLift">^Config:RetractionZLift:(\d+\.?\d*)</setting>
    <setting type="RetractionUndoExtraLength">^Config:RetractionUndoExtraLength:(\d+\.?\d*)</setting>
    <setting type="RetractionUndoExtraLongLength">^Config:RetractionUndoExtraLongLength:(\d+\.?\d*)</setting>
    <setting type="RetractionUndoSpeed">^Config:RetractionUndoSpeed:(\d+\.?\d*)</setting>
    <setting type="maxBedTemp">^Config:MaxBedTemp:(\d+\.?\d*)</setting>
    <setting type="maxChamberTemp">^Config:MaxChamberTemp:(\d+\.?\d*)</setting>
    <setting type="KeepAliveInterval" valueAdd="1000">^Config:KeepAliveInterval:([+-]?\d+\.?\d*)</setting>
    <setting type="extrMaxSpeed" indexAdd="-1" index=":Extr.(\d+):">Config:Extr.\d+:MaxSpeed:(\d+\.?\d*)</setting>
    <setting type="extrJerk" indexAdd="-1" index=":Extr.(\d+):">Config:Extr.\d+:Jerk:(\d+\.?\d*)</setting>
    <setting type="extrAcceleration" indexAdd="-1" index=":Extr.(\d+):">Config:Extr.\d+:Acceleration:(\d+\.?\d*)</setting>
    <setting type="extrDiameter" indexAdd="-1" index=":Extr.(\d+):">Config:Extr.\d+:Diameter:(\d+\.?\d*)</setting>
    <setting type="extrMaxTemp" indexAdd="-1" index=":Extr.(\d+):">Config:Extr.\d+:MaxTemp:(\d+\.?\d*)</setting>

@thinkyhead
Copy link
Member

Speaking of the wiki, could you add the new capabilities

Done!

foosel added a commit to OctoPrint/OctoPrint that referenced this pull request May 29, 2018
  * Repetier firmware versions prior to 0.92 don't have thermal runaway/
    decouple detection, so we always warn about those
  * If the firmware supports the THERMAL_PROTECTION capability report
    but it's reported as disabled, we also warn about that (see also
    MarlinFirmware/Marlin#10465)
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.

4 participants