Beispiel #1
0
  protected void runData() {
    CompassDataMsg data;
    double orientation;
    double varOrientation;

    data = compass.getData();

    if (data != null) {
      orientation = Math.rint(Math.toDegrees(data.orientation) * 10.0) / 10.0;
      varOrientation = Math.rint(Math.toDegrees(data.varOrientation) * 10.0) / 10.0;
      orientationLabel.setText(orientation + "deg");
      varOrientationLabel.setText(varOrientation + "deg");

      setEnabled(true);
    } else {
      setEnabled(false);
    }
  }