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 * Voltage-specific configs 015 * <p> 016 * Voltage-specific configs 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 VoltageConfigs implements ParentConfiguration 023{ 024 /** 025 * The time constant (in seconds) of the low-pass filter for the 026 * supply voltage. 027 * <p> 028 * This impacts the filtering for the reported supply voltage, and any 029 * control strategies that use the supply voltage (such as voltage 030 * control on a motor controller). 031 * 032 * <ul> 033 * <li> <b>Minimum Value:</b> 0.0 034 * <li> <b>Maximum Value:</b> 0.1 035 * <li> <b>Default Value:</b> 0 036 * <li> <b>Units:</b> sec 037 * </ul> 038 */ 039 public double SupplyVoltageTimeConstant = 0; 040 /** 041 * Maximum (forward) output during voltage based control modes. 042 * 043 * <ul> 044 * <li> <b>Minimum Value:</b> -16 045 * <li> <b>Maximum Value:</b> 16 046 * <li> <b>Default Value:</b> 16 047 * <li> <b>Units:</b> V 048 * </ul> 049 */ 050 public double PeakForwardVoltage = 16; 051 /** 052 * Minimum (reverse) output during voltage based control modes. 053 * 054 * <ul> 055 * <li> <b>Minimum Value:</b> -16 056 * <li> <b>Maximum Value:</b> 16 057 * <li> <b>Default Value:</b> -16 058 * <li> <b>Units:</b> V 059 * </ul> 060 */ 061 public double PeakReverseVoltage = -16; 062 063 @Override 064 public String toString() 065 { 066 String ss = "Config Group: Voltage\n"; 067 ss += "Name: \"SupplyVoltageTimeConstant\" Value: \"" + SupplyVoltageTimeConstant + "sec\"" + "\n"; 068 ss += "Name: \"PeakForwardVoltage\" Value: \"" + PeakForwardVoltage + "V\"" + "\n"; 069 ss += "Name: \"PeakReverseVoltage\" Value: \"" + PeakReverseVoltage + "V\"" + "\n"; 070 return ss; 071 } 072 073 /** 074 * 075 */ 076 public StatusCode deserialize(String string) 077 { 078 SupplyVoltageTimeConstant = ConfigJNI.Deserializedouble(SpnValue.Config_SupplyVLowpassTau.value, string); 079 PeakForwardVoltage = ConfigJNI.Deserializedouble(SpnValue.Config_PeakForwardV.value, string); 080 PeakReverseVoltage = ConfigJNI.Deserializedouble(SpnValue.Config_PeakReverseV.value, string); 081 return StatusCode.OK; 082 } 083 084 /** 085 * 086 */ 087 public String serialize() 088 { 089 String ss = ""; 090 ss += ConfigJNI.Serializedouble(1423, SupplyVoltageTimeConstant); 091 ss += ConfigJNI.Serializedouble(1433, PeakForwardVoltage); 092 ss += ConfigJNI.Serializedouble(1434, PeakReverseVoltage); 093 return ss; 094 } 095} 096