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 affect general behavior during closed-looping.
015 * <p>
016 *  Includes Continuous Wrap 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 ClosedLoopGeneralConfigs implements ParentConfiguration
023{
024    /**
025     * Wrap position error within [-0.5,+0.5) mechanism rotations. 
026     * Typically used for continuous position closed-loops like swerve
027     * azimuth.
028     * <p>
029     * This uses the mechanism rotation value. If there is a gear ratio
030     * between the sensor and the mechanism, make sure to apply a
031     * SensorToMechanismRatio so the closed loop operates on the full
032     * rotation.
033     *
034     *  <ul>
035     *  <li> <b>Default Value:</b> False
036     *  </ul>
037     */
038    public boolean ContinuousWrap = false;
039
040    @Override
041    public String toString()
042    {
043        String ss = "Config Group: ClosedLoopGeneral\n";
044        ss += "Name: \"ContinuousWrap\" Value: \"" + ContinuousWrap + "\"" + "\n";
045        return ss;
046    }
047
048    /**
049     *
050     */
051    public StatusCode deserialize(String string)
052    {
053        ContinuousWrap = ConfigJNI.Deserializeboolean(SpnValue.Config_ContinuousWrap.value, string);
054        return  StatusCode.OK;
055    }
056
057    /**
058     *
059     */
060    public String serialize()
061    {
062        String ss = "";
063        ss += ConfigJNI.Serializeboolean(1499, ContinuousWrap);
064        return ss;
065    }
066}
067