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 AbsoluteSensorRange{ 016 /** 017 * Express the absolute position as an unsigned value. 018 * E.g. [0,+1) rotations or [0,360) deg. 019 */ 020 Unsigned_0_to_360 (0), 021 /** 022 * Express the absolute position as an signed value. 023 * E.g. [-0.5,+0.5) rotations or [-180,+180) deg. 024 */ 025 Signed_PlusMinus180 (1); 026 027 public final int value; 028 029 /** 030 * Create AbsoluteSensorRange of initValue 031 * @param initValue Value of AbsoluteSensorRange 032 */ 033 AbsoluteSensorRange(int initValue) 034 { 035 this.value = initValue; 036 } 037 038 /** 039 * @return string representation of AbsoluteSensorRange 040 */ 041 public String toString() { 042 switch (value) { 043 case 0: return "Unsigned: 0 to 360 deg (positive full rotation"; 044 case 1: return "Signed: -180 to 180 deg (plus/minus half a rotation)"; 045 default: return "InvalidValue"; 046 } 047 } 048 /** public lookup to convert int to enum */ 049 public static AbsoluteSensorRange valueOf(int value) { 050 switch (value) { 051 default: // no break 052 case 0: return AbsoluteSensorRange.Unsigned_0_to_360; 053 case 1: return AbsoluteSensorRange.Signed_PlusMinus180; 054 } 055 } 056}