-
-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed problems with legacy GRBL version strings (#2314)
GRBL version 0.9 and earlier does not print the same output to the $I command. This will fix that so that the version number is properly parsed.
- Loading branch information
Showing
4 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...t/com/willwinder/universalgcodesender/firmware/grbl/commands/GetBuildInfoCommandTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.willwinder.universalgcodesender.firmware.grbl.commands; | ||
|
||
|
||
import com.willwinder.universalgcodesender.firmware.grbl.GrblVersion; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class GetBuildInfoCommandTest { | ||
|
||
@Test | ||
public void getVersionWithMultilineShouldReturnTheVersionNumber() { | ||
GetBuildInfoCommand command = new GetBuildInfoCommand(); | ||
command.appendResponse("[OPT: ABC]"); | ||
command.appendResponse("[VER: 1.1f]"); | ||
command.appendResponse("ok"); | ||
GrblVersion version = command.getVersion().orElseThrow(RuntimeException::new); | ||
assertEquals(1.1, version.getVersionNumber(), 0.01); | ||
} | ||
|
||
@Test | ||
public void getVersionWithLegacySingleLineVersion() { | ||
GetBuildInfoCommand command = new GetBuildInfoCommand(); | ||
command.appendResponse("[0.9j.20160303:]"); | ||
command.appendResponse("ok"); | ||
GrblVersion version = command.getVersion().orElseThrow(RuntimeException::new); | ||
assertEquals(0.9, version.getVersionNumber(), 0.01); | ||
assertEquals(Character.valueOf('j'), version.getVersionLetter()); | ||
} | ||
} |