Skip to content

Commit 890af76

Browse files
thejpstereldruin
authored andcommitted
Fix logging to work on defmt or log or neither.
1 parent 01b2a4b commit 890af76

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/fat/volume.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,9 @@ impl FatVolume {
828828
debug!("Am waiting for LFN start");
829829
let mut remaining = match_name;
830830
if let Some((true, sequence, csum, buffer)) = odde.lfn_contents() {
831+
#[cfg(feature = "defmt-log")]
832+
debug!("{:02x} {:02x} {:04x}", sequence, csum, buffer);
833+
#[cfg(feature = "log")]
831834
debug!("{:02x} {:02x} {:04x?}", sequence, csum, buffer);
832835
// trim padding and NUL words off the end of the file name (which is the part that comes first)
833836
for word in buffer
@@ -879,6 +882,9 @@ impl FatVolume {
879882
);
880883
let mut remaining = remaining;
881884
if let Some((false, this_sequence, this_csum, buffer)) = odde.lfn_contents() {
885+
#[cfg(feature = "defmt-log")]
886+
debug!("{:02x} {:02x} {:04x}", sequence, csum, buffer);
887+
#[cfg(feature = "log")]
882888
debug!("{:02x} {:02x} {:04x?}", sequence, csum, buffer);
883889
if (this_sequence != sequence) || (this_csum != csum) {
884890
// not what we wanted
@@ -928,7 +934,7 @@ impl FatVolume {
928934
result = Ok(de.clone());
929935
return Continue::No;
930936
} else {
931-
debug!("Bad csum {:02x} != {:02x}", calc_csum, csum)
937+
debug!("Bad csum {:02x} != {:02x}", calc_csum, csum);
932938
}
933939
}
934940
}

0 commit comments

Comments
 (0)