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; 010 011/** 012 * Class for CANcoder, a CAN based magnetic encoder that provides absolute and 013 * relative position along with filtered velocity. 014 * 015 * This handles the configurations for the {@link com.ctre.phoenixpro.hardware.CANcoder} 016 * 017 * @deprecated Classes in the phoenixpro package will be removed in 2024. 018 * Users should instead use classes from the phoenix6 package. 019 */ 020@Deprecated(forRemoval = true) 021public class CANcoderConfiguration implements ParentConfiguration 022{ 023 /** 024 * True if we should factory default newer unsupported configs, 025 * false to leave newer unsupported configs alone. 026 * <p> 027 * This flag addresses a corner case where the device may have 028 * firmware with newer configs that didn't exist when this 029 * version of the API was built. If this occurs and this 030 * flag is true, unsupported new configs will be factory 031 * defaulted to avoid unexpected behavior. 032 * <p> 033 * This is also the behavior in Phoenix 5, so this flag 034 * is defaulted to true to match. 035 */ 036 public boolean FutureProofConfigs = true; 037 038 039 /** 040 * Configs that affect the magnet sensor and how to interpret it. 041 * <p> 042 * Includes sensor range and other configs related to sensor. 043 */ 044 public MagnetSensorConfigs MagnetSensor = new MagnetSensorConfigs(); 045 046 @Override 047 public String toString() 048 { 049 String ss = ""; 050 ss += MagnetSensor.toString(); 051 return ss; 052 } 053 054 /** 055 * Get the serialized form of this configuration 056 * 057 * @return Serialized form of this config group 058 */ 059 public String serialize() 060 { 061 String ss = ""; 062 ss += MagnetSensor.serialize(); 063 return ss; 064 } 065 066 /** 067 * Take a string and deserialize it to this configuration 068 * 069 * @return Return code of the deserialize method 070 */ 071 public StatusCode deserialize(String string) 072 { 073 StatusCode err = StatusCode.OK; 074 err = MagnetSensor.deserialize(string); 075 return err; 076 } 077};