Bed‑cleaning/object‑ejection script

Hi, I need help with a bed‑cleaning/object‑ejection script. 
I’ve got all the movement part working—I can handle that—but the issue is the waiting time.

I’ve run into the following problems:

The M190 R command seems to ship with a built‑in 15‑minute timeout on most installations, yet the bed needs nearly an hour to cool to 30 °C for a safe removal. Even adding the T (timeout) parameter is ignored. Re‑flashing the firmware without that timeout isn’t an option.

I then tried several scripting approaches but hit other issues.
The while‑loops that poll the bed temperature and don’t exit until it reaches 30 °C can’t run for more than X seconds before they’re flagged as infinite loops and the server kills them.
All the @wait options in Repetier‑Server are useless here because they only work while a print job is active.

So I’m out of options.
I even spun up a fresh ChatGPT instance loaded with the full manual—Server Commands, Computed Expressions, Firmware G‑codes, Regular Expressions, etc.—as its knowledge base, and it still couldn’t provide a satisfactory solution.

I believe this is a good opportunity to add native support in Repetier for this very useful feature (removing objects from the bed). In the meantime, I’d appreciate any ideas the developer might have on how to achieve it.


I can’t manage something as simple as: waiting for the bed to reach 30 °C before continuing with the rest of the instructions.

Comments

  • https://chatgpt.com/g/g-N7hbE7sKR-repetier-server-script-helper

    I’m sharing my custom ChatGPT version with all the documentation preloaded.
  • edited July 15
    Depth Search ChatGPT found the reason... a extract...

    Possible "timeout" or premature jump: Some versions of Marlin had a safety condition where, if the temperature didn’t drop fast enough, the M190 R command could abort the wait to avoid an infinite loop. By default, Marlin defines parameters like MIN_COOLING_SLOPE_DEG_BED (e.g., 1.5 °C) and MIN_COOLING_SLOPE_TIME_BED (e.g., 60 s) as cooling criteria. For example, if the bed doesn’t cool by at least ~1-2 degrees in 60 seconds, it assumes it won’t cool further (perhaps due to a hot room) and proceeds with the G-code (reddit.com). In some cases, this caused the printer to not wait for the desired temperature and move on prematurely. A user identified this as a firmware bug and suggested recompiling Marlin, increasing the time limit from 60 s to 600 s (10 min) or more (reddit.com). This gives a larger margin before canceling the wait. The ideal solution is to adjust these parameters in the firmware if you can compile it. If not, the alternative is to “trick” the system: for example, as shown, add manual pauses (G4 S...) to ensure cooling, or use multiple staggered M190 R steps (R60, then R50, etc., with pauses) instead of a single one. Keep this behavior in mind if you notice your printer isn’t waiting fully.



  • ChatGPT recommends that but doesn't work because while loop have watchdog

    ; Wait until the bed temperature drops below 30°C
    @while [bedTemp] >= 30
      ; Print current bed temperature message
      @echo Waiting for bed to cool below 30°C. Current temperature: [bedTemp]
      ; Wait for 10 seconds before checking again
      G4 S10
    @endwhile
    ; Temperature condition met
    @echo Bed temperature is now below 30°C
  • edited July 16
    Conditions in [] ar enot correct syntax. Timneout 15 or 30 minures can also come from server assuming it missed the ok when it takes so long. I would suggest a simple delay with G4 which server recognices and does not timeout until it is finished. Something like

    M140 S0
    G4 S{{min(1, (bed_0.temp - 30) * 100)}}
    @sync
    M190 R
    Adjust the  * 100 so it waits until you know you are close to target temperature and just catch the last degrees with M190.

Sign In or Register to comment.