Skip to content

Commit 8db72f7

Browse files
committed
Updated application to verion 1.3 (beta). Incorporated changes by Benjamin Renz. Updated about dialog. Added null check on version detection. Sped up time set function by moving wait-for-reply outside the write loop. Removed some useless debug messages and outputs.
1 parent cecfdbc commit 8db72f7

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

OpenGammaTool/src/com/gammascout/AboutDialog.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public AboutDialog()
7070
dtrpnOpenGammaTool.setBackground(UIManager
7171
.getColor("Button.background"));
7272
dtrpnOpenGammaTool
73-
.setText("<html><body>\nOpen Gamma Tool<br/>\nVersion 1.3 (beta)<br/>\n&#169; 2014-2019 Erik Berglund<br/>\n<br/>\nSpecial thanks to <a href=\"http://johannes-bauer.com/linux/gammascout/\">Johannes Bauer</a><br/>\nfor reverse engineering and documenting <br/>\nthe GammaScout&#8482; protocol<br/>\n</body></html>");
73+
.setText("<html><body>\nOpen Gamma Tool<br/>\nVersion 1.3 (beta)<br/>\n&#169; 2014-2019 Erik Berglund<br/>\n<br/>"
74+
+ "\nSpecial thanks to <a href=\"http://johannes-bauer.com/linux/gammascout/\">Johannes Bauer</a><br/>\nfor reverse engineering and documenting <br/>\nthe GammaScout&#8482; protocol.<br/><br/>"
75+
+ "\nThanks to <a href=\"https://github.com/BenjaminRenz\">Benjamin Renz</a> for his work on the GammaScout&#8482; version 1 protocol.<br/>\n</body></html>");
7476
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
7577
gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(
7678
Alignment.TRAILING).addGroup(

OpenGammaTool/src/com/gammascout/MainWindow.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,17 +626,24 @@ else if (portNames.length == 1)
626626
if (portName != null)
627627
{
628628
ProtocolVersion version = new ProtocolVersionDetector(portName).getVersion();
629-
switch (version)
629+
if(version != null)
630630
{
631-
case VERSION1:
632-
gsc = new GammaScoutConnectorV1(portName);
633-
break;
634-
case VERSION2:
635-
gsc = new GammaScoutConnectorV2(portName);
636-
break;
637-
default:
638-
System.out.println("Couldn't determine protocol version.");
639-
break;
631+
switch (version)
632+
{
633+
case VERSION1:
634+
gsc = new GammaScoutConnectorV1(portName);
635+
break;
636+
case VERSION2:
637+
gsc = new GammaScoutConnectorV2(portName);
638+
break;
639+
default:
640+
System.out.println("Couldn't determine protocol version.");
641+
break;
642+
}
643+
}
644+
else
645+
{
646+
System.out.println("Protocol version detection failed.");
640647
}
641648
if(gsc!=null)
642649
{

OpenGammaTool/src/com/gammascout/usb/GammaScoutConnectorV2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ public void setClock(Date time) throws SerialPortException
103103
{
104104
Tools.sleep(500);
105105
}
106-
waitForString("\r\n");
107-
waitForString("Datum und Zeit gestellt\r\n");
108106
}
107+
waitForString("\r\n");
108+
waitForString("Datum und Zeit gestellt\r\n");
109109
updateInfo();
110110
setPcMode(false);
111111
}

OpenGammaTool/src/com/gammascout/usb/ProtocolVersionDetector.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ private ProtocolVersion innerTest(SerialPort serial) throws SerialPortException
8181
try
8282
{
8383
String prelude = serial.readString(10, 1000);
84-
System.out.println("Read \""+prelude+"\"");
8584
if(prelude.startsWith("\r\n Vers"))
8685
{
8786
result = ProtocolVersion.VERSION1;
@@ -94,13 +93,11 @@ else if(prelude.startsWith("\r\nVers") || prelude.startsWith("\r\nStand"))
9493
}
9594
catch (SerialPortTimeoutException e)
9695
{
97-
System.out.println("Timed out waiting for response.");
98-
e.printStackTrace();
96+
// Do nothing, this is expected if we're using the wrong protocol version.
9997
}
10098
finally
10199
{
102100
String remainder = serial.readString();
103-
System.out.println("Read \""+remainder+"\"");
104101
serial.closePort();
105102
}
106103
return result;

0 commit comments

Comments
 (0)