debugging

This commit is contained in:
2025-07-18 20:31:23 +01:00
parent 491b1982e8
commit ee88e956d9

View File

@@ -41,10 +41,11 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
if let Some(loc) = info.location() { if let Some(loc) = info.location() {
ufmt::uwriteln!( ufmt::uwriteln!(
&mut serial, &mut serial,
" At {}:{}:{}\r", " At {}:{}:{} - {}\r",
loc.file(), loc.file(),
loc.line(), loc.line(),
loc.column(), loc.column(),
info.message().as_str().unwrap_or("<no message avaliable>")
) )
.unwrap_infallible(); .unwrap_infallible();
} }
@@ -523,6 +524,7 @@ impl Show for NumberInput {
} }
} }
#[derive(uDebug)]
enum State { enum State {
EnterSignificant, EnterSignificant,
EnterExponent, EnterExponent,
@@ -596,7 +598,7 @@ fn main() -> ! {
let key = key.and_then(|(no, kn, ko)| InputKey::map(no, kn, ko)); let key = key.and_then(|(no, kn, ko)| InputKey::map(no, kn, ko));
if let Some(key) = debounce.input(key) { if let Some(key) = debounce.input(key) {
ufmt::uwriteln!(&mut serial, "key: {:?}", key).unwrap_infallible(); ufmt::uwriteln!(&mut serial, "key: {:?} state: {:?}", key, state).unwrap_infallible();
let res = match state { let res = match state {
State::EnterSignificant => match key { State::EnterSignificant => match key {
InputKey::C => Ok(number_input.reset()), InputKey::C => Ok(number_input.reset()),
@@ -666,6 +668,7 @@ fn main() -> ! {
state = State::Err state = State::Err
} }
ufmt::uwriteln!(&mut serial, "state: {:?}", state).unwrap_infallible();
match state { match state {
State::EnterSignificant | State::EnterExponent | State::EnterOperation => { State::EnterSignificant | State::EnterExponent | State::EnterOperation => {
number_input.show(&mut display) number_input.show(&mut display)