diff --git a/js/createform.js b/js/createform.js index 4086a0c..d370596 100644 --- a/js/createform.js +++ b/js/createform.js @@ -65,6 +65,8 @@ var startGcode = /*html*/ `

Additional start gcode

  • Custom ABL sequence. By default, only G28 is present. This gcode will be inserted immediately afer that so custom commands can be used here.Useful for G34 auto stepper alignment and Klipper's Z_TILT_ADJUST.
  • Anything else you have in your start gcode, such as setting acceleration values, E-steps, etc.
  • + +

    This option will remove all start gcode except what is entered in the box below. This means you are responsible for providing commands to home the machine and heat the bed/nozzle. Advanced users only!

    `; @@ -317,6 +319,8 @@ var endGcode = /*html*/ `

    Additional end gcode

    For the majority of users, you can skip this section. Any gcode entered here will be inserted at the very end of the file.

    + +

    This option will remove all end gcode except what is entered in the box below. This means you are responsible for providing commands to shut down all heaters, fans, motors, etc. Advanced users only!

    `; diff --git a/js/gcodeprocessing.js b/js/gcodeprocessing.js index ed2972d..670370f 100644 --- a/js/gcodeprocessing.js +++ b/js/gcodeprocessing.js @@ -261,29 +261,34 @@ function processGcode(formName) { var feedMod = feed/3600; } // process start gcode + var gcode; + if((formName.start.checked == true) && (formName.customStartOnly.checked == true)){ + gcode = ";customstart"; + } else { + gcode = commonStart; + } // bed temp - var gcode = commonStart; if(bedTemp == 0){ - gcode = gcode.replace(/;bed0a/g, "; no heated bed"); - gcode = gcode.replace(/;bed0b/g, "; no heated bed"); + gcode = gcode.replace(/;bed0a/g, "; no heated bed"); + gcode = gcode.replace(/;bed0b/g, "; no heated bed"); } else { gcode = gcode.replace(/;bed0a/g, "M140 S"+bedTemp+" ; custom bed temp"); gcode = gcode.replace(/;bed0b/g, "M190 S"+bedTemp+" ; custom bed temp"); } // start hot end emp if(abl != 4){ - gcode = gcode.replace(/;temp0a/g, "M104 S"+hotendTemp+" T0 ; custom hot end temp"); - gcode = gcode.replace(/;temp0b/g, "M109 S"+hotendTemp+" T0 ; custom hot end temp"); + gcode = gcode.replace(/;temp0a/g, "M104 S"+hotendTemp+" T0 ; custom hot end temp"); + gcode = gcode.replace(/;temp0b/g, "M109 S"+hotendTemp+" T0 ; custom hot end temp"); } else { gcode = gcode.replace(/;temp0a/g, "; Prusa Mini"); gcode = gcode.replace(/;temp0b\n/g, ""); - } + } // abl if(abl == 1){ - gcode = gcode.replace(/;G29 ; probe ABL/, "G29 ; probe ABL"); + gcode = gcode.replace(/;G29 ; probe ABL/, "G29 ; probe ABL"); } if(abl == 2){ - gcode = gcode.replace(/;M420 S1 ; restore ABL mesh/, "M420 S1 ; restore ABL mesh"); + gcode = gcode.replace(/;M420 S1 ; restore ABL mesh/, "M420 S1 ; restore ABL mesh"); } if(abl == 3){ gcode = gcode.replace(/G28 ; home all axes/, "G28 W ; home all without mesh bed level"); @@ -292,7 +297,6 @@ function processGcode(formName) { if(abl == 4){ gcode = gcode.replace(/G28 ; home all axes/, "M109 S170 T0 ; probing temperature\nG28 ; home all"); gcode = gcode.replace(/;G29 ; probe ABL/, "G29 ; probe ABL"); - gcode = gcode.replace(/;M420 S1 ; restore ABL mesh/, "M109 S"+hotendTemp+" T0 ; custom hot end temp"); } if(abl == 5){ @@ -304,6 +308,7 @@ function processGcode(formName) { if(abl == 7){ gcode = gcode.replace(/;G29 ; probe ABL/, "G29 L2 ; Load the mesh stored in slot 1\nG29 J ; Probe 3 points to tilt mesh"); } + // firstlayer test square array if(name == "firstlayerForm"){ var originalSquare = firstlayer[nozzleLayer]; @@ -348,8 +353,12 @@ function processGcode(formName) { if(name == "accelerationForm"){ gcode += acceleration[nozzleLayer]; } - // add end common gcode - gcode += commonEnd; + // add end gcode + if((formName.customEndOnly.checked == true) && (formName.end.checked == true)){ + gcode += ";customend\n"; + } else { + gcode += commonEnd; + } if(name != "firstlayerForm"){ // strip original fan command gcode = gcode.replace(/M106 S3/, ";");