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
18 changes: 18 additions & 0 deletions calibration.html
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ <h4>Temperatures</h4>
<p>For the hot end and bed respectively, typical PLA temperatures are 200 and 60, PETG 235 and 80, ABS 250 and 100, TPU 230 and 5 (effectively off).</p>
<label>Hot end temperature (deg C): <input type="number" name="hotendtemp" value="200" min="160" max="450"></label>
<label>Bed temperature (deg C): <input type="number" name="bedtemp" value="60" min="5" max="150"></label><br />

<h4>Part Cooling Fan</h4>
<p>PLA typically has the part cooling fan come on from layer 2. Alter this default behaviour here:</p>
<label for="pc">Select part cooling fan behaviour:</label>
Expand All @@ -737,6 +738,16 @@ <h4>Auto Bed Levelling</h4>
<option value="4">Prusa Mini - Only heat nozzle to 170, then G29</option>
<option value="5">Unified Bed Leveling - Load Saved Mesh then 3 Probe Tilt </option>
</select>

<h4>Firmware</h4>
<span><label>G-code flavor:</label>
<select name="flavor">
<option value="0">Marlin</option>
<option value="1">RRF</option>
</select>
</span> <br />
<label>Firmware Retraction : <input type="checkbox" name="firmwareRetraction"></label><br />

<h4>Retraction</h4>
<p>For initial tests, you can leave the retraction speed at 40 mm/sec. For a bowden tube printer, 6mm is a likely retraction distance. For direct drive, a starting value of 1mm may be suitable. Vary either side of this for each segment.</p>
<table>
Expand All @@ -749,6 +760,7 @@ <h4>Retraction</h4>
<th>Extra restart distance (mm)</th>
<th>Prime (unretract) speed (mm/sec)</th>
<th>Z hop (mm)</th>
<th>Linear Advance</th>
</tr>
</thead>
<tbody>
Expand All @@ -762,6 +774,7 @@ <h4>Retraction</h4>
<td><input type="number" min="-10" max="10" name="ret_f3" value="0" step="0.1"></td>
<td><input type="number" min="5" max="200" name="ret_f4" value="40" step="1"></td>
<td><input type="number" min="0" max="5" name="ret_f5" value="0" step="0.1"></td>
<td><input type="number" min="0" max="5" name="ret_f6" value="0" step="0.1"></td>
</tr>
<tr>
<td style="text-align: center;">E</td>
Expand All @@ -770,6 +783,7 @@ <h4>Retraction</h4>
<td><input type="number" min="-10" max="10" name="ret_e3" value="0" step="0.1"></td>
<td><input type="number" min="5" max="200" name="ret_e4" value="40" step="1"></td>
<td><input type="number" min="0" max="5" name="ret_e5" value="0" step="0.1"></td>
<td><input type="number" min="0" max="5" name="ret_e6" value="0" step="0.1"></td>
</tr>
<tr>
<td style="text-align: center;">D</td>
Expand All @@ -778,6 +792,7 @@ <h4>Retraction</h4>
<td><input type="number" min="-10" max="10" name="ret_d3" value="0" step="0.1"></td>
<td><input type="number" min="5" max="200" name="ret_d4" value="40" step="1"></td>
<td><input type="number" min="0" max="5" name="ret_d5" value="0" step="0.1"></td>
<td><input type="number" min="0" max="5" name="ret_d6" value="0" step="0.1"></td>
</tr>
<tr>
<td style="text-align: center;">C</td>
Expand All @@ -786,6 +801,7 @@ <h4>Retraction</h4>
<td><input type="number" min="-10" max="10" name="ret_c3" value="0" step="0.1"></td>
<td><input type="number" min="5" max="200" name="ret_c4" value="40" step="1"></td>
<td><input type="number" min="0" max="5" name="ret_c5" value="0" step="0.1"></td>
<td><input type="number" min="0" max="5" name="ret_c6" value="0" step="0.1"></td>
</tr>
<tr>
<td style="text-align: center;">B</td>
Expand All @@ -794,6 +810,7 @@ <h4>Retraction</h4>
<td><input type="number" min="-10" max="10" name="ret_b3" value="0" step="0.1"></td>
<td><input type="number" min="5" max="200" name="ret_b4" value="40" step="1"></td>
<td><input type="number" min="0" max="5" name="ret_b5" value="0" step="0.1"></td>
<td><input type="number" min="0" max="5" name="ret_b6" value="0" step="0.1"></td>
</tr>
<tr>
<td style="text-align: center;">A</td>
Expand All @@ -802,6 +819,7 @@ <h4>Retraction</h4>
<td><input type="number" min="-10" max="10" name="ret_a3" value="0" step="0.1"></td>
<td><input type="number" min="5" max="200" name="ret_a4" value="40" step="1"></td>
<td><input type="number" min="0" max="5" name="ret_a5" value="0" step="0.1"></td>
<td><input type="number" min="0" max="5" name="ret_a6" value="0" step="0.1"></td>
</tr>
</tbody>
</table>
Expand Down
135 changes: 111 additions & 24 deletions js/gcodeprocessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,35 @@ function toggleJ() {
}
}

