added config sliders and vendored eframe's persistence path finder
This commit is contained in:
parent
d448f05dd7
commit
b567bf7528
4 changed files with 25 additions and 2 deletions
1
interface/Cargo.lock
generated
1
interface/Cargo.lock
generated
|
@ -1855,6 +1855,7 @@ dependencies = [
|
|||
"egui-toast",
|
||||
"egui_extras",
|
||||
"heapless",
|
||||
"home",
|
||||
"pitch-detection",
|
||||
"postcard",
|
||||
"rust-music-theory",
|
||||
|
|
|
@ -17,3 +17,4 @@ heapless = "0.7.0"
|
|||
eframe = "0.30"
|
||||
egui_extras = { version = "0.30", features = ["default", "image"] }
|
||||
egui-toast = "0.16.0"
|
||||
home = "0.5.11"
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
|
||||
use std::{cell::OnceCell, time::Duration};
|
||||
use std::{cell::OnceCell, path::PathBuf, time::Duration};
|
||||
|
||||
use common::{ControlPacket, TelemetryPacket};
|
||||
use eframe::egui::{self, containers, Align2, Checkbox, Context, Label};
|
||||
use eframe::egui::{self, containers, Align2, Checkbox, Context, Id, Label};
|
||||
use tokio::{runtime::Runtime, sync::{mpsc, watch::Receiver}};
|
||||
use egui_toast::{Toast, Toasts};
|
||||
|
||||
use crate::storage_dir::storage_dir;
|
||||
|
||||
pub const GUI: OnceCell<Context> = OnceCell::new();
|
||||
|
||||
pub fn gui(data: Receiver<GUIData>, toasts: mpsc::Receiver<Toast>, executor: Runtime) -> eframe::Result {
|
||||
|
@ -52,6 +54,24 @@ impl GUI {
|
|||
impl eframe::App for GUI {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
let _ = GUI.set(ctx.clone());
|
||||
let mut num = 0.0;
|
||||
let mut num2 = 0.0;
|
||||
let mut num3 = 0.0;
|
||||
let mut auto_idx = 0;
|
||||
egui::SidePanel::right(Id::new("config")).resizable(false).show(ctx, |ui| {
|
||||
ui.heading("configuration");
|
||||
ui.add(egui::Slider::new(&mut num, 0.0..=10.0).text("volume threshold"));
|
||||
ui.label("higher accepts less noise (better)");
|
||||
ui.add(egui::Slider::new(&mut num2, 0.0..=1.0).text("auto turn kP"));
|
||||
ui.add(egui::Slider::new(&mut num3, 30.0..=100.0).text("auto fire distance (mm)"));
|
||||
ui.horizontal(|ui| {
|
||||
egui::ComboBox::new("auto selector", "select auto")
|
||||
.show_index(ui, &mut auto_idx, 3, |n| ["a","b","c"][n]);
|
||||
ui.button("refresh").clicked();
|
||||
});
|
||||
println!("data {:?}", storage_dir("cruisecontrol"));
|
||||
});
|
||||
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("Cruise Control");
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use rust_music_theory::note::{Note, NoteLetter, Pitch, Tuning};
|
|||
use tokio::{io::{AsyncReadExt, AsyncWriteExt, BufWriter, WriteHalf}, net::{tcp::{OwnedReadHalf, OwnedWriteHalf}, TcpStream}, spawn, sync::{self, broadcast, mpsc, watch, RwLock}, time::timeout};
|
||||
|
||||
mod gui;
|
||||
mod storage_dir;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
// assumes pulseaudio system with f32 samples and 2204 sample packets
|
||||
|
|
Loading…
Reference in a new issue