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.*; 012import com.ctre.phoenixpro.signals.*; 013 014/** 015 * Configs that directly affect motor-output. 016 * <p> 017 * Includes Motor Invert and various limit features. 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 MotorOutputConfigs implements ParentConfiguration 024{ 025 /** 026 * Invert state of the device 027 * 028 */ 029 public InvertedValue Inverted = InvertedValue.CounterClockwise_Positive; 030 /** 031 * The state of the motor controller bridge when output is neutral or 032 * disabled. 033 * 034 */ 035 public NeutralModeValue NeutralMode = NeutralModeValue.Coast; 036 /** 037 * Configures the output deadband percentage. 038 * 039 * <ul> 040 * <li> <b>Minimum Value:</b> 0.0 041 * <li> <b>Maximum Value:</b> 0.25 042 * <li> <b>Default Value:</b> 0 043 * <li> <b>Units:</b> fractional 044 * </ul> 045 */ 046 public double DutyCycleNeutralDeadband = 0; 047 /** 048 * Maximum (forward) output during duty cycle based control modes. 049 * 050 * <ul> 051 * <li> <b>Minimum Value:</b> -1.0 052 * <li> <b>Maximum Value:</b> 1.0 053 * <li> <b>Default Value:</b> 1 054 * <li> <b>Units:</b> fractional 055 * </ul> 056 */ 057 public double PeakForwardDutyCycle = 1; 058 /** 059 * Minimum (reverse) output during duty cycle based control modes. 060 * 061 * <ul> 062 * <li> <b>Minimum Value:</b> -1.0 063 * <li> <b>Maximum Value:</b> 1.0 064 * <li> <b>Default Value:</b> -1 065 * <li> <b>Units:</b> fractional 066 * </ul> 067 */ 068 public double PeakReverseDutyCycle = -1; 069 070 @Override 071 public String toString() 072 { 073 String ss = "Config Group: MotorOutput\n"; 074 ss += "Name: \"Inverted\" Value: \"" + Inverted + "\"" + "\n"; 075 ss += "Name: \"NeutralMode\" Value: \"" + NeutralMode + "\"" + "\n"; 076 ss += "Name: \"DutyCycleNeutralDeadband\" Value: \"" + DutyCycleNeutralDeadband + "fractional\"" + "\n"; 077 ss += "Name: \"PeakForwardDutyCycle\" Value: \"" + PeakForwardDutyCycle + "fractional\"" + "\n"; 078 ss += "Name: \"PeakReverseDutyCycle\" Value: \"" + PeakReverseDutyCycle + "fractional\"" + "\n"; 079 return ss; 080 } 081 082 /** 083 * 084 */ 085 public StatusCode deserialize(String string) 086 { 087 Inverted = InvertedValue.valueOf(ConfigJNI.Deserializeint(SpnValue.Config_Inverted.value, string)); 088 NeutralMode = NeutralModeValue.valueOf(ConfigJNI.Deserializeint(SpnValue.Config_NeutralMode.value, string)); 089 DutyCycleNeutralDeadband = ConfigJNI.Deserializedouble(SpnValue.Config_DutyCycleNeutralDB.value, string); 090 PeakForwardDutyCycle = ConfigJNI.Deserializedouble(SpnValue.Config_PeakForwardDC.value, string); 091 PeakReverseDutyCycle = ConfigJNI.Deserializedouble(SpnValue.Config_PeakReverseDC.value, string); 092 return StatusCode.OK; 093 } 094 095 /** 096 * 097 */ 098 public String serialize() 099 { 100 String ss = ""; 101 ss += ConfigJNI.Serializeint(1422, Inverted.value); 102 ss += ConfigJNI.Serializeint(1425, NeutralMode.value); 103 ss += ConfigJNI.Serializedouble(1426, DutyCycleNeutralDeadband); 104 ss += ConfigJNI.Serializedouble(1431, PeakForwardDutyCycle); 105 ss += ConfigJNI.Serializedouble(1432, PeakReverseDutyCycle); 106 return ss; 107 } 108} 109