Package com.crossbotics.ftchelper.core
Enum Class Profile
- All Implemented Interfaces:
Serializable,Comparable<Profile>,Constable
Practice or competition. Lets the same code behave safely at an event and helpfully in the shop.
| PRACTICE | COMPETITION | |
|---|---|---|
| debug telemetry | on | off |
| tuning menu | allowed | blocked |
| your own values | Profile.pick(practiceValue, competitionValue) | |
The choice is saved on the Control Hub, so it stays until someone changes it
(with InitMenu.profile() or set(com.crossbotics.ftchelper.core.Profile)). The default is COMPETITION, the safe one.
double drivePower = Profile.pick(0.5, 1.0); // gentle in the shop, full power at events
if (Profile.current().isPractice()) { ... }
Java note: an "enum" is a fixed list of named choices. A Profile can only ever be PRACTICE or COMPETITION, so a typo cannot create a third, unknown profile. Docs: docs/guides/profiles.md
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAt an event: debug telemetry off, tuning menu blocked.In the shop: debug telemetry on, tuning menu allowed. -
Method Summary
Modifier and TypeMethodDescriptionstatic Profilecurrent()The active profile (read from the saved setting the first time).booleanTrue for PRACTICE.static booleanpick(boolean practice, boolean competition) Same aspick(Object, Object)for true/false.static doublepick(double practice, double competition) Same aspick(Object, Object)for numbers (no boxing).static <T> Tpick(T practice, T competition) One value for practice, another for competition.static voidFor tests: forget the loaded value so it is read again.static voidChanges the profile and saves it on the Control Hub.static ProfileReturns the enum constant of this class with the specified name.static Profile[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PRACTICE
In the shop: debug telemetry on, tuning menu allowed. -
COMPETITION
At an event: debug telemetry off, tuning menu blocked. The safe default.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
current
The active profile (read from the saved setting the first time). -
set
Changes the profile and saves it on the Control Hub.- Parameters:
profile- the new profile
-
resetForTests
public static void resetForTests()For tests: forget the loaded value so it is read again. -
pick
public static <T> T pick(T practice, T competition) One value for practice, another for competition.<T>is a "type placeholder" (a generic): it works for any kind of value (text, objects...), and you get back the same kind you gave.- Parameters:
practice- the value to use in PRACTICEcompetition- the value to use in COMPETITION- Returns:
practicein the PRACTICE profile, elsecompetition
-
pick
public static double pick(double practice, double competition) Same aspick(Object, Object)for numbers (no boxing). ("Boxing" is Java wrapping a plain number in an object; this version skips that.) -
pick
public static boolean pick(boolean practice, boolean competition) Same aspick(Object, Object)for true/false. -
isPractice
public boolean isPractice()True for PRACTICE.
-