diff --git a/calibration.html b/calibration.html index 95e18c6..ad8f3e0 100644 --- a/calibration.html +++ b/calibration.html @@ -294,10 +294,8 @@
First layer gcode generator
-

-

Interpreting Results:

Please use the following video as a guide to this test:

@@ -324,10 +322,8 @@
Baseline test print generator
-

-

Interpreting Results:

Please use the following video as a guide to this test:

@@ -752,8 +748,6 @@
Retraction tuning tower generator
-

-

Interpreting Results:

Please use the following video as a guide to this test:

@@ -810,8 +804,6 @@
Temperature tuning tower generator
-

-

Interpreting Results:

Please use the following video as a guide to this test:

@@ -922,8 +914,6 @@
Acceleration & jerk/junction deviation tuning tower generator
-

-

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.

Interpreting Results:

@@ -1184,14 +1174,20 @@
Speed/feedrate tuning tower generator
-

-

Interpreting Results:

Please use the following video as a guide to this test:

You may wish to stop the print early if it is clear extrusion has ceased or become unreliable. This may prevent the need for disassembly of the extruder to clear the blockage.

+ +
diff --git a/js/commongcode.js b/js/commongcode.js index e110a18..344c6d5 100644 --- a/js/commongcode.js +++ b/js/commongcode.js @@ -1,6 +1,4 @@ -var commonStart = `; G-Code originally generated by Simplify3D(R) Version 4.1.2 -; This calibration test gcode modified by the Teaching Tech Calibration website: https://teachingtechyt.github.io/calibration.html -;M80 ; power supply on +var commonStart = `;M80 ; power supply on G90 M82 M106 S0 diff --git a/js/createform.js b/js/createform.js index 1aea81b..bb2b527 100644 --- a/js/createform.js +++ b/js/createform.js @@ -459,6 +459,27 @@ var endGcode = /*html*/ `

Additional end gcode

var preview = /*html*/ `

It is advised to preview the generated gcode through your slicer or Zupfe GCode Viewer before printing.`; +var downloadGcodeHtml = /*html*/ `

Download

+

+

+

+

+

+ +

Octoprint / Moonraker

+

You can directly print from this website if you specify Octoprint or Moonraker server.

+

+

+
+ + +
+ +`; + function createForm(n){ document.write('') document.write(nozzleLayer); @@ -495,4 +516,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..87b42d7 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,67 @@ 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 getGcodeAndSettings(form) { + var gcode = processGcode(form); + var settings = outputSettings(form); + + var output = ""; + // prefix each line with ; to indicate comment + output += "; " + settings.replaceAll("\n", "\n; "); + output += gcode; + return output; +} + +function downloadGcode(form, fileName) { + if (!fileName) { + fileName = form.description.value; + } + fileName = fileName.trimRight(".gcode"); + fileName += ".gcode"; + + downloadFile(fileName, getGcodeAndSettings(form)); +} + +function downloadSettings(form, fileName) { + if (!fileName) { + fileName = form.description.value; + } + fileName = fileName.trimRight(".gcode"); + fileName += "_settings.txt"; + + downloadFile(fileName, outputSettings(form)); +} + +function uploadGcode(form, fileName) { + var output = getGcodeAndSettings(form); + + if (!form.octoprint_url.value) { + alert("No URL specified for Octoprint or Moonraker."); + return; + } + + // get only basename + if (!fileName) { + fileName = form.description.value; + } + fileName += ".gcode"; + fileName = fileName.split('/').reverse()[0]; + fileName = fileName.trimRight(".gcode"); + fileName += ".gcode"; + + // remove `/` from the end of URL + var url = form.octoprint_url.value.replace(/\/+$/, ''); + url += "/api/files/local"; + + const dataTransfer = new DataTransfer(); + dataTransfer.items.add(new File([output], fileName, {type : 'text/plain'})); + + document.octoprintForm.action = url; + document.octoprintForm.file.files = dataTransfer.files; + document.octoprintForm.apikey.value = form.octoprint_key.value; + document.octoprintForm.submit(); } diff --git a/js/persist.js b/js/persist.js index 548d312..38a03da 100644 --- a/js/persist.js +++ b/js/persist.js @@ -17,6 +17,7 @@ function loadFormData(form) { element.tagName == "INPUT" && element.type == "checkbox" || element.tagName == "INPUT" && element.type == "radio" || element.tagName == "INPUT" && element.type == "text" || + element.tagName == "INPUT" && element.type == "password" || element.tagName == "TEXTAREA" || element.tagName == "SELECT" ) {