Skip to content

Commit c3d8988

Browse files
committed
disable voice_interrupt
1 parent cc3037d commit c3d8988

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ cube2 = ["_no_default"]
3333
mfrc522 = ["ndef", "extra_server"]
3434
extra_server = []
3535

36+
voice_interrupt = []
37+
3638
[dependencies]
3739
log = "0.4"
3840
anyhow = "1.0"

src/app.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,13 @@ pub async fn main_work<'d>(
230230
}
231231
}
232232
Event::Event(Event::K0_) => {
233-
allow_interrupt = !allow_interrupt;
234-
log::info!("Set allow_interrupt to {}", allow_interrupt);
235-
gui.state = format!("Interrupt: {}", allow_interrupt);
236-
gui.display_flush().unwrap();
233+
#[cfg(feature = "voice_interrupt")]
234+
{
235+
allow_interrupt = !allow_interrupt;
236+
log::info!("Set allow_interrupt to {}", allow_interrupt);
237+
gui.state = format!("Interrupt: {}", allow_interrupt);
238+
gui.display_flush().unwrap();
239+
}
237240
}
238241
Event::Event(Event::VOL_UP) => {
239242
vol += 1;
@@ -262,11 +265,11 @@ pub async fn main_work<'d>(
262265
Event::Event(Event::YES | Event::K1) => {}
263266
Event::Event(Event::IDLE) => {
264267
log::info!("Received idle event");
265-
if state == State::Listening {
266-
state = State::Idle;
267-
gui.state = "Idle".to_string();
268-
gui.display_flush().unwrap();
269-
server.close().await?;
268+
if state == State::Listening {
269+
state = State::Idle;
270+
gui.state = "Idle".to_string();
271+
gui.display_flush().unwrap();
272+
server.close().await?;
270273
}
271274
}
272275
Event::Event(Event::NOTIFY) => {

0 commit comments

Comments
 (0)