Skip to content

Commit

Permalink
Check for null tool before tool comparisons (#182)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Agricola <[email protected]>
  • Loading branch information
benagricola authored Dec 17, 2024
1 parent dffe599 commit 5f477ca
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions macro/machine/M4000.g
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ if { param.P >= limits.tools || param.P < 0 }
; This allows us to re-run a file that defines the tool that is currently
; loaded, without unloading the tool.
; This has to be split over multiple lines due to length of the condition.
var toolSame = { global.mosTT[param.P][0] == param.R && tools[param.P].spindle == ((exists(param.I)) ? param.I : global.mosSID) }
if { global.mosTT[param.P] != null && tools[param.P] != null }
var toolSame = { global.mosTT[param.P][0] == param.R && tools[param.P].spindle == ((exists(param.I)) ? param.I : global.mosSID) }

set var.toolSame = { var.toolSame && tools[param.P].name == param.S }
set var.toolSame = { var.toolSame && tools[param.P].name == param.S }

if { exists(param.X) }
set var.toolSame = { var.toolSame && global.mosTT[param.P][1][0] == param.X }
if { exists(param.Y) }
set var.toolSame = { var.toolSame && global.mosTT[param.P][1][1] == param.Y }
if { exists(param.X) }
set var.toolSame = { var.toolSame && global.mosTT[param.P][1][0] == param.X }
if { exists(param.Y) }
set var.toolSame = { var.toolSame && global.mosTT[param.P][1][1] == param.Y }

if { var.toolSame }
M99
if { var.toolSame }
M99

; Define RRF tool against spindle.
; Allow spindle ID to be overridden where necessary using I parameter.
Expand Down

0 comments on commit 5f477ca

Please sign in to comment.