# Configuring a DetachedEncoder

This page discusses configuration concepts specific to DetachedEncoders, such as the MAXSpline Encoder.  For more information on general configuration in REVLib, see [this page](/revlib/configuring-devices.md).

## Configuration Classes

The MAXSpine Encoder uses a common configuration class, `DetachedEncoderConfig`.&#x20;

### API Documentation

For more information about what configurations and sub-configuration classes each class provides, refer to the links below:

| `DetachedEncoderConfig` | [Java](https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/sparkmaxconfig) | [C++](https://codedocs.revrobotics.com/cpp/classrev_1_1spark_1_1_spark_max_config.html) |
| ----------------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |

## Persisting Parameters

Configuring a DetachedEncoder automatically persists the configuration settings between power cycles when calling the `configure()` method.

Persisting parameters involves saving them to the device's memory, which is time-intensive and blocks communication with the device.

### Use Cases

It is recommended to update the majority of device parameters during the initial configuration of the device at the start of your program to ensure that the controller retains its configuration in the event of a power cycle during operation, e.g., due to a breaker trip or a brownout.

It is generally recommended not to make configuration updates mid-operation to avoid blocking the program and affecting the robot's performance.

Below is an example of either case:

{% tabs %}
{% tab title="Java" %}

```java
Robot() {
    DetachedEncoderConfig config = new DetachedEncoderConfig();
    config
        .inverted(true)
        .velocityConversionFactor(1.23)
        .positionConversionFactor(360);

    // Persist parameters and reset any not explicitly set above to
    // their defaults.
    SplineEncoder splineEncoder = new SplineEncoder(42);
    splineEncoder.configure(config, ResetMode.kResetSafeParameters);
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revrobotics.com/revlib/smart-sensors/configuring-a-detachedencoder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
