예제 #1
0
  public synchronized void loadXML(Node xml) {
    super.loadXML(xml);
    // load from our XML config, if we have it.
    if (XML.hasChildNode(xml, "waitforstart")) {
      Node startNode = XML.getChildNodeByName(xml, "waitforstart");

      String enabled = XML.getAttributeValue(startNode, "enabled");
      if (enabled != null) waitForStart = Boolean.parseBoolean(enabled);

      String timeout = XML.getAttributeValue(startNode, "timeout");
      if (timeout != null) waitForStartTimeout = Long.parseLong(timeout);

      String retries = XML.getAttributeValue(startNode, "retries");
      if (retries != null) waitForStartRetries = Integer.parseInt(retries);
    }

    if (XML.hasChildNode(xml, "pulserts")) {
      pulseRTS = Boolean.parseBoolean(XML.getChildNodeValue(xml, "pulserts"));
    }

    if (XML.hasChildNode(xml, "checksums")) {
      hasChecksums = Boolean.parseBoolean(XML.getChildNodeValue(xml, "checksums"));
    }

    if (XML.hasChildNode(xml, "fived")) {
      fiveD = Boolean.parseBoolean(XML.getChildNodeValue(xml, "fived"));
    }
    if (XML.hasChildNode(xml, "debugLevel")) {
      debugLevel = Integer.parseInt(XML.getChildNodeValue(xml, "debugLevel"));
    }
    if (XML.hasChildNode(xml, "limitFeedrate")) {
      rcFeedrateLimit = Double.parseDouble(XML.getChildNodeValue(xml, "limitFeedrate"));
    }
    if (XML.hasChildNode(xml, "okAfterResend")) {
      okAfterResend = Boolean.parseBoolean(XML.getChildNodeValue(xml, "okAfterResend"));
    }
    if (XML.hasChildNode(xml, "okAfterStart")) {
      okAfterStart = Boolean.parseBoolean(XML.getChildNodeValue(xml, "okAfterStart"));
    }
    if (XML.hasChildNode(xml, "alwaysRelativeE")) {
      alwaysRelativeE = Boolean.parseBoolean(XML.getChildNodeValue(xml, "alwaysRelativeE"));
    }
    if (XML.hasChildNode(xml, "hasEmergencyStop")) {
      hasEmergencyStop = Boolean.parseBoolean(XML.getChildNodeValue(xml, "hasEmergencyStop"));
    }
    if (XML.hasChildNode(xml, "hasSoftStop")) {
      hasSoftStop = Boolean.parseBoolean(XML.getChildNodeValue(xml, "hasSoftStop"));
    }

    if (XML.hasChildNode(xml, "introduceNoise")) {
      double introduceNoise = Double.parseDouble(XML.getChildNodeValue(xml, "introduceNoise"));
      if (introduceNoise != 0) {
        Base.logger.warning(
            "Purposefully injecting noise into communications. This is NOT for production.");
        Base.logger.warning(
            "Turn this off by removing introduceNoise from the machines XML file of your machine.");
        introduceNoiseEveryN = (int) (1 / introduceNoise);
      }
    }
  }