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