Longer CW, blahblablah

This commit is contained in:
2025-10-19 15:50:13 +02:00
parent 8cab34faa0
commit f5ae204c98

View File

@ -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::<char>() as u8)
.collect::<Vec<_>>();
tokio::spawn(async move {
let _ = snd
.send("Skibditoilet".repeat(10).as_bytes().to_vec())
.await;
let _ = snd.send(data).await;
});
}