Skip to content

Commit 1b035f7

Browse files
committed
fix(controller): do not accept non config uids when not connected
1 parent e4a2a80 commit 1b035f7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/subsystems/controller.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ impl Controller {
8181
tokio::select! {
8282
result = uid_rx => {
8383
let uid = result?;
84-
self.led.send(LedState::On { color: YELLOW }).await?;
8584

8685
if config_uids.contains(&uid) {
86+
self.led.send(LedState::On { color: YELLOW }).await?;
87+
8788
if self.process_config_command(uid, &mut config_uids, nfc.clone()).await.is_ok() {
8889
self.led.send(LedState::On { color: CYAN }).await?;
8990
} else {
@@ -95,6 +96,13 @@ impl Controller {
9596
continue;
9697
}
9798

99+
if self.networker_status != NetworkerStatus::Connected {
100+
self.wait_for_release(&nfc).await?;
101+
continue;
102+
}
103+
104+
self.led.send(LedState::On { color: YELLOW }).await?;
105+
98106
let (done_tx, done_rx) = oneshot::channel();
99107
self.audio_player.send(PlayerCommand::PlayBloop { done: done_tx }).await?;
100108
done_rx.await?;

src/subsystems/networker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub type AchievementId = [u8; 20];
3131
#[error("Invalid credentials")]
3232
struct InvalidCredentialsError;
3333

34-
#[derive(Debug)]
34+
#[derive(Debug, PartialEq)]
3535
pub enum NetworkerStatus {
3636
NoConfig,
3737
InvalidCredentials,

0 commit comments

Comments
 (0)