Пример #1
0
  public String getMachineInfo() {
    Driver driver = Base.getMachineLoader().getDriver();

    String info = new String();

    info += "System Information" + "\n";
    info += " ReplicatorG version: " + Base.VERSION_NAME + "\n";
    info += " Java version: " + System.getProperty("java.version") + "\n";

    info += "\n";
    info += "Machine" + "\n";
    info += " Profile Name: " + Base.preferences.get("machine.name", "") + "\n";
    info += " Driver Type: " + Base.getMachineLoader().getDriver().getDriverName() + "\n";
    info += " Name: " + Base.getMachineLoader().getMachine().getMachineName() + "\n";

    // TODO: Only if a printer is connected?
    info += " Motherboard firmware version: " + driver.getFirmwareInfo() + "\n";
    // Status dump

    // Communication Statistics
    if (driver instanceof OnboardParameters) {
      CommunicationStatistics stats = ((OnboardParameters) driver).getCommunicationStatistics();
      info += " Motherboard communication statistics" + "\n";
      info += "  Number of packets received from the USB interface:" + stats.packetCount + "\n";
      info += "  Number of packets sent over the RS485 interface:" + stats.sentPacketCount + "\n";
      info +=
          "  Number of packets sent over the RS485 interface that were not responded to:"
              + stats.packetFailureCount
              + "\n";
      info += "  Number of packet retries attempted:" + stats.packetRetryCount + "\n";
      info +=
          "  Number of bytes received over the RS485 interface that were discarded as noise:"
              + stats.noiseByteCount
              + "\n";
    }
    // EEPROM dump

    // Toolhead info (per toolhead)

    // Default skeinforge version/profile info?

    // Machine Driver XML dump
    info += "\n";
    info += "Machine Driver XML:" + "\n";
    Node machineNode = MachineFactory.getMachineNode(Base.preferences.get("machine.name", ""));
    if (machineNode != null) {
      info += convertNodeToHtml(machineNode) + "\n";
    }

    // Test communication

    return info;
  }
Пример #2
0
 /**
  * Generic Constructor. Creates an output file and registers as a machineListener
  *
  * @filename : desired output file
  */
 public DataCapture(String filename) {
   try {
     outFile = new FileWriter(filename);
   } catch (IOException e) {
     Base.logger.severe("Couldn't open data capture file for writing:" + e.getMessage());
   }
   // Listen to the machine, do you hear what it is telling you?
   Base.getMachineLoader().addMachineListener(this);
 }
  public DualStrusionConstruction(
      File leftFile,
      File rightFile,
      MutableGCodeSource startSource,
      MutableGCodeSource endSource,
      MachineType type,
      boolean useWipes) {
    this.leftFile = leftFile;
    this.rightFile = rightFile;
    this.useWipes = useWipes;
    this.machineType = type;
    startGCode = startSource.copy();
    endGCode = endSource.copy();
    if (useWipes) {
      leftWipe =
          Base.getMachineLoader().getMachineInterface().getModel().getWipeFor(ToolheadAlias.LEFT);
      rightWipe =
          Base.getMachineLoader().getMachineInterface().getModel().getWipeFor(ToolheadAlias.RIGHT);

      if (leftWipe == null || rightWipe == null) {
        String error =
            "Could not find wipes for the current machine: "
                + Base.getMachineLoader().getMachineInterface().getModel().toString()
                + ". Continuing without wipes.";
        JOptionPane.showConfirmDialog(
            null,
            error,
            "Could not find wipes!",
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE);

        useWipes = false;
      }
    } else {
      leftWipe = null;
      rightWipe = null;
    }
  }
  private ControlPanelWindow(MachineInterface newMachine) {
    super("Control Panel");

    Image icon = Base.getImage("images/icon.gif", this);
    setIconImage(icon);

    // save our machine!
    machine = newMachine;

    machine.runCommand(new InvalidatePosition());

    // Listen to it-- stop and close if we're in build mode.
    Base.getMachineLoader().addMachineListener(this);

    // default behavior
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    // no menu bar.
    setJMenuBar(createMenuBar());

    chooser = new JColorChooser(Color.BLACK);

    ActionListener okListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Color ledColor = chooser.getColor();
            Base.logger.severe("running setLedStrip");
            try {
              machine.getDriver().setLedStrip(ledColor, 0);
            } catch (replicatorg.drivers.RetryException f) {
              Base.logger.severe("foo" + f.toString());
            }
            // machine.runCommand(new SetLedStrip(ledColor, 0));
            ledStripButton.setText(ShowColorChooserAction.buttonStringFromColor(ledColor));
          }
        };

    ledStripButton =
        new JButton(new ShowColorChooserAction(this, chooser, okListener, null, Color.BLACK));

    // create all our GUI interfaces
    mainPanel = new JPanel();
    mainPanel.setLayout(new MigLayout("gap 5, ins 5, flowy"));

    jogPanel = new JogPanel(machine);
    mainPanel.add(jogPanel, "split 4, growx, growy");
    mainPanel.add(createActivationPanel(), "split, growx");
    if (newMachine.getMachineType() == MachineType.THE_REPLICATOR) {
      mainPanel.add(ledStripButton, "growx");
      //			mainPanel.add(createBeepPanel(), "growx");
    }
    mainPanel.add(alternateToolsPanel(), "newline, growy");

    this.setResizable(false);
    add(mainPanel);

    // add our listener hooks.
    addWindowListener(this);
    // addWindowFocusListener(this);
    // addWindowStateListener(this);

    // start our various threads.
    updateThread = new UpdateThread(this);
    updateThread.start();
    pollThread = new PollThread(machine);
    pollThread.start();
  }