Error handling for Feetech servo responses.
The status byte in response packets contains bit flags indicating various error conditions and the torque enable state.
Status Byte Bits
| Bit | Name | Description |
|---|---|---|
| 0 | Voltage | Over/under voltage detected |
| 1 | Sensor | Magnetic encoder error |
| 2 | Temperature | Over temperature |
| 3 | Current | Over current |
| 4 | Torque | Torque is enabled (not an error) |
| 5 | Overload | Overload protection triggered |
Summary
Functions
Converts error atoms to human-readable descriptions.
Returns true if the status byte indicates any error.
Parses a status byte into a structured result.
Types
@type error() ::
:voltage_error
| :sensor_error
| :temperature_error
| :current_error
| :overload_error
| :no_response
| :invalid_checksum
| :invalid_packet
| :incomplete_packet
| :invalid_header
| :unknown_register
| :timeout
Functions
Converts error atoms to human-readable descriptions.
@spec error?(non_neg_integer()) :: boolean()
Returns true if the status byte indicates any error.
@spec parse_status(non_neg_integer()) :: status_info()
Parses a status byte into a structured result.
Returns a map with detected errors and torque state.
Examples
iex> Feetech.Error.parse_status(0x00)
%{errors: [], torque_enabled: false}
iex> Feetech.Error.parse_status(0x10)
%{errors: [], torque_enabled: true}
iex> Feetech.Error.parse_status(0x25)
%{errors: [:voltage_error, :temperature_error, :overload_error], torque_enabled: false}