Beispiel #1
0
  /**
   * Asks the user what speed to use for every shoots. This method is used as testing for the
   * launcher.
   */
  public static void testSpeed() {

    launcherDelay = mainMenu.askForDelay();
    launcherSpeed = mainMenu.askForSpeed(700);
    // Loop if nobody presses the escape button
    while (iButton != Button.ID_ESCAPE) {

      LCD.clear();
      LCD.drawString("S:" + launcherSpeed, 0, 1);
      LCD.drawString("D:" + launcherDelay, 0, 2);
      LCD.drawString("V:" + Battery.getVoltageMilliVolt(), 0, 3);

      launcher.chainFireAtSpeed(launcherSpeed, launcherDelay);

      launcherSpeed = mainMenu.askForSpeed(launcherSpeed);
      iButton = Button.waitForPress();
    }
  }
  private void run3starProgram(int runLength) throws InterruptedException, IOException {
    Stopwatch foodTimer = new Stopwatch();
    foodTimer.reset();
    // press10();//eat food
    for (int i = 0; i < runLength; i++) {
      goodcounter = 0;
      goodseen2 = false;
      if (foodTimer.elapsed() >= 1620000) { // 27 minutes
        foodTimer.reset();
        // press10();//eat food
      }
      LCD.clear();
      LCD.drawString("Battery: " + Battery.getVoltage(), 0, 0);
      LCD.drawString("BatteryR: " + Motors.getInstance().getRemoteBattery(), 0, 1);
      LCD.drawString("REMAIN: " + (runLength - i - 1), 0, 2);

      // start craft from craft menu
      Motors.getInstance().pressC();
      Thread.sleep(1000);
      Motors.getInstance().pressC();
      Thread.sleep(2000);

      // stage 1
      stage = 1;
      Motors.getInstance().pressA(); // comfort zone
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteC(); // inner quiet
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteB(); // CarefulSynth2
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteB(); // CarefulSynth2
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 2
      stage = 2;
      Motors.getInstance().pressA(); // steady hand 2
      Thread.sleep(BUFF_TIME);
      goodseen = false;
      for (int j = 0; j < 4; j++) {
        handleGood2();
        if (goodcounter > 0) {
          goodcounter--;
          Motors.getInstance().pressRemoteC(); // basic touch
        } else {
          Motors.getInstance().pressRemoteB(); // hasty touch
        }
        Thread.sleep(TOUCH_TIME);
      }
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 3
      stage = 3;
      handleGood();
      Motors.getInstance().pressA(); // comfort zone
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteC(); // master's mend 2
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 4
      stage = 4;
      Motors.getInstance().pressA(); // steady hand 2
      Thread.sleep(BUFF_TIME);
      goodseen = false;
      for (int j = 0; j < 4; j++) {
        handleGood2();
        if (goodcounter > 0) {
          goodcounter--;
          Motors.getInstance().pressRemoteC(); // basic touch
        } else {
          Motors.getInstance().pressRemoteB(); // hasty touch
        }
        Thread.sleep(TOUCH_TIME);
      }
      Motors.getInstance().pressA(); // steady hand 2
      Thread.sleep(BUFF_TIME);
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 5
      stage = 4;
      boolean byresUsed = false;
      Motors.getInstance().pressA(); // Great Strides
      Thread.sleep(BUFF_TIME);
      Motors.getInstance().pressRemoteB(); // Innovation
      Thread.sleep(BUFF_TIME);
      if (!byresUsed) byresUsed = useByreGots(false);
      Motors.getInstance().pressRemoteC(); // Ingenuity 2
      Thread.sleep(BUFF_TIME);
      if (!byresUsed) byresUsed = useByreGots(true);
      Motors.getInstance().pressRemoteA(); // Finish
      Thread.sleep(TOUCH_TIME * 3 + 4000);
    }
    Motors.getInstance().shutdown();
  }