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 to enable/disable various features of the Pigeon2.
015 * <p>
016 *  These configs allow the user to enable or disable various aspects
017 *  of the Pigeon2.
018 *
019 * @deprecated Classes in the phoenixpro package will be removed in 2024.
020 *             Users should instead use classes from the phoenix6 package.
021 */
022@Deprecated(forRemoval = true)
023public class Pigeon2FeaturesConfigs implements ParentConfiguration
024{
025    /**
026     * Turns on or off the magnetometer fusing for 9-axis. FRC users are
027     * not recommended to turn this on, as the magnetic influence of the
028     * robot will likely negatively affect the performance of the Pigeon2.
029     *
030     *  <ul>
031     *  <li> <b>Default Value:</b> False
032     *  </ul>
033     */
034    public boolean EnableCompass = false;
035    /**
036     * Disables using the temperature compensation feature
037     *
038     *  <ul>
039     *  <li> <b>Default Value:</b> False
040     *  </ul>
041     */
042    public boolean DisableTemperatureCompensation = false;
043    /**
044     * Disables using the no-motion calibration feature
045     *
046     *  <ul>
047     *  <li> <b>Default Value:</b> False
048     *  </ul>
049     */
050    public boolean DisableNoMotionCalibration = false;
051
052    @Override
053    public String toString()
054    {
055        String ss = "Config Group: Pigeon2Features\n";
056        ss += "Name: \"EnableCompass\" Value: \"" + EnableCompass + "\"" + "\n";
057        ss += "Name: \"DisableTemperatureCompensation\" Value: \"" + DisableTemperatureCompensation + "\"" + "\n";
058        ss += "Name: \"DisableNoMotionCalibration\" Value: \"" + DisableNoMotionCalibration + "\"" + "\n";
059        return ss;
060    }
061
062    /**
063     *
064     */
065    public StatusCode deserialize(String string)
066    {
067        EnableCompass = ConfigJNI.Deserializeboolean(SpnValue.Pigeon2UseCompass.value, string);
068        DisableTemperatureCompensation = ConfigJNI.Deserializeboolean(SpnValue.Pigeon2DisableTemperatureCompensation.value, string);
069        DisableNoMotionCalibration = ConfigJNI.Deserializeboolean(SpnValue.Pigeon2DisableNoMotionCalibration.value, string);
070        return  StatusCode.OK;
071    }
072
073    /**
074     *
075     */
076    public String serialize()
077    {
078        String ss = "";
079        ss += ConfigJNI.Serializeboolean(910, EnableCompass);
080        ss += ConfigJNI.Serializeboolean(945, DisableTemperatureCompensation);
081        ss += ConfigJNI.Serializeboolean(947, DisableNoMotionCalibration);
082        return ss;
083    }
084}
085