001/* Copyright (C) Cross The Road Electronics 2024 */ 002package com.ctre.phoenix.sensors; 003 004/** 005 * @deprecated This device's Phoenix 5 API is deprecated for removal in the 006 * 2025 season. Users should update to Phoenix 6 firmware and migrate to the 007 * Phoenix 6 API. A migration guide is available at 008 * https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html. 009 * <p> 010 * If the Phoenix 5 API must be used for this device, the device must have 22.X 011 * firmware. This firmware is available in Tuner X after selecting Phoenix 5 in 012 * the firmware year dropdown. 013 */ 014@Deprecated(since = "2024", forRemoval = true) 015public enum SensorInitializationStrategy{ 016 /** 017 * On boot up, set position to zero. 018 */ 019 BootToZero (0), 020 /** 021 * On boot up, sync to the Absolute Position signal. The Absolute position signal will be signed according to the selected Absolute Sensor Range. 022 */ 023 BootToAbsolutePosition (1); 024 025 public final int value; 026 027 /** 028 * Create SensorInitializationStrategy of initValue 029 * @param initValue Value of SensorInitializationStrategy 030 */ 031 SensorInitializationStrategy(int initValue) 032 { 033 this.value = initValue; 034 } 035 036 /** 037 * String representation of specified SensorInitializationStrategy 038 * @return string representation of SensorInitializationStrategy 039 */ 040 public String toString() { 041 switch (value) { 042 case 0: return "On boot up, set position to zero."; 043 case 1: return " On boot up, sync to the Absolute Position signal."; 044 default: return "InvalidValue"; 045 } 046 } 047 /** public lookup to convert int to enum */ 048 public static SensorInitializationStrategy valueOf(int value) { 049 switch (value) { 050 default: // no break 051 case 0: return SensorInitializationStrategy.BootToZero; 052 case 1: return SensorInitializationStrategy.BootToAbsolutePosition; 053 } 054 } 055}