Fix wonky generation on retraction prints

Was subtracting only integer part of gcode, which inverts the fractional part and produces jagged lines whenever X or Y becomes negative.
This commit is contained in:
Jamie
2020-08-16 15:26:10 -05:00
committed by GitHub
parent 625619e8c9
commit 6f51701c34

View File

@ -234,17 +234,17 @@ function processRetraction(){
if(centre == true){
var retractionArray = retraction.split(/\n/g);
var regexp = /X\d+/;
var regexp = /X[0-9\.]+/;
retractionArray.forEach(function(index, item){
if(retractionArray[item].search(/X/) > -1){
var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) - 50;
var value = parseFloat(retractionArray[item].match(regexp)[0].substring(1)) - 50;
retractionArray[item] = retractionArray[item].replace(regexp, "X"+String(value));
}
});
var regexp = /Y\d+/;
var regexp = /Y[0-9\.]+/;
retractionArray.forEach(function(index, item){
if(retractionArray[item].search(/Y/) > -1){
var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) - 50;
var value = parseFloat(retractionArray[item].match(regexp)[0].substring(1)) - 50;
retractionArray[item] = retractionArray[item].replace(regexp, "Y"+String(value))
}
});
@ -537,4 +537,4 @@ function processAcceleration(){
acceleration = acceleration.replace(/j6/g, "M205 J"+f4);
}
downloadFile('acceleration.gcode', acceleration);
}
}