End of filament - Gcode to use for pause and resume?


I am searching for an ideal gcode to use when Octoprint detects the end of filament.

My equipment:

  • I have a Artillery Genius,
  • my filament sensor is plugged on my pi,
  • and I have installed the plugin Enclosure in Octoprint (it detects well the filament in or out)

I am searching for the gcode to have this behaviour :

  • pause of the printing while Octoprint detects a end of filament
  • keep the temperatures for the tool0 and bed
  • the Z goes up of 50mm
  • unload of filament
  • octoprint is waiting for us to change the filament, and we click on "load filament"
  • once done, we can click on "resume printing"

Have someone a gcode to share for the "pause after a end of filament" and "resume after" ?

I went on reprap.org, but I don't understand everything. And I haven't found this type of gcode, sure my searches are not the best :frowning:

Any help would be appreciated :wink: