/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.stuy;

import edu.wpi.first.wpilibj.AnalogChannel;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;

/**
 *
 * @author 694
 */
public class CurrentThing {
    private AnalogChannel analog;
    private Vector measurements;
    private Timer updateMeasurements;
    private final int UPDATE_PERIOD_MS = 10;

    private static final double CURRENT_MULTIPLIER = 15.0;


    public CurrentThing(int channel) {
        analog = new AnalogChannel(channel);
        measurements = new Vector();
    }

    /**
     * Starts the update thread.
     */
    public void start() {
        stop();
        updateMeasurements = new Timer();
        updateMeasurements.schedule(new TimerTask() {

            public void run() {
                synchronized (measurements) {
                    measurements.addElement(new Double(analog.getVoltage()));
                    if (measurements.size() > 10) {
                        measurements.removeElementAt(0);
                    }
                }
            }
        }, 0, UPDATE_PERIOD_MS);
    }

    public void stop() {
        if (updateMeasurements != null) {
            updateMeasurements.cancel();
        }
    }

    public void reset() {
        measurements.removeAllElements();
    }

    /**
     * Returns the current read by the current thing.
     * @return Current in amps
     */
    public double getCurrent() {
        if (measurements.isEmpty()) {
            return 0;
        }
        double sum = 0;
        synchronized (measurements) {
            for (int i = 0; i < measurements.size(); i++) {
                sum += ((Double) measurements.elementAt(i)).doubleValue();
            }
            return sum * CURRENT_MULTIPLIER;
        }
    }
}

@@ -156,16 +156,146 @@
 hannel;%0A
+import edu.wpi.first.wpilibj.networktables.NetworkTableKeyNotDefined;%0Aimport edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;%0A
 import j
@@ -592,44 +592,34 @@
 tic 
-final 
 double 
-CURRENT_MULTIPLIER
+currentModifier
  = 1
-5
 .0;%0A
@@ -1926,39 +1926,275 @@
     
-return sum * CURRENT_MULTIPLIER
+try%7B%0A               currentModifier = SmartDashboard.getDouble(%22setCurrentMod%22);%0A            %7D%0A            catch (NetworkTableKeyNotDefined e) %7B%0A                SmartDashboard.putDouble(%22setCurrentMod%22, 1);%0A            %7D%0A            return sum / 0.1 * currentModifier
 ;%0A  

Fix multipliers for current thing.