forked from tock/libtock-rs
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I was noticed by @DanutAldea that the example app for the temperature API is not working as expected on microbit:v2. I found out that the app would freeze when it tries to write an empty string (in case of positive temperature):
Ok(temp_val) => writeln!(
Console::writer(),
"Temperature: {}{}.{}*C\n",
if temp_val > 0 { "" } else { "-" },
i32::abs(temp_val) / 100,
i32::abs(temp_val) % 100
)
The console write function calls yield, but it never receives a callback, because the transmit buffer function from the uart driver returns a SIZE error if buffer length is 0.
A possible fix would be adding a size check in the write function of the console API, preventing it from yielding in case of an empty string.
I have also tried to remove the size check from the driver, and it worked, but the other approach seems better.
@alexandruradovici , what do you think?
DanutAldea
Metadata
Metadata
Assignees
Labels
No labels