Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions calibration.html
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,8 @@ <h6 id="fl" >First layer gcode generator</h6>
<!-- firstlayerForm -->
<form name="firstlayerForm" id="firstlayerForm" onsubmit="return false;">
<script>
createForm("firstlayer");
createForm("firstlayer");
</script>
<p><input type="button" onclick="processGcode(form)" value="Download Gcode"></p>
<p><input type="button" onclick="resetFormToDefaults(form)" value="Reset parameters"> <input type="button" onclick="outputSettings(form)" value="Output Settings Summary"></p>
</form>
<h2>Interpreting Results:</h2>
<p>Please use the following video as a guide to this test:</p>
Expand All @@ -324,10 +322,8 @@ <h6 id="bl">Baseline test print generator</h6>
<!-- baselineForm -->
<form name="baselineForm" id="baselineForm" onsubmit="return false;">
<script>
createForm("baseline");
createForm("baseline");
</script>
<p><input type="button" onclick="processGcode(form)" value="Download Gcode"></p>
<p><input type="button" onclick="resetFormToDefaults(form)" value="Reset parameters"> <input type="button" onclick="outputSettings(form)" value="Output Settings Summary"></p>
</form>
<h2>Interpreting Results:</h2>
<p>Please use the following video as a guide to this test:</p>
Expand Down Expand Up @@ -752,8 +748,6 @@ <h6 id="ret">Retraction tuning tower generator</h6>
<script>
createForm("retraction");
</script>
<p><input type="button" onclick="processGcode(form)" value="Download Gcode"></p>
<p><input type="button" onclick="resetFormToDefaults(form)" value="Reset parameters"> <input type="button" onclick="outputSettings(form)" value="Output Settings Summary"></p>
</form>
<h2>Interpreting Results:</h2>
<p>Please use the following video as a guide to this test:</p>
Expand Down Expand Up @@ -810,8 +804,6 @@ <h6 id="tmp">Temperature tuning tower generator</h6>
<script>
createForm("temperature");
</script>
<p><input type="button" onclick="processGcode(form)" value="Download Gcode"></p>
<p><input type="button" onclick="resetFormToDefaults(form)" value="Reset parameters"> <input type="button" onclick="outputSettings(form)" value="Output Settings Summary"></p>
</form>
<h2>Interpreting Results:</h2>
<p>Please use the following video as a guide to this test:</p>
Expand Down Expand Up @@ -922,8 +914,6 @@ <h6 id="acc">Acceleration & jerk/junction deviation tuning tower generator</h6>
<script>
createForm("acceleration");
</script>
<p><input type="button" onclick="processGcode(form)" value="Download Gcode"></p>
<p><input type="button" onclick="resetFormToDefaults(form)" value="Reset parameters"> <input type="button" onclick="outputSettings(form)" value="Output Settings Summary"></p>
<p class="warning">This gcode will raise the acceleration limits (<a href="https://marlinfw.org/docs/gcode/M201.html" target="_blank">M201</a>), set acceleration (<a href="https://marlinfw.org/docs/gcode/M204.html" target="_blank">M204</a>) and set junction deviation/jerk (<a href="https://marlinfw.org/docs/gcode/M205.html" target="_blank">M205</a>) 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.</p>
</form>
<h2>Interpreting Results:</h2>
Expand Down
4 changes: 1 addition & 3 deletions js/commongcode.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 9 additions & 1 deletion js/createform.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,13 @@ var endGcode = /*html*/ `<h4>Additional end gcode</h4>

var preview = /*html*/ `<p>It is advised to preview the generated gcode through your slicer or <a href="http://zupfe.velor.ca" target="_blank">Zupfe GCode Viewer</a> before printing.`;

var downloadGcodeHtml = /*html*/ `<h4>Download</h4>
<p><label>Filename: <input type="text" name="{formName}_filename" value="{formName}"></label></p>
<p><input type="button" onclick="downloadGcode(form, form['{formName}_filename'].value)" value="Download Gcode"></p>
<p><input type="button" onclick="resetFormToDefaults(form)" value="Reset parameters">
<input type="button" onclick="downloadSettings(form, form['{formName}_filename'].value)" value="Output Settings Summary"></p>
`;

function createForm(n){
document.write('<input type="hidden" name="description" value="'+n+'">')
document.write(nozzleLayer);
Expand Down Expand Up @@ -495,4 +502,5 @@ function createForm(n){
}
document.write(endGcode);
document.write(preview);
}
document.write(downloadGcodeHtml.replaceAll('{formName}', n));
}
66 changes: 35 additions & 31 deletions js/gcodeprocessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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);
}