From f5ae204c98747a9c30f8f7f828c721cf9ffae0ad Mon Sep 17 00:00:00 2001 From: Albin Chaboissier Date: Sun, 19 Oct 2025 15:50:13 +0200 Subject: [PATCH] Longer CW, blahblablah --- src/main.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4cc5797..73be544 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ use eframe::egui::{self, CentralPanel, Color32, RichText}; use tokio::sync::RwLock; use tokio::sync::mpsc::{Receiver, Sender, channel}; -const BAUD_RATE: u32 = 700; +const BAUD_RATE: u32 = 1000; const SAMPLE_RATE: u32 = 48000; // Modulation parameters @@ -295,7 +295,7 @@ impl Transceiver { current_message = Some((tx_stream_receiver).recv().await.unwrap()); } state_tx.try_send(TransceiverState::Listening); - tokio::time::sleep(Duration::from_secs(rand::random_range(1..3))).await; + tokio::time::sleep(Duration::from_millis(500 * rand::random_range(1..6))).await; current_message.as_ref().unwrap() } => { @@ -417,7 +417,7 @@ impl Frame { let mut output_bytes = vec![]; // Initial training sequence - output_bytes.append(&mut vec![0b01010101; 64]); + output_bytes.append(&mut vec![0b01010101; 32]); // Preamble byte output_bytes.push(0xD8); @@ -445,7 +445,7 @@ impl Frame { } // SEND EOT - output_bytes.extend(std::iter::repeat_n(4, 32)); + output_bytes.extend(std::iter::repeat_n(4, 16)); output_bytes } } @@ -610,10 +610,12 @@ impl eframe::App for EguiApp { ui.horizontal(|ui| { if ui.button("Start").clicked() { let snd = self.transceiver.get_sender(); + let data = (0..rand::random_range(50..250)) + .map(|_| rand::random::() as u8) + .collect::>(); + tokio::spawn(async move { - let _ = snd - .send("Skibditoilet".repeat(10).as_bytes().to_vec()) - .await; + let _ = snd.send(data).await; }); }