diff --git a/calibration.html b/calibration.html index 95e18c6..09a64c3 100644 --- a/calibration.html +++ b/calibration.html @@ -294,10 +294,8 @@
Please use the following video as a guide to this test:
@@ -324,10 +322,8 @@Please use the following video as a guide to this test:
@@ -752,8 +748,6 @@
Please use the following video as a guide to this test:
@@ -810,8 +804,6 @@
Please use the following video as a guide to this test:
@@ -922,8 +914,6 @@
This gcode will raise the acceleration limits (M201), set acceleration (M204) and set junction deviation/jerk (M205) for the purposes of the test. If you print another job afterwards these higher values will still be in place. If you are unsure how to restore your previous values, the easiest thing to do is to power cycle the printer.
It is advised to preview the generated gcode through your slicer or Zupfe GCode Viewer before printing.`; +var downloadGcodeHtml = /*html*/ `
+
+`; + function createForm(n){ document.write('') document.write(nozzleLayer); @@ -495,4 +502,5 @@ function createForm(n){ } document.write(endGcode); document.write(preview); -} \ No newline at end of file + document.write(downloadGcodeHtml.replaceAll('{formName}', n)); +} diff --git a/js/gcodeprocessing.js b/js/gcodeprocessing.js index 1e5f6d1..9f717d3 100644 --- a/js/gcodeprocessing.js +++ b/js/gcodeprocessing.js @@ -118,7 +118,6 @@ function updateFeedsTower(feedrate) { function processGcode(formName) { var name = formName.name; - var description = formName.description.value; var nozzleLayer = formName.nozzleLayer.value; var bedTemp = formName.bedtemp.value; var centre = formName.centre.checked; @@ -600,37 +599,14 @@ function processGcode(formName) { if(formName.deltaHome.checked == true) { gcode = gcode.replace(/G28 X0 ; home X axis/, "G28 ; home all on delta"); } - - // process finished gcode file - downloadFile(description+'.gcode', gcode); + + return gcode; } function outputSettings(formName) { - var fileName; - var string = "Settings for "; - switch(formName.name) { - case "firstlayerForm": - string += "first layer" - fileName = "firstlayersettings.txt"; - break; - case "baselineForm": - string += "baseline print" - fileName = "baselinesettings.txt"; - break; - case "retractionForm": - string += "retraction tuning" - fileName = "retractionsettings.txt"; - break; - case "temperatureForm": - string += "temperature tuning" - fileName = "temperaturesettings.txt"; - break; - case "accelerationForm": - string += "acceleration and jerk/junction deviation tuning" - fileName = "accelerationsettings.txt"; - break; - } - string += " form\n_________________________________________________________________________\n\n"; + var string = ""; + string += "Settings for " + formName.description.value + " form\n"; + string += "_________________________________________________________________________\n\n"; string += "G-Code originally generated by Simplify3D(R) Version 4.1.2\nThis calibration test gcode modified by the Teaching Tech Calibration website: https://teachingtechyt.github.io/calibration.html\n"; string += "All changes are marked in the gcode with 'custom' at the end of each line. Open the gcode in a text editor and search for this to your check inputs if needed.\n\n"; @@ -728,6 +704,34 @@ function outputSettings(formName) { string += " B | "+formName.accel_b1.value+" mm/sec/sec | "+formName.accel_b4.value+"\n"; string += " A | "+formName.accel_a1.value+" mm/sec/sec | "+formName.accel_a4.value+"\n"; } - } - downloadFile(fileName, string); + } + return string; +} + + +function downloadGcode(form, fileName) { + var gcode = processGcode(form); + var settings = outputSettings(form); + + // process finished gcode file + if (!fileName) { + fileName = form.description.value; + } + fileName += ".gcode"; + + var output = ""; + // prefix each line with ; to indicate comment + output += "; " + settings.replaceAll("\n", "\n; "); + output += gcode; + downloadFile(fileName, output); +} + +function downloadSettings(form, fileName) { + var settings = outputSettings(form); + + if (!fileName) { + fileName = form.description.value; + } + fileName += "settings.txt"; + downloadFile(fileName, settings); }