001package com.ctre.phoenix.motorcontrol.can;
002
003import com.ctre.phoenix.CustomParamConfiguration;
004import com.ctre.phoenix.motorcontrol.can.VictorSPXPIDSetConfiguration;
005import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
006import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
007import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
008
009/**
010 * Configurables available to VictorSPX
011 */
012public class VictorSPXConfiguration extends com.ctre.phoenix.motorcontrol.can.BaseMotorControllerConfiguration {
013    /**
014     * Primary PID configuration
015     */
016        public VictorSPXPIDSetConfiguration primaryPID;
017    /**
018     * Auxiliary PID configuration
019     */
020    public VictorSPXPIDSetConfiguration auxiliaryPID;
021    /**
022     * Forward Limit Switch Source
023     * 
024     * User can choose between the feedback connector, remote Talon SRX, CANifier, or deactivate the feature
025     */
026    public RemoteLimitSwitchSource forwardLimitSwitchSource;
027    /**
028     * Reverse Limit Switch Source
029     * 
030     * User can choose between the feedback connector, remote Talon SRX, CANifier, or deactivate the feature
031     */
032    public RemoteLimitSwitchSource reverseLimitSwitchSource;
033    /**
034     * Forward limit switch device ID
035     * 
036     * Limit Switch device id isn't used unless device is a remote
037     */
038    public int forwardLimitSwitchDeviceID;
039    /**
040     * Reverse limit switch device ID
041     * 
042     * Limit Switch device id isn't used unless device is a remote
043     */
044    public int reverseLimitSwitchDeviceID;
045    /**
046     * Forward limit switch normally open/closed
047     */
048    public LimitSwitchNormal forwardLimitSwitchNormal;
049    /**
050     * Reverse limit switch normally open/closed
051     */
052    public LimitSwitchNormal reverseLimitSwitchNormal;
053    /**
054     * Feedback Device for Sum 0 Term
055     */
056    public RemoteFeedbackDevice sum0Term;
057    /**
058     * Feedback Device for Sum 1 Term
059     */
060    public RemoteFeedbackDevice sum1Term;
061    /**
062     * Feedback Device for Diff 0 Term
063     */
064    public RemoteFeedbackDevice diff0Term;
065    /**
066     * Feedback Device for Diff 1 Term
067     */
068    public RemoteFeedbackDevice diff1Term;
069
070        
071        public VictorSPXConfiguration() {
072        primaryPID = new  VictorSPXPIDSetConfiguration(); 
073        auxiliaryPID = new VictorSPXPIDSetConfiguration(); 
074        
075        forwardLimitSwitchSource = RemoteLimitSwitchSource.Deactivated;
076        reverseLimitSwitchSource = RemoteLimitSwitchSource.Deactivated;
077        forwardLimitSwitchDeviceID = 0;
078        reverseLimitSwitchDeviceID = 0;
079        forwardLimitSwitchNormal = LimitSwitchNormal.NormallyOpen;
080        reverseLimitSwitchNormal = LimitSwitchNormal.NormallyOpen;
081        sum0Term =  RemoteFeedbackDevice.None; 
082        sum1Term =  RemoteFeedbackDevice.None;
083        diff0Term = RemoteFeedbackDevice.None;
084        diff1Term = RemoteFeedbackDevice.None;
085
086        }
087
088    /**
089     * @return String representation of all the configs
090     */
091        public String toString() {
092                return toString("");
093        }
094
095    /**
096     * @param prependString
097     *              String to prepend to all the configs
098     * @return String representation of all the configs
099     */
100    public String toString(String prependString) {
101        String retstr = primaryPID.toString(prependString + ".primaryPID");
102        retstr += auxiliaryPID.toString(prependString + ".auxiliaryPID");
103        retstr += prependString + ".forwardLimitSwitchSource = " + forwardLimitSwitchSource.toString() + ";\n";
104        retstr += prependString + ".reverseLimitSwitchSource = " + reverseLimitSwitchSource.toString() + ";\n";
105        retstr += prependString + ".forwardLimitSwitchDeviceID = " + String.valueOf(forwardLimitSwitchDeviceID) + ";\n";
106        retstr += prependString + ".reverseLimitSwitchDeviceID = " + String.valueOf(reverseLimitSwitchDeviceID) + ";\n";
107        retstr += prependString + ".forwardLimitSwitchNormal = " + forwardLimitSwitchNormal.toString() + ";\n";
108        retstr += prependString + ".reverseLimitSwitchNormal = " + reverseLimitSwitchNormal.toString() + ";\n";
109        retstr += prependString + ".sum0Term = " + sum0Term.toString() + ";\n";
110        retstr += prependString + ".sum1Term = " + sum1Term.toString() + ";\n";
111        retstr += prependString + ".diff0Term = " + diff0Term.toString() + ";\n";
112        retstr += prependString + ".diff1Term = " + diff1Term.toString() + ";\n";
113        retstr += super.toString(prependString);
114
115        return retstr;
116    }
117}
118