Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
liamkinne committed Sep 5, 2024
1 parent cac5a4d commit e2452a8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ pub enum SendDataError {
ModuleBusy,
/// Payload too long.
PayloadInvalid,
/// Unrecognised error response.
Other(u8),
/// Error code not recognised by this library.
Unknown(u8),
}

impl From<u8> for SendDataError {
fn from(value: u8) -> Self {
match value {
0x01 => SendDataError::AckTimeout,
0x02 => SendDataError::InvalidChannel,
0x03 => SendDataError::ChannelBusy,
0x04 => SendDataError::ModuleBusy,
0xFF => SendDataError::PayloadInvalid,
_ => SendDataError::Other(value),
0x01 => Self::AckTimeout,
0x02 => Self::InvalidChannel,
0x03 => Self::ChannelBusy,
0x04 => Self::ModuleBusy,
0xFF => Self::PayloadInvalid,
_ => Self::Unknown(value),
}
}
}
Expand Down

0 comments on commit e2452a8

Please sign in to comment.