use of com.willwinder.universalgcodesender.firmware.FirmwareSettingsException in project Universal-G-Code-Sender by winder.
the class WizardPanelStepCalibration method updateSettingFieldsFromFirmware.
private void updateSettingFieldsFromFirmware() {
if (getBackend().getController() != null && getBackend().getController().getFirmwareSettings() != null) {
try {
DecimalFormat decimalFormat = new DecimalFormat(DECIMAL_FORMAT_PATTERN, Localization.dfs);
textFieldSettingStepsX.setText(decimalFormat.format(getBackend().getController().getFirmwareSettings().getStepsPerMillimeter(Axis.X)));
textFieldSettingStepsY.setText(decimalFormat.format(getBackend().getController().getFirmwareSettings().getStepsPerMillimeter(Axis.Y)));
textFieldSettingStepsZ.setText(decimalFormat.format(getBackend().getController().getFirmwareSettings().getStepsPerMillimeter(Axis.Z)));
} catch (FirmwareSettingsException e) {
e.printStackTrace();
}
}
}
use of com.willwinder.universalgcodesender.firmware.FirmwareSettingsException in project Universal-G-Code-Sender by winder.
the class WizardPanelHoming method refreshControls.
private void refreshControls() {
ThreadHelper.invokeLater(() -> {
try {
if (getBackend().getController() != null && getBackend().getController().getCapabilities().hasHoming() && getBackend().getController().getCapabilities().hasHardLimits() && getBackend().getController().getFirmwareSettings().isHardLimitsEnabled()) {
IFirmwareSettings firmwareSettings = getBackend().getController().getFirmwareSettings();
checkboxEnableHoming.setSelected(firmwareSettings.isHomingEnabled());
checkboxEnableHoming.setVisible(true);
labelHomingDirection.setVisible(firmwareSettings.isHomingEnabled());
comboBoxInvertDirectionX.setVisible(firmwareSettings.isHomingEnabled());
comboBoxInvertDirectionX.setSelectedIndex(firmwareSettings.isHomingDirectionInverted(Axis.X) ? 1 : 0);
comboBoxInvertDirectionY.setVisible(firmwareSettings.isHomingEnabled());
comboBoxInvertDirectionY.setSelectedIndex(firmwareSettings.isHomingDirectionInverted(Axis.Y) ? 1 : 0);
comboBoxInvertDirectionZ.setVisible(firmwareSettings.isHomingEnabled());
comboBoxInvertDirectionZ.setSelectedIndex(firmwareSettings.isHomingDirectionInverted(Axis.Z) ? 1 : 0);
labelHomingNotSupported.setVisible(false);
labelHardLimitsNotEnabled.setVisible(false);
labelHomingInstructions.setVisible(firmwareSettings.isHomingEnabled());
buttonHomeMachine.setVisible(firmwareSettings.isHomingEnabled());
buttonAbort.setVisible(firmwareSettings.isHomingEnabled());
separatorTop.setVisible(firmwareSettings.isHomingEnabled());
separatorBottom.setVisible(firmwareSettings.isHomingEnabled());
} else if (getBackend().getController() != null && getBackend().getController().getCapabilities().hasHoming() && !getBackend().getController().getFirmwareSettings().isHardLimitsEnabled()) {
checkboxEnableHoming.setVisible(false);
comboBoxInvertDirectionX.setVisible(false);
comboBoxInvertDirectionY.setVisible(false);
comboBoxInvertDirectionZ.setVisible(false);
labelHomingNotSupported.setVisible(false);
labelHardLimitsNotEnabled.setVisible(true);
labelHomingDirection.setVisible(false);
labelHomingInstructions.setVisible(false);
buttonHomeMachine.setVisible(false);
buttonAbort.setVisible(false);
separatorTop.setVisible(false);
separatorBottom.setVisible(false);
} else {
checkboxEnableHoming.setVisible(false);
comboBoxInvertDirectionX.setVisible(false);
comboBoxInvertDirectionY.setVisible(false);
comboBoxInvertDirectionZ.setVisible(false);
labelHomingNotSupported.setVisible(true);
labelHardLimitsNotEnabled.setVisible(false);
labelHomingDirection.setVisible(false);
labelHomingInstructions.setVisible(false);
buttonHomeMachine.setVisible(false);
buttonAbort.setVisible(false);
separatorTop.setVisible(false);
separatorBottom.setVisible(false);
}
} catch (FirmwareSettingsException e) {
NotifyDescriptor nd = new NotifyDescriptor.Message("Couldn't fetch firmware settings: " + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(nd);
}
}, 200);
}
use of com.willwinder.universalgcodesender.firmware.FirmwareSettingsException in project Universal-G-Code-Sender by winder.
the class WizardPanelHoming method createInvertComboBox.
private JComboBox<String> createInvertComboBox(Axis axis) {
JComboBox<String> result = new JComboBox<>();
result.setVisible(false);
result.addItem("+" + axis.name());
result.addItem("-" + axis.name());
result.addActionListener(event -> {
IController controller = getBackend().getController();
if (controller != null) {
try {
controller.getFirmwareSettings().setHomingDirectionInverted(axis, result.getSelectedIndex() == 1);
} catch (FirmwareSettingsException e) {
NotifyDescriptor nd = new NotifyDescriptor.Message("Unexpected error while updating setting: " + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(nd);
}
}
});
return result;
}
use of com.willwinder.universalgcodesender.firmware.FirmwareSettingsException in project Universal-G-Code-Sender by winder.
the class WizardPanelMotorWiring method refreshReverseDirectionCheckboxes.
private void refreshReverseDirectionCheckboxes() {
IController controller = getBackend().getController();
if (controller != null) {
try {
checkboxReverseX.setSelected(controller.getFirmwareSettings().isInvertDirection(Axis.X));
checkboxReverseY.setSelected(controller.getFirmwareSettings().isInvertDirection(Axis.Y));
checkboxReverseZ.setSelected(controller.getFirmwareSettings().isInvertDirection(Axis.Z));
} catch (FirmwareSettingsException e) {
NotifyDescriptor nd = new NotifyDescriptor.Message("Unexpected error while getting setting: " + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(nd);
}
}
}
use of com.willwinder.universalgcodesender.firmware.FirmwareSettingsException in project Universal-G-Code-Sender by winder.
the class NavigationButtons method refresh.
public void refresh(Position machineCoord) {
if (backendAPI.getController() == null || backendAPI.getController().getFirmwareSettings() == null) {
return;
}
try {
IFirmwareSettings firmwareSettings = backendAPI.getController().getFirmwareSettings();
updateNavigationButton(firmwareSettings, Axis.X, machineCoord, buttonXpos, buttonXneg);
updateNavigationButton(firmwareSettings, Axis.Y, machineCoord, buttonYpos, buttonYneg);
updateNavigationButton(firmwareSettings, Axis.Z, machineCoord, buttonZpos, buttonZneg);
} catch (FirmwareSettingsException ignored) {
// Never mind
}
}
Aggregations