function buildFirmwareRetraction(retraction , tag, flavor, v1, v2, v3, v4, v5){

var ret = new RegExp(";retraction"+tag, 'g');
var unret = new RegExp(";unretraction"+tag, 'g');

if (flavor == "0") {
retraction = retraction.replace(ret ,"M207 S"+ v1 + " F" + v2 + " Z"+ v5 +" ; custom firmware retraction - "+tag + '\n' + "G10 ; custom firmware retraction - "+ tag);
var distance = Math.round( (parseFloat(v1) + parseFloat(v3))*100)/100;
retraction = retraction.replace(unret, "M208 S"+ distance + " F" + v4 + " ; custom firmware un-retraction - " + tag+ '\n' + "G11 ; custom firmware un-retraction - "+ tag);
}else if (flavor == "1" ){
retraction = retraction.replace(ret,"M207 S"+ v1 + " R" + v3 + " F" + v2 + " T"+v4 + " Z"+ v5 +" ; custom firmware retraction - "+tag + '\n' + "G10 ; custom firmware retraction - " + tag);
retraction = retraction.replace(unret, "G11 ; custom firmware un-retraction/prime - "+tag);
}
return retraction;

}

function buildLinearAdvance(retraction , tag, flavor, v6){

var linear = new RegExp(";linearAdv"+tag, 'g');

if (flavor == "0") {
retraction = retraction.replace(linear ,"M900 K"+ v6 +" ; custom linear advance - "+tag );
}else if (flavor == "1" ){
retraction = retraction.replace(linear,"M572 D0 S"+ v6 +" ; custom pressure advance - "+tag );
}
return retraction;
}

