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
9 changes: 8 additions & 1 deletion js/createform.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ var tempTower = /*html*/ `<h4>Bed Temperature</h4>
<label>Bed temperature (deg C): <input type="number" name="bedtemp" value="60" min="0" max="150"></label> (use 0 for a non heated bed)
<h4>Hot end temperature</h4>
<p>Typically, filament comes with a recommended hot end temperature. It is recommended to use values either side of this. For instance, if a PLA filament asked for 200 degrees, you may vary the temperature from 190, 195, 200, 205, 210 (the default values of the form). Typically, the first layer temperature will be elevated to increase adhesion with the bed, especially if a lower than usual temperature is being trialled for segment A. <span class="sug">Suggested increments for how much to vary the value for each segment are shown in green.</span></p>
<p>Some filaments do prefer little cooling or no cooling you might as well fine tune fan settings for a given temperature</p>
<table>
<thead>
<tr>
<th>Reference Diagram</th>
<th>Segment</th>
<th>Hot end temperature<p class="sug">&#177; 5 - 10</p></th>
<th>Part Cooling Fan<p class="sug">&#177; 0 - 100</p></th>
</tr>
</thead>
<tbody>
Expand All @@ -192,22 +194,27 @@ var tempTower = /*html*/ `<h4>Bed Temperature</h4>
</td>
<td style="text-align: center;">E</td>
<td><input type="number" min="150" max="450" name="temp_e1" value="210"></td>
<td><input type="number" min="150" max="450" name="fan_e1" value="100"></td>
</tr>
<tr>
<td style="text-align: center;">D</td>
<td><input type="number" min="150" max="450" name="temp_d1" value="205"></td>
<td><input type="number" min="150" max="450" name="fan_d1" value="100"></td>
</tr>
<tr>
<td style="text-align: center;">C</td>
<td><input type="number" min="150" max="450" name="temp_c1" value="200"></td>
<td><input type="number" min="150" max="450" name="fan_c1" value="100"></td>
</tr>
<tr>
<td style="text-align: center;">B</td>
<td><input type="number" min="150" max="450" name="temp_b1" value="195"></td>
<td><input type="number" min="150" max="450" name="fan_b1" value="100"></td>
</tr>
<tr>
<td style="text-align: center;">A</td>
<td><input type="number" min="150" max="450" name="temp_a1" value="190"></td>
<td><input type="number" min="150" max="450" name="fan_a1" value="100"></td>
</tr>
<tr>
<td style="text-align: center;">First layer</td>
Expand Down Expand Up @@ -475,7 +482,7 @@ function createForm(n){
}
if(n == "firstlayer"){
document.write(pcFirstlayer);
} else {
} else if(n != "temperature"){
document.write(pcReg);
}
if(n == "retraction"){
Expand Down
67 changes: 42 additions & 25 deletions js/gcodeprocessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,23 @@ function processGcode(formName) {
var abl = formName.abl.value;
var customStart = formName.startgcode.value;
var customEnd = formName.endgcode.value;
if(name != "firstlayerForm"){
if(name != "firstlayerForm" && name != "temperatureForm"){
var fanLayer = formName.fanLayer.value;
var fanPercentage = formName.fanSpeed.value;
var fanSpeed = Math.round(fanPercentage*2.55);
}
if(name == "temperatureForm"){ // collect temperature tower inputs
var hotendTemp = formName.temp_a0.value;
var a1 = formName.temp_a1.value;
var aFan1 = formName.fan_a1.value;
var b1 = formName.temp_b1.value;
var bFan1 = formName.fan_b1.value;
var c1 = formName.temp_c1.value;
var cFan1 = formName.fan_c1.value;
var d1 = formName.temp_d1.value;
var dFan1 = formName.fan_d1.value;
var e1 = formName.temp_e1.value;
var eFan1 = formName.fan_e1.value;
} else {
var hotendTemp = formName.hotendtemp.value;
}
Expand Down Expand Up @@ -394,20 +399,25 @@ function processGcode(formName) {
if(name != "firstlayerForm"){
// strip original fan command
gcode = gcode.replace(/M106 S3/, ";");
// insert user fan starting layer and speed
switch(fanLayer){
case '2':
gcode = gcode.replace(/;fan2;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 2");
break;
case '3':
gcode = gcode.replace(/;fan3;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 3");
break;
case '5':
gcode = gcode.replace(/;fan5;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 5");
break;

// temperature form does overwrite fan behavior
if (name != "temperatureForm") {
// insert user fan starting layer and speed
switch(fanLayer){
case '2':
gcode = gcode.replace(/;fan2;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 2");
break;
case '3':
gcode = gcode.replace(/;fan3;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 3");
break;
case '5':
gcode = gcode.replace(/;fan5;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 5");
break;
}
// insert user fan speed for resumption after 100% bridging
gcode = gcode.replace(/M106 S3/g, "M106 S"+fanSpeed+"; custom fan "+fanSpeed+"%");
}
// insert user fan speed for resumption after 100% bridging
gcode = gcode.replace(/M106 S3/g, "M106 S"+fanSpeed+"; custom fan "+fanSpeed+"%");

// process gcode to suit bed size and type
if(centre == true){
var gcodeArray = gcode.split(/\n/g);
Expand Down Expand Up @@ -576,11 +586,18 @@ function processGcode(formName) {
}
// temperature test user inputs
if(name == "temperatureForm"){
gcode = gcode.replace(/;layer 2(.*?)\n/, "M104 S"+a1+" T0 ; custom hot end temp - A\n");
gcode = gcode.replace(/;process Process-2/, "M104 S"+b1+" T0 ; custom hot end temp - B");
gcode = gcode.replace(/;process Process-3/, "M104 S"+c1+" T0 ; custom hot end temp - C");
gcode = gcode.replace(/;process Process-4/, "M104 S"+d1+" T0 ; custom hot end temp - D");
gcode = gcode.replace(/;process Process-5/, "M104 S"+e1+" T0 ; custom hot end temp - E");
function temperatureAndFanSpeed(segment, temp, fan) {
var speed = Math.round(fan*2.55);

return "M104 S"+temp+" T0 ; custom hot end temp - " + segment + "\n" +
"M106 S"+speed+"; custom fan "+fan+"% - " + segment + "\n";
}

gcode = gcode.replace(/;layer 2(.*?)\n/, temperatureAndFanSpeed("A", a1, aFan1));
gcode = gcode.replace(/;process Process-2/, temperatureAndFanSpeed("B", b1, bFan1));
gcode = gcode.replace(/;process Process-3/, temperatureAndFanSpeed("C", c1, aFan1));
gcode = gcode.replace(/;process Process-4/, temperatureAndFanSpeed("D", d1, dFan1));
gcode = gcode.replace(/;process Process-5/, temperatureAndFanSpeed("E", e1, eFan1));
}
}

Expand Down Expand Up @@ -676,17 +693,17 @@ function outputSettings(formName) {
string += "\n\nTemperatures:\n";
if(formName.name == "temperatureForm") {
string += "Bed: "+formName.bedtemp.value+" deg C\n";
string += "Segment E: "+formName.temp_e1.value+" deg C\n";
string += "Segment D: "+formName.temp_d1.value+" deg C\n";
string += "Segment C: "+formName.temp_c1.value+" deg C\n";
string += "Segment B: "+formName.temp_b1.value+" deg C\n";
string += "Segment A: "+formName.temp_a1.value+" deg C\n";
string += "Segment E: "+formName.temp_e1.value+" deg C | Fan: "+formName.fan_e1.value+"%\n";
string += "Segment D: "+formName.temp_d1.value+" deg C | Fan: "+formName.fan_d1.value+"%\n";
string += "Segment C: "+formName.temp_c1.value+" deg C | Fan: "+formName.fan_c1.value+"%\n";
string += "Segment B: "+formName.temp_b1.value+" deg C | Fan: "+formName.fan_b1.value+"%\n";
string += "Segment A: "+formName.temp_a1.value+" deg C | Fan: "+formName.fan_a1.value+"%\n";
string += "First Layer: "+formName.temp_a0.value+" deg C\n";
} else {
string += "Bed: "+formName.bedtemp.value+" deg C\n";
string += "Hot end: "+formName.hotendtemp.value+" deg C\n";
}
if(formName.name != "firstlayerForm") {
if(formName.name != "firstlayerForm" && formName.name != "temperatureForm") {
var fanSpeed = formName.fanSpeed.value;
var fanLayer = formName.fanLayer.value
string += "\n\nPart Cooling: "+fanSpeed+"% from layer "+fanLayer+"\n";
Expand Down