Settings
package com.skeletonarmy.marrow.settings
Overview
Settings provide a simple way to store, change, and persist configuration values on the robot - even after the robot gets restarted. This is useful for things like enabling a debug mode, adjusting teleop or autonomous behavior, or saving preferences across sessions.
You can configure these options inside a SettingsOpMode, which lets you edit values directly from the Driver Hub - no code changes or redeploys required.

We strongly recommend disabling any settings that could interfere with TeleOp before starting autonomous to avoid issues in a match.
Usage
Defining Settings
To define settings, extend SettingsOpMode and implement defineSettings():
Each setting requires:
Key - a unique, case-insensitive identifier.
Display Name - shown in the menu on the driver station.
Prompt - an instance of a
Prompt<T>which determines how the value is entered.
Interacting With Settings
When the OpMode runs:
Navigate options using the D-PAD.
Press A to modify a setting.
Press B to exit a prompt without saving changes.
Settings are automatically saved to a JSON file on the Control Hub (FIRST/marrow/settings.json).
Accessing Settings in Code
Use the Settings API to read or write settings programmatically:
get(key, defaultValue)retrieves a value, returning the default if missing.set(key, value, (optional) save)- Stores a value under the given key. Ifsaveistrue(default), the settings are immediately written to file.
You can use Settings even without any SettingsOpMode. It can serve simply as a central hub for saving variables between OpModes and restarts.
Last updated