Added defmt logging
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
use crate::{Protocol300Message, message};
|
||||
use thiserror::Error;
|
||||
use log::error;
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt::{error};
|
||||
|
||||
#[cfg(feature = "log")]
|
||||
use log::{error};
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec;
|
||||
@@ -36,7 +42,7 @@ impl Protocol300Transmission {
|
||||
[0x16, 0x00, 0x00] => Ok(Self::Init),
|
||||
[0x41, ..] => Ok(Self::Message(Protocol300Message::try_from_bytes(bytes)?)),
|
||||
_ => {
|
||||
error!("Failed to parse Protocol300 transmission: invalid byte sequence (length: {}, first byte: 0x{:02X?})",
|
||||
error!("Failed to parse Protocol300 transmission: invalid byte sequence (length: {}, first byte: 0x{:02X})",
|
||||
bytes.len(),
|
||||
bytes.first().unwrap_or(&0x00));
|
||||
Err(FromBytesError::InvalidByte)
|
||||
|
||||
Reference in New Issue
Block a user