Package com.grt192.controller

Source Code of com.grt192.controller.DashBoardController

package com.grt192.controller;

import com.grt192.core.StepController;

import edu.wpi.first.wpilibj.AnalogModule;
import edu.wpi.first.wpilibj.Dashboard;
import edu.wpi.first.wpilibj.DigitalModule;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Solenoid;

/**
*
* @author anand
*/
public class DashBoardController extends StepController {

  public void act() {
    updateDefaultDashboard();
  }

  public void updateDefaultDashboard() {
    Dashboard lowDashData = DriverStation.getInstance()
        .getDashboardPackerLow();
    lowDashData.addCluster();
    {
      lowDashData.addCluster();
      { // analog modules
        lowDashData.addCluster();
        {
          for (int i = 1; i <= 8; i++) {
            lowDashData.addFloat((float) AnalogModule
                .getInstance(1).getAverageVoltage(i));
          }
        }
        lowDashData.finalizeCluster();
        lowDashData.addCluster();
        {
          for (int i = 1; i <= 8; i++) {
            lowDashData.addFloat((float) AnalogModule
                .getInstance(2).getAverageVoltage(i));
          }
        }
        lowDashData.finalizeCluster();
      }
      lowDashData.finalizeCluster();

      lowDashData.addCluster();
      { // digital modules
        lowDashData.addCluster();
        {
          lowDashData.addCluster();
          {
            int module = 4;
            lowDashData.addByte(DigitalModule.getInstance(module)
                .getRelayForward());
            lowDashData.addByte(DigitalModule.getInstance(module)
                .getRelayForward());
            lowDashData.addShort(DigitalModule.getInstance(module)
                .getAllDIO());
            lowDashData.addShort(DigitalModule.getInstance(module)
                .getDIODirection());
            lowDashData.addCluster();
            {
              for (int i = 1; i <= 10; i++) {
                lowDashData.addByte((byte) DigitalModule
                    .getInstance(module).getPWM(i));
              }
            }
            lowDashData.finalizeCluster();
          }
          lowDashData.finalizeCluster();
        }
        lowDashData.finalizeCluster();

        lowDashData.addCluster();
        {
          lowDashData.addCluster();
          {
            int module = 6;
            lowDashData.addByte(DigitalModule.getInstance(module)
                .getRelayForward());
            lowDashData.addByte(DigitalModule.getInstance(module)
                .getRelayReverse());
            lowDashData.addShort(DigitalModule.getInstance(module)
                .getAllDIO());
            lowDashData.addShort(DigitalModule.getInstance(module)
                .getDIODirection());
            lowDashData.addCluster();
            {
              for (int i = 1; i <= 10; i++) {
                lowDashData.addByte((byte) DigitalModule
                    .getInstance(module).getPWM(i));
              }
            }
            lowDashData.finalizeCluster();
          }
          lowDashData.finalizeCluster();
        }
        lowDashData.finalizeCluster();

      }
      lowDashData.finalizeCluster();

      lowDashData.addByte(Solenoid.getAll());
    }
    lowDashData.finalizeCluster();
    lowDashData.commit();
  }
}
TOP

Related Classes of com.grt192.controller.DashBoardController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.