Skip to content

Commit

Permalink
Update checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz-Juranek committed Apr 15, 2020
1 parent ac449a6 commit f0cd287
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 71 deletions.
56 changes: 29 additions & 27 deletions src/uccbviewer/USBtinViewer.form
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,18 @@
<Component id="msgData6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="msgData7" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="bitRate1" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="53" max="-2" attributes="0"/>
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="bitRate1" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="msgExt" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="sendMessage" min="-2" pref="391" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbRepeat" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="msRepeatTime" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -99,10 +101,7 @@
<Component id="clearButton" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jCheckBox1" max="32767" attributes="0"/>
<Component id="btnSWCANLIN" max="32767" attributes="0"/>
</Group>
<Component id="btnSWCANLIN" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="mainTabbedPane" max="32767" attributes="0"/>
Expand All @@ -114,27 +113,29 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="serialPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bitRate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="connectionButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="logToFile" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnSWCANLIN" alignment="3" max="32767" attributes="0"/>
<Component id="clearButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="serialPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bitRate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="connectionButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="logToFile" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="clearButton" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="followButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="openmodeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="btnSWCANLIN" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="followButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="openmodeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="13" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="mainTabbedPane" min="-2" pref="363" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
Expand All @@ -160,6 +161,7 @@
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="msRepeatTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbRepeat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
Expand Down Expand Up @@ -555,7 +557,7 @@
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace pref="454" max="32767" attributes="0"/>
<EmptySpace pref="466" max="32767" attributes="0"/>
<Component id="jButton5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton4" min="-2" max="-2" attributes="0"/>
Expand Down
100 changes: 56 additions & 44 deletions src/uccbviewer/USBtinViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
public class USBtinViewer extends javax.swing.JFrame implements CANMessageListener {

/** Version string */
protected final String version = "2.4";
protected final String version = "2.5";

/** USBtin device */
protected USBtin usbtin = new USBtin();
Expand Down Expand Up @@ -562,7 +562,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(LINMasterTableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LINMasterTableLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 454, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 466, Short.MAX_VALUE)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
Expand Down Expand Up @@ -679,15 +679,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(msgData6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(msgData7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(bitRate1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGap(53, 53, 53)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bitRate1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(msgExt))
.addGroup(layout.createSequentialGroup()
.addComponent(sendMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 391, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jCheckBox1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbRepeat)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(msRepeatTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
Expand Down Expand Up @@ -718,33 +720,32 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(followButton, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
.addComponent(clearButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnSWCANLIN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(btnSWCANLIN, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(mainTabbedPane)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(serialPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bitRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(connectionButton)
.addComponent(logToFile))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnSWCANLIN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clearButton)))
.addGap(1, 1, 1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton1)
.addComponent(followButton)
.addComponent(openmodeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCheckBox1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(serialPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bitRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(connectionButton)
.addComponent(logToFile))
.addComponent(clearButton))
.addGap(1, 1, 1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton1)
.addComponent(followButton)
.addComponent(openmodeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(btnSWCANLIN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addComponent(mainTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
Expand All @@ -768,7 +769,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(sendButton)
.addComponent(jLabel1)
.addComponent(msRepeatTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbRepeat))
.addComponent(cbRepeat)
.addComponent(jCheckBox1))
.addContainerGap())
);

Expand Down Expand Up @@ -826,6 +828,10 @@ private void connectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//
sendButton.setText("Send");
sendingIsActive = false;


this.jCheckBox1.setEnabled(true);
this.bitRate1.setEnabled(true);

openmodeComboBox.setEnabled(true);
} else {
try {
Expand All @@ -840,8 +846,8 @@ private void connectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//
{
gg = 50000;
}
usbtin.openCANChannel(gg, connectionStringToEnum((String)openmodeComboBox.getSelectedItem()));
}
usbtin.openCANChannel(gg, connectionStringToEnum((String)openmodeComboBox.getSelectedItem()));
}
else {
usbtin.openCANChannel(Integer.parseInt((String) bitRate.getSelectedItem()), connectionStringToEnum((String)openmodeComboBox.getSelectedItem()));
}
Expand Down Expand Up @@ -871,13 +877,33 @@ private void connectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//
log("Connected to Device (FW" + usbtin.getFirmwareVersion() + "/HW" + usbtin.getHardwareVersion() + ", SN: " + usbtin.getSerialNumber() + ")", LogMessage.MessageType.INFO);
mainTabbedPane.setEnabled(true);

this.jCheckBox1.setEnabled(false);
this.bitRate1.setEnabled(false);

if (baseTimestamp == 0) {
baseTimestamp = System.currentTimeMillis();
}

if (this.Device_Type == tDevice_Type.LIN_DEVICE)
{
Thread.sleep(50);

if (this.jCheckBox1.isSelected()){
CANMessage canmsg = new CANMessage("r3100"); // set checksum to classic
send(canmsg);
}
else
{
CANMessage canmsg = new CANMessage("r3000"); // set cecksum to enchanced
send(canmsg);
}
}

} catch (USBtinException e) {
log(e.getMessage(), LogMessage.MessageType.ERROR);
}
} catch (InterruptedException ex) {
Logger.getLogger(USBtinViewer.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_connectionButtonActionPerformed

Expand Down Expand Up @@ -1296,21 +1322,7 @@ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
}//GEN-LAST:event_jButton5ActionPerformed

private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
if (this.jCheckBox1.isSelected())
{
try {
this.usbtin.transmit("x2");
} catch (SerialPortException e) {
} catch (SerialPortTimeoutException e) {
}
} else
{
try {
this.usbtin.transmit("x1");
} catch (SerialPortException e) {
} catch (SerialPortTimeoutException e) {
}
}

}//GEN-LAST:event_jCheckBox1ActionPerformed

JTextField[] filterTextFields;
Expand Down

0 comments on commit f0cd287

Please sign in to comment.