added more tracks and disabled tail wagging
above some volume level the speakers draw enough current to get the r40 to reset, causing incorrect reads
This commit is contained in:
parent
e04f02ccff
commit
d034bbd989
4 changed files with 17 additions and 7 deletions
|
@ -42,6 +42,7 @@ impl Name {
|
|||
0x6b859025842cd369 => Self::Andy,
|
||||
0xb366d73deaaa8d9d => Self::Felix,
|
||||
0x30c79f56dc74f998 => Self::Phil,
|
||||
0xb64c08f6b9a50281 => Self::Michael,
|
||||
_ => Self::Unknown,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ async fn button_manager(pin: PIN_22) -> ! {
|
|||
let mut button = Input::new(pin, embassy_rp::gpio::Pull::Up);
|
||||
loop {
|
||||
button.wait_for_rising_edge().await;
|
||||
COMMANDS.send(music::MusicCommand::Play("a1")).await; // TODO: record
|
||||
COMMANDS.send(music::MusicCommand::Button()).await;
|
||||
Timer::after_millis(800).await;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use rand::RngCore;
|
|||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::scanner::LOCKOUT;
|
||||
use crate::server::NAMES;
|
||||
use crate::wiggle::WAGS;
|
||||
use crate::Irqs;
|
||||
|
@ -71,8 +72,8 @@ impl Tracks for Name {
|
|||
|
||||
}
|
||||
|
||||
static ACCEPTED_SUFFIXABLE: [bool; 6] = [false, false, false, false, false, true];
|
||||
static DENIED_SUFFIXABLE: [bool; 6] = [false, false, false, false, false, true];
|
||||
static ACCEPTED_SUFFIXABLE: [bool; 11] = [false, false, false, false, false, true, true, false, true, false, true];
|
||||
static DENIED_SUFFIXABLE: [bool; 17] = [false, false, false, false, false, true, false, true, true, true, true, false, false, true, true, false, false];
|
||||
|
||||
pub enum MusicCommand {
|
||||
/// play a random clip for name, accepted if true
|
||||
|
@ -144,6 +145,7 @@ pub async fn music_manager(uart: UART1, irqs: Irqs, txp: PIN_20, rxp: PIN_21) ->
|
|||
|
||||
async fn play_song<'a>(prefix: &str, index: Option<u8>, uart: &mut BufferedUart<'a, UART1>) {
|
||||
info!("playing: {}{}.mp3",prefix,index.unwrap_or(0));
|
||||
LOCKOUT.store(true, core::sync::atomic::Ordering::SeqCst);
|
||||
|
||||
uart.write_all(b"AT+PLAYFILE=/").await.unwrap();
|
||||
uart.write_all(prefix.as_bytes()).await.unwrap();
|
||||
|
@ -158,11 +160,15 @@ async fn play_song<'a>(prefix: &str, index: Option<u8>, uart: &mut BufferedUart<
|
|||
uart.write_all(b"AT+QUERY=4\r\n").await.unwrap();
|
||||
let mut buffer = [0;512];
|
||||
let output = read_line(&mut buffer, uart).await;
|
||||
info!("len: {}", output.trim());
|
||||
|
||||
if let Ok(length) = output.trim().parse::<u64>() {
|
||||
WAGS.store((length as u8) * 2 + 1, core::sync::atomic::Ordering::SeqCst);
|
||||
Timer::after_secs(length).await;
|
||||
//WAGS.store((length as u8) * 2 + 1, core::sync::atomic::Ordering::SeqCst);
|
||||
Timer::after_secs(length.max(1)).await;
|
||||
} else {
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
LOCKOUT.store(false, core::sync::atomic::Ordering::SeqCst);
|
||||
}
|
||||
|
||||
async fn read_line<'a, 'b>(buffer: &'b mut [u8], uart: &mut BufferedUart<'a, UART1>) -> &'b str {
|
||||
|
|
|
@ -39,8 +39,11 @@ pub async fn data_extractor() -> ! {
|
|||
if LOCKOUT.load(core::sync::atomic::Ordering::Relaxed) {
|
||||
info!("scanner disabled");
|
||||
} else {
|
||||
CHANNEL.send(card).await;
|
||||
|
||||
if card == 0x1 || card == 0x0 || card == 0x5555555555555555 || card == 0xaaaaaaaaaaaaaaaa {
|
||||
info!("ignoring {card:#16x}");
|
||||
} else {
|
||||
CHANNEL.send(card).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
critical_section::with(|cs| {
|
||||
|
|
Loading…
Reference in a new issue