> For the complete documentation index, see [llms.txt](https://erdilrf.gitbook.io/erdilrf-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://erdilrf.gitbook.io/erdilrf-docs/status-codes-and-known-limits.md).

# Status codes and known limits

Check the returned `ErdiStatus` before consuming a result. For a usable distance, also require `measurement.valid`, `!measurement.outOfRange` and a finite `measurement.metres`. The `valid` field alone is not an application-level success test.

## Status values in 0.1.1

| Value | Symbol                   | Meaning and handling                                                                                                                                                                      |
| ----- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0     | `ERDI_OK`                | The requested software operation completed. For a distance, still validate result fields and scaling.                                                                                     |
| 1     | `ERDI_ERR_TIMEOUT`       | No accepted frame was obtained before the configured timeout. This does not identify a unique cause.                                                                                      |
| 2     | `ERDI_ERR_CHECKSUM`      | Defined in the enum, but the frame readers used by this exercise discard checksum failures and eventually time out if no valid frame follows. Do not expect the corrupt case to return 2. |
| 3     | `ERDI_ERR_STATUS`        | A checked family A reply has a non-success status. Do not consume it as a successful distance.                                                                                            |
| 4     | `ERDI_ERR_UNSUPPORTED`   | The requested operation or supplied argument is not supported by that code path.                                                                                                          |
| 5     | `ERDI_ERR_PROTOCOL_HOLD` | The operation is held because the source protocol documentation leaves it unresolved.                                                                                                     |
| 6     | `ERDI_ERR_OUT_OF_RANGE`  | A family B raw value reached the model table's configured out-of-range marker. Do not treat it as a successful distance.                                                                  |

A timeout can result from missing data, an incomplete frame, a configuration mismatch or discarded bad input. Preserve raw receive bytes and the selected model/configuration when diagnosing a real integration.

## Unresolved source limits

* `LRF50VB`: the published README identifies a command-table/checksum mismatch. The generated-byte exercise does not transmit to a module or resolve it.
* `LRF1500H`: the README also retains checksum/sentinel example discrepancies. Do not extend the four-byte example to this model: its table uses a five-byte frame and a three-byte distance field.
* `SPD1200D03`: conflicting baud statements and missing distance scaling remain represented rather than guessed. In the library, an accepted frame can still produce `NAN` metres for this model.
* `LRF1200A1` and `LRF3000A1`: `startContinuous()` returns `ERDI_ERR_PROTOCOL_HOLD` by default. Setting its `acknowledgeHold` argument changes the software guard; it does not resolve the source discrepancy or validate hardware behavior.

Before using a real UART, confirm the exact model and controlled manual revision, delivered interface, supply, TX/RX logic levels, baud and grounding. A supply-voltage specification is not a logic-level specification. Retain the source version and raw bytes alongside any later physical test records.

These pages establish only the stated source reading, generated-byte execution and separately labelled compile-only result. They do not establish sensor range or accuracy, all-model or all-board support, or live ROS 2, PX4 or ArduPilot compatibility.

## License and attribution

The unchanged ErdiLRF 0.1.1 archive and the exercise helper/runner/shims carry MIT notices with the same copyright holder below. Preserve the library's distributed `LICENSE` and the exercise's `LICENSE-test-code.txt` when copying the source.

```
MIT License

Copyright (c) 2026 ERDI TECH LTD

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

### Output lifetime on an unsupported operation

A reused output object can still contain data from an earlier call when a new operation returns an error. In [ErdiLRF 0.1.1 at commit 085ddf](https://github.com/ErdiTech/ErdiLRF/blob/085ddf053c9b7631dee903ae31a651aaf9762fdc/src/ErdiLRF.cpp#L400-L418), `measureAngle(out)` checks the pointer and model support before clearing the output object. Its family-B and SPD1200D03 branches return `ERDI_ERR_UNSUPPORTED` before that clearing step.

An old `valid` flag or angle value therefore does not establish a new successful measurement. The returned status is the first gate.

| Call result                         | Application handling                                                                                                         |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `ERDI_ERR_UNSUPPORTED`              | Record the selected model and operation; do not consume the reused output as a new result.                                   |
| `ERDI_ERR_TIMEOUT` or another error | Keep the error and diagnostic evidence separate from accepted measurements.                                                  |
| `ERDI_OK`                           | Check the result fields required by that operation; for distance, retain the validity, range and finite-metres checks above. |

A fresh output object can make ownership clearer, but initializing fields does not turn an unsupported operation into a supported measurement. Keep each status associated with its own call. Neither the public header nor this note promises that every error path clears every field.

This describes the pinned software source, without a driver patch, new release or physical angle-sensor test. Prepared by the ERDILRF marketing and technical support team. Model documents: [erdilrf.com](https://erdilrf.com/). Technical questions: <tommy@erdimail.com>.
