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 SensorTimeBase{
016    /**
017     * Legacy Mode
018     */
019    Per100Ms_Legacy (0),
020    /**
021     * Per-Second Velocities
022     */
023    PerSecond (1),
024    /**
025     * Per-Minute Velocities
026     */
027    PerMinute (2);
028
029    public final int value;
030
031    /**
032         * Create SensorTimeBase of initValue
033         * @param initValue Value of SensorTimeBase
034         */
035        SensorTimeBase(int initValue)
036        {
037                this.value = initValue;
038    }
039
040    /**
041     * String representation of specified SensorTimeBase
042     * @return string representation of SensorTimeBase
043     */
044    public String toString() {
045        switch (value) {
046            case 0: return "Per 100Ms (legacy)";
047            case 1: return "Per Second";
048            case 2: return "Per Minute";
049            default: return "InvalidValue";
050        }
051    }
052    /** public lookup to convert int to enum */
053    public static SensorTimeBase valueOf(int value) {
054        switch (value) {
055            default: // no break
056            case 0: return SensorTimeBase.Per100Ms_Legacy;
057            case 1: return SensorTimeBase.PerSecond;
058            case 2: return SensorTimeBase.PerMinute;
059        }
060    }
061}