From 3c60dddb9d84899a67669aecb8c41b1c0d8af43d Mon Sep 17 00:00:00 2001 From: lawgicau Date: Mon, 19 Jul 2021 16:10:40 +1000 Subject: [PATCH] Add support for speed modifier Z hop speeds and retraction speeds unaltered. --- calibration.html | 4 ++-- js/createform.js | 10 ++++++++-- js/gcodeprocessing.js | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/calibration.html b/calibration.html index e01e22c..d74f230 100644 --- a/calibration.html +++ b/calibration.html @@ -50,8 +50,8 @@
  • 1.75mm filament (However M221 S38 for 2.85 mm filament and M221 S34 for 3.0 mm filament can be applied in the custom start gcode field as compensation)
  • 0.4mm nozzle and 0.2mm layer height, although now additional configurations are now possible
  • Line width on auto, typically 120% of nozzle diameter
  • -
  • Defaut feedrate of 60mm/sec. Modifiers include 60% for perimeters, 80% for solid infill, and 50% first layer.
  • -
  • Travel moves of 100 mm/sec for X/Y and 20 mm/sec for Z
  • +
  • Defaut feedrate of 60mm/sec. Modifiers include 60% for perimeters, 80% for solid infill, 166% travel moves, and 50% for the first layer
  • +
  • Travel moves of 20 mm/sec for Z
  • Flow rate of 0.90. Please see the note on the bottom of the flow tab for instructions on adapting this to your printer.
  • Nozzle priming has been turned off to avoid bed clips or problems with delta printers. Use the custom start gcode feature to insert the priming dequence from your slicer profile.
  • A single layer skirt (except on the acceleration test)
  • diff --git a/js/createform.js b/js/createform.js index 63b51ca..e87559e 100644 --- a/js/createform.js +++ b/js/createform.js @@ -53,7 +53,7 @@ var nozzleLayer = ` var startGcode = `

    Additional start gcode

    -

    If you have additional start commands, tick the box and enter the gcode. This can be used for an extruder prime sequence, overwriting the standard flow rate, standard print speed, compensating for 2.85/3.00 mm filament, setting K factor and more. Tick the box for more details.

    +

    If you have additional start commands, tick the box and enter the gcode. This can be used for an extruder prime sequence, overwriting the standard flow rate, compensating for 2.85/3.00 mm filament, setting K factor and more. Tick the box for more details.

    @@ -63,7 +63,6 @@ var startGcode = `
  • Copying gcode commands from your slicer to draw an intro/prime/purge line. By default this is left out to accommodate delta printers.
  • Telling the firmware to alter the flow rate of the gcode to follow. This does not mean the exact flow rate you have set in your own slicer. For example, using M221 S120 would set the flow rate to 120% of what it was originally sliced as in Simpilfy3D. Use this to compensate for obvious over or under extrusion you may encounter with these tests. Additional information available at the base of the Flow Rate tab.
  • M221 S38 can also be used to compensate for 2.85 mm filament and M221 S34 for 3.00 mm filament instead of the default 1.75 mm.
  • -
  • Telling the firmware to alter the feedrate (print speed). If you need to print more slowly with TPU or faster for another filament, M220 can be used to alter the feedrate. eg. M220 S150 sets all movements to 150% of what is generated in the gcode file. Caution! Also affects retraction speed related movements and overrides the speeds you enter for the acceleration test.
  • Setting the K factor for linear advance. For example, M900 K0.11
  • Custom ABL sequence. By default, only G28 is present. This gcode will be inserted immediately afer that so custom commands can be used here.Useful for G34 auto stepper alignment and Klipper's Z_TILT_ADJUST.
  • Anything else you have in your start gcode, such as setting acceleration values, E-steps, etc.
  • @@ -233,6 +232,11 @@ var retractionTower = `

    Retraction

    `; +var feedrate = `

    Feedrate

    +

    The default printing speed is 60 mm/sec, with modifiers including 60% for perimeters, 80% for solid infill, travel moves 166%, and 50% of these for the first layer. Modify the base feedrate here and the generated gcode will be modified using the same proportions. Please note extruder retraction/unretraction and Z-hop speeds will be unaffected by this.

    +

    +`; + var accel = `

    Base feedrate/speed

    You can specify the feedrate for X and Y movements. The inner perimeter will be set to this speed and the outer perimeter 50% of this speed. It is recommend to follow the process above to calculate safe limits for feedrate.

    @@ -345,6 +349,8 @@ function createForm(n){ } if(n == "acceleration"){ document.write(accel); + } else { + document.write(feedrate); } document.write(endGcode); document.write(preview); diff --git a/js/gcodeprocessing.js b/js/gcodeprocessing.js index 35239f2..4451a24 100644 --- a/js/gcodeprocessing.js +++ b/js/gcodeprocessing.js @@ -248,6 +248,9 @@ function processGcode(formName) { var f3 = formName.accel_f3.value; var f4 = formName.accel_f4.value; var f5 = formName.accel_f5.value; + } else { + var feed = formName.baseFeedrate.value*60; + var feedMod = feed/3600; } // process start gcode // bed temp @@ -398,6 +401,24 @@ function processGcode(formName) { gcode = gcodeArray.join("\n"); } } + // experimental feedrate change + if(name != "accelerationForm"){ + if(feedMod != 1){ + var gcodeArray = gcode.split(/\n/g); + var regexp = /F[0-9]+/; + gcodeArray.forEach(function(index, item){ + if(gcodeArray[item].search(/F/) > -1){ + var value = parseFloat(gcodeArray[item].match(regexp)[0].substring(1)); + //alert(value); + if(value != 1200){ + gcodeArray[item] = gcodeArray[item].replace(regexp, "F"+String(value*feedMod)+" ; custom feedrate") + } + } + }); + gcode = gcodeArray.join("\n"); + } + } + // changes for acceleration test if(name == "accelerationForm"){ // edit feedrates