Skip to content

Commit

Permalink
Fixed trackers ping not being displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel committed Jul 13, 2021
1 parent c2b4d30 commit a20334d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/main/java/io/eiren/gui/TrackersList.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ public void actionPerformed(ActionEvent e) {
add(status = new JLabel(t.getStatus().toString().toLowerCase()), c(1, 4, 0, GridBagConstraints.FIRST_LINE_START));
add(new JLabel("Battery:"), c(2, 4, 0, GridBagConstraints.FIRST_LINE_START));
add(bat = new JLabel("0"), c(3, 4, 0, GridBagConstraints.FIRST_LINE_START));
if(t instanceof ReferenceAdjustedTracker) {
add(new JLabel("Raw:"), c(0, 5, 0, GridBagConstraints.FIRST_LINE_START));
add(raw = new JLabel("0 0 0 0"), s(c(1, 5, 0, GridBagConstraints.FIRST_LINE_START), 3, 1));
}
add(new JLabel("Raw:"), c(0, 5, 0, GridBagConstraints.FIRST_LINE_START));
add(raw = new JLabel("0 0 0 0"), s(c(1, 5, 0, GridBagConstraints.FIRST_LINE_START), 3, 1));

setBorder(BorderFactory.createLineBorder(new Color(0x663399), 4, true));
TrackersList.this.add(this);
Expand Down Expand Up @@ -208,16 +206,16 @@ public void update() {
}
if(t instanceof TrackerWithBattery)
bat.setText(StringUtils.prettyNumber(((TrackerWithBattery) t).getBatteryVoltage(), 1));
if(t instanceof IMUTracker)
ping.setText(String.valueOf(((IMUTracker) t).ping));
if(t instanceof ReferenceAdjustedTracker) {
ReferenceAdjustedTracker<Tracker> t2 = (ReferenceAdjustedTracker<Tracker>) t;
t2.getTracker().getRotation(q);
raw.setText(StringUtils.prettyNumber(q.getX(), 4)
+ " " + StringUtils.prettyNumber(q.getY(), 4)
+ " " + StringUtils.prettyNumber(q.getZ(), 4)
+ " " + StringUtils.prettyNumber(q.getW(), 4));
}
Tracker t2 = t;
if(t instanceof ReferenceAdjustedTracker)
t2 = ((ReferenceAdjustedTracker<Tracker>) t).getTracker();
if(t2 instanceof IMUTracker)
ping.setText(String.valueOf(((IMUTracker) t2).ping));
t2.getRotation(q);
raw.setText(StringUtils.prettyNumber(q.getX(), 4)
+ " " + StringUtils.prettyNumber(q.getY(), 4)
+ " " + StringUtils.prettyNumber(q.getZ(), 4)
+ " " + StringUtils.prettyNumber(q.getW(), 4));
}
}

Expand Down

0 comments on commit a20334d

Please sign in to comment.