Command to wait for cooling

  • I use PS_ON to control my printer's 12V circuit, and in particular, my hot end fan. So at the end of the print, I'd like to automatically run M81 to shut off the power supply. I don't want to do this while the hot end is still hot, so I would like my end g-code to wait until the hot end is below (say) 150 Celsius. Is there a good way to do this?

    Currently I use M109 S150. This does work, but as the hot end approaches the requested temperature, the PID temperature control kicks in and the heater turns on, slowing the cooling to reduce overshoot. Lately it has gotten worse, perhaps because the heater is better tuned for ~200 C, and the PID loop hovers around 153 C for a while before eventually cooling to the goal temperature. All this is of course unnecessary; I just want to wait until the temperature is below 150 C. Marlin had a G-code extension to allow this specific request, I believe it was M109 R150, but that definitely doesn't work in RepRapFirmware.

    There's another, less important use case - waiting for the heated bed to cool before switching off my big cooling fan and signaling to the user that the print should be cool and easy to detach from the bed. Or, going the other direction, commanding the heated bed to 65 C and then waiting until it reached 50 C to start the hot end heater. I realize G-code should not become a full programming language, but a "wait for temperature above/below/stable" command, as well as a UI way to interrupt such, would be helpful.

  • administrators

    Would it be sufficient to add an option to the M81 command to delay turning power off until all thermostatic fans have turned off?

  • That would be a nice solution.

    Of course, there's a can of worms here - I'd actually be happy if the power turned off whenever the machine was idle and cold (motors on idle, all thermostatic fans low, no commands in the queue) but that's a bit complicated if you're worried about motors losing track of microstep positions. At that point I'd also wish for the power to be turned on whenever there were commands in the queue or nonzero temperature settings, and then I'd practically never have to use explicit M80/M81 commands. But simply allowing a "wait to power down" solves my specific case.

    Alternatively, perhaps adding some options to M116 ("Wait") would be an approach to this sort of thing? Right now it just waits for some or all temperatures to reach their setpoints, but if you could ask it to wait until the temperature of heater n was at its target, above T, or below T, that would cover almost all imaginable "wait for temperature" possibilities. That plus a systematic way to interrupt waits or other in-progress actions would cover a wide range of possible scripting setups.

  • administrators

    R and S parameters for the M109, M190 and M191 commands are now supported in RRF 1.17-dev1. See for details. Caution: I do minimal testing on dev builds.

  • Thanks! I'll take a look once I'm not tinkering with anything else.

Log in to reply