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.signals; 008 009import java.util.HashMap; 010 011/** 012 * Check if Motion Magic® is running. This is equivalent to checking that the 013 * reported control mode is a Motion Magic® based mode. 014 * 015 * @deprecated Classes in the phoenixpro package will be removed in 2024. 016 * Users should instead use classes from the phoenix6 package. 017 */ 018@Deprecated(forRemoval = true) 019public enum MotionMagicIsRunningValue 020{ 021 Enabled(1), 022 Disabled(0),; 023 024 public final int value; 025 026 MotionMagicIsRunningValue(int initValue) 027 { 028 this.value = initValue; 029 } 030 031 private static HashMap<Integer, MotionMagicIsRunningValue> _map = null; 032 static 033 { 034 _map = new HashMap<Integer, MotionMagicIsRunningValue>(); 035 for (MotionMagicIsRunningValue type : MotionMagicIsRunningValue.values()) 036 { 037 _map.put(type.value, type); 038 } 039 } 040 041 /** 042 * Gets MotionMagicIsRunningValue from specified value 043 * @param value Value of MotionMagicIsRunningValue 044 * @return MotionMagicIsRunningValue of specified value 045 */ 046 public static MotionMagicIsRunningValue valueOf(int value) 047 { 048 MotionMagicIsRunningValue retval = _map.get(value); 049 if(retval != null) return retval; 050 return MotionMagicIsRunningValue.values()[0]; 051 } 052}