From 9c582a4de121dec3760c34ffe7f340cf1a93b005 Mon Sep 17 00:00:00 2001 From: Sofia Date: Wed, 3 Jun 2026 20:47:55 +0300 Subject: [PATCH] Fix bug with input handling --- src/at_commands.rs | 2 -- src/state.rs | 16 +++++++++------- src/states.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/at_commands.rs b/src/at_commands.rs index f33aff9..e556a45 100644 --- a/src/at_commands.rs +++ b/src/at_commands.rs @@ -141,8 +141,6 @@ impl<'a, 'd> ATCommands<'a, 'd> { .find(|(_, l)| l.starts_with(start)) .map(|(i, _)| i); - log::info!("{:?}", self.lines); - if let Some(start_idx) = start_idx { let mut response = Vec::new(); diff --git a/src/state.rs b/src/state.rs index eaabf04..eae09b0 100644 --- a/src/state.rs +++ b/src/state.rs @@ -79,14 +79,16 @@ pub struct StateManager<'a> { impl<'a> StateManager<'a> { pub fn update(&mut self) { - match self.curr_state.update(&mut self.data) { - Some(next_state) => { - self.curr_state = next_state; - self.curr_state.init(&mut self.data); + critical_section::with(|_| { + match self.curr_state.update(&mut self.data) { + Some(next_state) => { + self.curr_state = next_state; + self.curr_state.init(&mut self.data); + } + None => {} } - None => {} - } - self.data.io.keypad.clear(); + self.data.io.keypad.clear(); + }) } pub fn draw(&mut self) { diff --git a/src/states.rs b/src/states.rs index b54b6f2..630e69e 100644 --- a/src/states.rs +++ b/src/states.rs @@ -95,7 +95,7 @@ where Some(response) => { return Some((self.fun.clone())(response)); } - None => self.promise = None, + None => {} } return None; }