diff --git a/ugs-core/src/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettings.java b/ugs-core/src/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettings.java index fdd5e9d379..31e510ce78 100644 --- a/ugs-core/src/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettings.java +++ b/ugs-core/src/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettings.java @@ -375,7 +375,9 @@ public double getMaximumRate(Axis axis) throws FirmwareSettingsException { public int getMaxSpindleSpeed() throws FirmwareSettingsException { return getSetting(KEY_MAX_SPINDLE_SPEED) .map(FirmwareSetting::getValue) - .map(Integer::valueOf) + .map(value -> value.replaceAll(",", ".")) + .map(Double::valueOf) + .map(Double::intValue) .orElse(0); } diff --git a/ugs-core/test/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettingsTest.java b/ugs-core/test/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettingsTest.java index 4c6da39a9c..64e8d36c03 100644 --- a/ugs-core/test/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettingsTest.java +++ b/ugs-core/test/com/willwinder/universalgcodesender/firmware/grbl/GrblFirmwareSettingsTest.java @@ -360,4 +360,19 @@ public void setInvertDirectionZShouldSetBit() throws FirmwareSettingsException, assertEquals("7", target.getSetting("$3").get().getValue()); } + + @Test + public void getMaxSpindleSpeedShouldReturnIntegerValue() throws FirmwareSettingsException { + target.rawResponseListener("$30=1000.0"); + assertEquals(1000, target.getMaxSpindleSpeed()); + + target.rawResponseListener("$30=1000"); + assertEquals(1000, target.getMaxSpindleSpeed()); + + target.rawResponseListener("$30=1000,00"); + assertEquals(1000, target.getMaxSpindleSpeed()); + + target.rawResponseListener("$30=1000.9"); + assertEquals(1000, target.getMaxSpindleSpeed()); + } }