So over the past week I've been troubleshooting some issues,

So over the past week I’ve been troubleshooting some issues, missing steps and some USB connection problems, and its required a lot of mid-print restarts. I would like to propose a ‘smart restart’ feature, a big step up from the current ‘restart at line xxx’. I think by scanning the code prior to the requested restart point you can gather enough info to do a proper restart from any arbitrary line. At the moment I do this by hand and make a custom ‘restart’ gcode file by manually editing the original code.

For my printer (and I can’t see why it wouldn’t be the same for others) the process would go like this:

  1. Find the requested restart line.
  2. If the restart line contains any X Y Z or E instructions, store these numbers.
  3. Search backward to find any unknown X Y Z or E numbers. This is usually a few lines back for an E and potentially many lines back to find Z (maybe thousands).
  4. Search backward to find extruder and bed temp (or alternatively prompt for the user to enter these numbers).
  5. Once these numbers are all known, the restart goes something like:
    Home all axes.
    Preheat bed.
    Preheat extruder.
    Prime extruder (has to be in mid air as there is a partial print on the bed, this could be skipped).
    G92 Exxx to preset the extruder position.
    G0 X Y Z
    Execute the restart line.

Apart from needing to search maybe thousands of lines of code to get the missing info, this should be pretty doable as an automated process. It would be SUPER handy!

Thanks for the feedback. I thought about auto detecting all required fields for recovery as well. There are many permutations to the steps described by you. e.g. relative vs absolute positioning, dual extruder,… . I need to look more into it and see what I can do.

Yeah, it will always have its limitations. What about extending the custom macros to allow searching for values like that? Then each person can tweak it for their setup.