Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g-code defaults to mm not meters, allow offset #110

Open
wants to merge 1 commit into
base: dde4
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions src/job_engine/core/gcode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
globalThis.Gcode = class Gcode{
static print_gcode_line_when_run = true
static scale = .001 //units are mm, convert to meters
static offset = [0,100,80] //xyz offset in mm

static state = {
Y_offset: 0.1,
X: 0,
Expand Down Expand Up @@ -64,8 +67,11 @@ globalThis.Gcode = class Gcode{
let y_pos = this.state.Y
y_pos += this.state.Y_offset
if(y_pos === 0) { y_pos = 1e-10 }//to avoid singularity
let xyz = [this.state.X, y_pos, this.state.Z]

let xyz = [
( this.state.X + this.offset[0] ) * this.scale,
( y_pos + this.offset[1] ) * this.scale,
( this.state.Z + this.offset[2] ) * this.scale
]
return [ function() { Gcode.extrude()},
Dexter.move_to(xyz)
]
Expand Down