示例#1
0
  /**
   * Gives us the choice between setPower(), or setSpeed(). It allowed us to test which one we
   * should use.
   */
  public static void test() {

    /*
     * First, get the values from the user by displaying the instructions on
     * the screen. If the user agrees with the parameters set in the menu,
     * proceed to the launching. If not, display the menu again.
     */

    while (!mainMenu.summarizeLauncher()) {

      if (mainMenu.display()) {
        launcherPower = mainMenu.askForPower();
      } else {
        launcherSpeed = mainMenu.askForSpeed();
      }

      launcherDelay = mainMenu.askForDelay();
    }

    LCD.clearDisplay();
    LCD.drawString("     Shooting     ", 0, 0);

    if (launcherPower != -1) {

      launcher.chainFireAtPower(launcherPower, launcherDelay);

    } else {

      launcher.chainFireAtSpeed(launcherSpeed, launcherDelay);
    }

    LCD.clearDisplay();
  }
示例#2
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();
    }
  }