/*######################################
* CHANGE LISTENERS
######################################*/
xLcd.valueProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue ov, Object oldValue, Object newValue) {
double tmp = TinygDriver.getInstance().machine.getAxisByName("y").getWorkPosition().doubleValue() + 5;
}
});
yLcd.valueProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue ov, Object oldValue, Object newValue) {
double tmp = TinygDriver.getInstance().machine.getAxisByName("y").getWorkPosition().doubleValue() + 5;
}
});
TinygDriver.getInstance().machine.getGcodeUnitMode().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue ov, Object oldValue, Object newValue) {
String tmp = TinygDriver.getInstance().machine.getGcodeUnitMode().get();
// gcodeUnitMode.getSelectionModel().select(TinygDriver.getInstance().m.getGcodeUnitModeAsInt());
if (TinygDriver.getInstance().machine.getGcodeUnitModeAsInt() == 0) {
//A bug in the jfxtras does not allow for units to be updated.. we hide them if they are not mm
xLcd.lcdUnitVisibleProperty().setValue(false);
yLcd.lcdUnitVisibleProperty().setValue(false);
zLcd.lcdUnitVisibleProperty().setValue(false);
aLcd.lcdUnitVisibleProperty().setValue(false);
velLcd.lcdUnitVisibleProperty().setValue(false);
} else {
xLcd.lcdUnitVisibleProperty().setValue(true);
yLcd.lcdUnitVisibleProperty().setValue(true);
zLcd.lcdUnitVisibleProperty().setValue(true);
aLcd.lcdUnitVisibleProperty().setValue(true);
velLcd.lcdUnitVisibleProperty().setValue(true);
}
tgfx.Main.postConsoleMessage("[+]Gcode Unit Mode Changed to: " + tmp + "\n");
try {
TinygDriver.getInstance().serialWriter.setThrottled(true);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_1_SETTINGS);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_2_SETTINGS);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_3_SETTINGS);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_4_SETTINGS);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_X);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_Y);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_Z);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_A);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_B);
TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_C);
Thread.sleep(400);
TinygDriver.getInstance().serialWriter.setThrottled(false);
} catch (Exception ex) {
logger.error("Error querying tg model state on gcode unit change. Main.java binding section.");
}
}
});
cncMachine.heightProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue o, Object oldVal,
Object newVal) {
logger.info("cncHeightChanged: " + cncMachine.getHeight());
// Main.print(cncHeightString
}
});
cncMachine.maxWidthProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue ov, Object oldValue, Object newValue) {
handleMaxWithChange();
}
});
cncMachine.maxHeightProperty()
.addListener(new ChangeListener() {
@Override
public void changed(ObservableValue ov, Object oldValue, Object newValue) {
handleMaxHeightChange();
}
});