001package com.ctre.phoenix.sensors; 002 003public enum SensorInitializationStrategy{ 004 /** 005 * On boot up, set position to zero. 006 */ 007 BootToZero (0), 008 /** 009 * On boot up, sync to the Absolute Position signal. The Absolute position signal will be signed according to the selected Absolute Sensor Range. 010 */ 011 BootToAbsolutePosition (1); 012 013 public final int value; 014 015 /** 016 * Create SensorInitializationStrategy of initValue 017 * @param initValue Value of SensorInitializationStrategy 018 */ 019 SensorInitializationStrategy(int initValue) 020 { 021 this.value = initValue; 022 } 023 024 /** 025 * String representation of specified SensorInitializationStrategy 026 * @return string representation of SensorInitializationStrategy 027 */ 028 public String toString() { 029 switch (value) { 030 case 0: return "On boot up, set position to zero."; 031 case 1: return " On boot up, sync to the Absolute Position signal."; 032 default: return "InvalidValue"; 033 } 034 } 035 /** public lookup to convert int to enum */ 036 public static SensorInitializationStrategy valueOf(int value) { 037 switch (value) { 038 default: // no break 039 case 0: return SensorInitializationStrategy.BootToZero; 040 case 1: return SensorInitializationStrategy.BootToAbsolutePosition; 041 } 042 } 043}