Added defmt logging

This commit is contained in:
2026-01-16 22:33:53 +01:00
parent d30a261e74
commit 6ca19f88fa
4 changed files with 91 additions and 4 deletions

View File

@@ -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)