function processFirstlayer(){
var hotendTemp = document.firstlayerForm.hotendtemp.value;
var bedTemp = document.firstlayerForm.bedtemp.value;
Expand Down Expand Up @@ -357,32 +386,43 @@ function processRetraction(){
var a3 = document.retractionForm.ret_a3.value;
var a4 = document.retractionForm.ret_a4.value*60;
var a5 = document.retractionForm.ret_a5.value;
var a6 = document.retractionForm.ret_a6.value;
var b1 = document.retractionForm.ret_b1.value;
var b2 = document.retractionForm.ret_b2.value*60;
var b3 = document.retractionForm.ret_b3.value;
var b4 = document.retractionForm.ret_b4.value*60;
var b5 = document.retractionForm.ret_b5.value;
var b6 = document.retractionForm.ret_b6.value;
var c1 = document.retractionForm.ret_c1.value;
var c2 = document.retractionForm.ret_c2.value*60;
var c3 = document.retractionForm.ret_c3.value;
var c4 = document.retractionForm.ret_c4.value*60;
var c5 = document.retractionForm.ret_c5.value;
var c6 = document.retractionForm.ret_c6.value;
var d1 = document.retractionForm.ret_d1.value;
var d2 = document.retractionForm.ret_d2.value*60;
var d3 = document.retractionForm.ret_d3.value;
var d4 = document.retractionForm.ret_d4.value*60;
var d5 = document.retractionForm.ret_d5.value;
var d6 = document.retractionForm.ret_d6.value;
var e1 = document.retractionForm.ret_e1.value;
var e2 = document.retractionForm.ret_e2.value*60;
var e3 = document.retractionForm.ret_e3.value;
var e4 = document.retractionForm.ret_e4.value*60;
var e5 = document.retractionForm.ret_e5.value;
var e6 = document.retractionForm.ret_e6.value;
var f1 = document.retractionForm.ret_f1.value;
var f2 = document.retractionForm.ret_f2.value*60;
var f3 = document.retractionForm.ret_f3.value;
var f4 = document.retractionForm.ret_f4.value*60;
var f5 = document.retractionForm.ret_f5.value;
var f6 = document.retractionForm.ret_f6.value;
var customStart = document.retractionForm.startgcode.value;
var firmwareRetraction = document.retractionForm.firmwareRetraction.checked;
if (firmwareRetraction){
var flavor = document.retractionForm.flavor.value;
}

var retraction = originalRetraction;
switch(pc){
case '0':
Expand Down Expand Up @@ -481,41 +521,88 @@ function processRetraction(){
}
}
// A section
retraction = retraction.replace(/;retractionA/g, "G1 E-"+a1+" F"+a2+" ; custom retraction - A");
retraction = retraction.replace(/;unretractionA/g, "G1 E"+a3+" F"+a4+" ; custom un-retraction/prime - A");
if(a5 > 0){
retraction = retraction.replace(/;zhopupA/g, "G91\nG1 Z"+a5+" F1200 ; custom z hop - A\nG90");
if (firmwareRetraction){
retraction = buildFirmwareRetraction(retraction, "A" , flavor, a1, a2, a3, a4, a5);
}else{
retraction = retraction.replace(/;retractionA/g, "G1 E-"+a1+" F"+a2+" ; custom retraction - A");
retraction = retraction.replace(/;unretractionA/g, "G1 E"+a3+" F"+a4+" ; custom un-retraction/prime - A");
if(a5 > 0){
retraction = retraction.replace(/;zhopupA/g, "G91\nG1 Z"+a5+" F1200 ; custom z hop - A\nG90");
}
}
if (a6 > 0){
retraction = buildLinearAdvance(retraction, "A", flavor, a6)
}
// B section
retraction = retraction.replace(/;retractionB/g, "G1 E-"+b1+" F"+b2+" ; custom retraction - B");
retraction = retraction.replace(/;unretractionB/g, "G1 E"+b3+" F"+b4+" ; custom un-retraction/prime - B");
if(b5 > 0){
retraction = retraction.replace(/;zhopupB/g, "G91\nG1 Z"+b5+" F1200 ; custom z hop - B\nG90");
if (firmwareRetraction){
retraction = buildFirmwareRetraction(retraction, "B" , flavor, b1, b2, b3, b4, b5);
}else{
retraction = retraction.replace(/;retractionB/g, "G1 E-"+b1+" F"+b2+" ; custom retraction - B");
retraction = retraction.replace(/;unretractionB/g, "G1 E"+b3+" F"+b4+" ; custom un-retraction/prime - B");
if(b5 > 0){
retraction = retraction.replace(/;zhopupB/g, "G91\nG1 Z"+b5+" F1200 ; custom z hop - B\nG90");
}
}
if (b6 > 0){
retraction = buildLinearAdvance(retraction, "B", flavor, b6)
}

// C section
retraction = retraction.replace(/;retractionC/g, "G1 E-"+c1+" F"+c2+" ; custom retraction - C");
retraction = retraction.replace(/;unretractionC/g, "G1 E"+c3+" F"+c4+" ; custom un-retraction/prime - C");
if(c5 > 0){
retraction = retraction.replace(/;zhopupC/g, "G91\nG1 Z"+c5+" F1200 ; custom z hop - C\nG90");
if (firmwareRetraction){
retraction = buildFirmwareRetraction(retraction, "C" , flavor, c1, c2, c3, c4, c5);
}else{
retraction = retraction.replace(/;retractionC/g, "G1 E-"+c1+" F"+c2+" ; custom retraction - C");
retraction = retraction.replace(/;unretractionC/g, "G1 E"+c3+" F"+c4+" ; custom un-retraction/prime - C");
if(c5 > 0){
retraction = retraction.replace(/;zhopupC/g, "G91\nG1 Z"+c5+" F1200 ; custom z hop - C\nG90");
}
}
if (c6 > 0){
retraction = buildLinearAdvance(retraction, "C", flavor, c6)
}

// D section
retraction = retraction.replace(/;retractionD/g, "G1 E-"+d1+" F"+d2+" ; custom retraction - D");
retraction = retraction.replace(/;unretractionD/g, "G1 E"+d3+" F"+d4+" ; custom un-retraction/prime - D");
if(d5 > 0){
retraction = retraction.replace(/;zhopupD/g, "G91\nG1 Z"+d5+" F1200 ; custom z hop - D\nG90");
if (firmwareRetraction){
retraction = buildFirmwareRetraction(retraction, "D" , flavor, d1, d2, d3, d4, d5);
}else{
retraction = retraction.replace(/;retractionD/g, "G1 E-"+d1+" F"+d2+" ; custom retraction - D");
retraction = retraction.replace(/;unretractionD/g, "G1 E"+d3+" F"+d4+" ; custom un-retraction/prime - D");
if(d5 > 0){
retraction = retraction.replace(/;zhopupD/g, "G91\nG1 Z"+d5+" F1200 ; custom z hop - D\nG90");
}
}
if (d6 > 0){
retraction = buildLinearAdvance(retraction, "D", flavor, d6)
}

// E section
retraction = retraction.replace(/;retractionE/g, "G1 E-"+e1+" F"+e2+" ; custom retraction - E");
retraction = retraction.replace(/;unretractionE/g, "G1 E"+e3+" F"+e4+" ; custom un-retraction/prime - E");
if(e5 > 0){
retraction = retraction.replace(/;zhopupE/g, "G91\nG1 Z"+e5+" F1200 ; custom z hop - E\nG90");
if (firmwareRetraction){
retraction = buildFirmwareRetraction(retraction, "E" , flavor, e1, e2, e3, e4, e5);
}else{
retraction = retraction.replace(/;retractionE/g, "G1 E-"+e1+" F"+e2+" ; custom retraction - E");
retraction = retraction.replace(/;unretractionE/g, "G1 E"+e3+" F"+e4+" ; custom un-retraction/prime - E");
if(e5 > 0){
retraction = retraction.replace(/;zhopupE/g, "G91\nG1 Z"+e5+" F1200 ; custom z hop - E\nG90");
}
}
if (e6 > 0){
retraction = buildLinearAdvance(retraction, "E", flavor, e6)
}

// F section
retraction = retraction.replace(/;retractionF/g, "G1 E-"+f1+" F"+f2+" ; custom retraction - F");
retraction = retraction.replace(/;unretractionF/g, "G1 E"+f3+" F"+f4+" ; custom un-retraction/prime - F");
if(f5 > 0){
retraction = retraction.replace(/;zhopupF/g, "G91\nG1 Z"+f5+" F1200 ; custom z hop - F\nG90");
if (firmwareRetraction){
retraction = buildFirmwareRetraction(retraction, "F" , flavor, f1, f2, f3, f4, f5);
}else{
retraction = retraction.replace(/;retractionF/g, "G1 E-"+f1+" F"+f2+" ; custom retraction - F");
retraction = retraction.replace(/;unretractionF/g, "G1 E"+f3+" F"+f4+" ; custom un-retraction/prime - F");
if(f5 > 0){
retraction = retraction.replace(/;zhopupF/g, "G91\nG1 Z"+f5+" F1200 ; custom z hop - F\nG90");
}
}
if (f6 > 0){
retraction = buildLinearAdvance(retraction, "F", flavor, f6)
}

if(document.retractionForm.psuon.checked == true) {
retraction = retraction.replace(/;M80/, "M80");
}
Expand Down
6 changes: 6 additions & 0 deletions js/retraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ G28 ; home all axes
T0
G92 E0.0000
;retractionA
;linearAdvA
; feature skirt
; tool H0.200 W0.576
;zhopupA
Expand Down Expand Up @@ -15899,6 +15900,7 @@ G1 X71.719 Y49.716 E0.7317
G1 X71.660 Y49.357 E0.7448
G1 X71.640 Y48.994 E0.7579
G92 E0.0000
;linearAdvB
;retractionB
; feature inner perimeter
;zhopupB
Expand Down Expand Up @@ -27165,6 +27167,7 @@ G1 X71.719 Y49.716 E0.7317
G1 X71.660 Y49.357 E0.7448
G1 X71.640 Y48.994 E0.7579
G92 E0.0000
;linearAdvC
;retractionC
; feature inner perimeter
;zhopupC
Expand Down Expand Up @@ -38431,6 +38434,7 @@ G1 X71.719 Y49.716 E0.7317
G1 X71.660 Y49.357 E0.7448
G1 X71.640 Y48.994 E0.7579
G92 E0.0000
;linearAdvD
;retractionD
; feature inner perimeter
;zhopupD
Expand Down Expand Up @@ -49694,6 +49698,7 @@ G1 X71.719 Y49.716 E0.7317
G1 X71.660 Y49.357 E0.7448
G1 X71.640 Y48.994 E0.7579
G92 E0.0000
;linearAdvE
;retractionE
; feature inner perimeter
;zhopupE
Expand Down Expand Up @@ -60957,6 +60962,7 @@ G1 X71.719 Y49.716 E0.7317
G1 X71.660 Y49.357 E0.7448
G1 X71.640 Y48.994 E0.7579
G92 E0.0000
;linearAdvF
;retractionF
; feature inner perimeter
;zhopupF
Expand Down