001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenixpro.configs;
008
009import com.ctre.phoenix6.StatusCode;
010import com.ctre.phoenix6.configs.jni.ConfigJNI;
011import com.ctre.phoenix6.spns.*;
012
013/**
014 *  Configs that directly affect motor-output.
015 * <p>
016 *  Includes Motor Invert and various limit features.
017 *
018 * @deprecated Classes in the phoenixpro package will be removed in 2024.
019 *             Users should instead use classes from the phoenix6 package.
020 */
021@Deprecated(forRemoval = true)
022public class TorqueCurrentConfigs implements ParentConfiguration
023{
024    /**
025     * Maximum (forward) output during torque current based control modes.
026     *
027     *  <ul>
028     *  <li> <b>Minimum Value:</b> -800
029     *  <li> <b>Maximum Value:</b> 800
030     *  <li> <b>Default Value:</b> 800
031     *  <li> <b>Units:</b> A
032     *  </ul>
033     */
034    public double PeakForwardTorqueCurrent = 800;
035    /**
036     * Minimum (reverse) output during torque current based control modes.
037     *
038     *  <ul>
039     *  <li> <b>Minimum Value:</b> -800
040     *  <li> <b>Maximum Value:</b> 800
041     *  <li> <b>Default Value:</b> -800
042     *  <li> <b>Units:</b> A
043     *  </ul>
044     */
045    public double PeakReverseTorqueCurrent = -800;
046    /**
047     * Configures the output deadband during torque current based control
048     * modes.
049     *
050     *  <ul>
051     *  <li> <b>Minimum Value:</b> 0
052     *  <li> <b>Maximum Value:</b> 25
053     *  <li> <b>Default Value:</b> 0.0
054     *  <li> <b>Units:</b> A
055     *  </ul>
056     */
057    public double TorqueNeutralDeadband = 0.0;
058
059    @Override
060    public String toString()
061    {
062        String ss = "Config Group: TorqueCurrent\n";
063        ss += "Name: \"PeakForwardTorqueCurrent\" Value: \"" + PeakForwardTorqueCurrent + "A\"" + "\n";
064        ss += "Name: \"PeakReverseTorqueCurrent\" Value: \"" + PeakReverseTorqueCurrent + "A\"" + "\n";
065        ss += "Name: \"TorqueNeutralDeadband\" Value: \"" + TorqueNeutralDeadband + "A\"" + "\n";
066        return ss;
067    }
068
069    /**
070     *
071     */
072    public StatusCode deserialize(String string)
073    {
074        PeakForwardTorqueCurrent = ConfigJNI.Deserializedouble(SpnValue.Config_PeakForTorqCurr.value, string);
075        PeakReverseTorqueCurrent = ConfigJNI.Deserializedouble(SpnValue.Config_PeakRevTorqCurr.value, string);
076        TorqueNeutralDeadband = ConfigJNI.Deserializedouble(SpnValue.Config_TorqueNeutralDB.value, string);
077        return  StatusCode.OK;
078    }
079
080    /**
081     *
082     */
083    public String serialize()
084    {
085        String ss = "";
086        ss += ConfigJNI.Serializedouble(1435, PeakForwardTorqueCurrent);
087        ss += ConfigJNI.Serializedouble(1436, PeakReverseTorqueCurrent);
088        ss += ConfigJNI.Serializedouble(1437, TorqueNeutralDeadband);
089        return ss;
090    }
091}
092