Clean up old warnings and set up tasks to build all active projects #287
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3743,6 +3743,7 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
|||||||
name = "simulator"
|
name = "simulator"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"async-std",
|
||||||
"cairo-rs",
|
"cairo-rs",
|
||||||
"fixed",
|
"fixed",
|
||||||
"gio",
|
"gio",
|
||||||
|
@ -7,6 +7,7 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] }
|
adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] }
|
||||||
|
async-std = "1.13.0"
|
||||||
cairo-rs = { version = "0.18" }
|
cairo-rs = { version = "0.18" }
|
||||||
fixed = { version = "1" }
|
fixed = { version = "1" }
|
||||||
gio = { version = "0.18" }
|
gio = { version = "0.18" }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
|
use async_std::channel::Sender;
|
||||||
use fixed::types::{I8F8, U128F0};
|
use fixed::types::{I8F8, U128F0};
|
||||||
use glib::{Object, Sender};
|
use glib::Object;
|
||||||
use gtk::subclass::prelude::*;
|
use gtk::subclass::prelude::*;
|
||||||
use lights_core::{
|
use lights_core::{
|
||||||
App, BodyPattern, DashboardPattern, Event, Instant, FPS, OFF_BODY, OFF_DASHBOARD, RGB, UI,
|
App, BodyPattern, DashboardPattern, Event, Instant, FPS, OFF_BODY, OFF_DASHBOARD, RGB, UI,
|
||||||
@ -173,12 +174,15 @@ impl UI for GTKUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn update_lights(&self, dashboard_lights: DashboardPattern, lights: BodyPattern) {
|
fn update_lights(&self, dashboard_lights: DashboardPattern, lights: BodyPattern) {
|
||||||
self.tx
|
let tx = self.tx.clone();
|
||||||
.send(Update {
|
glib::spawn_future(async move {
|
||||||
dashboard: dashboard_lights,
|
let _ = tx
|
||||||
lights,
|
.send(Update {
|
||||||
})
|
dashboard: dashboard_lights,
|
||||||
.unwrap();
|
lights,
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +192,7 @@ fn main() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
adw_app.connect_activate(move |adw_app| {
|
adw_app.connect_activate(move |adw_app| {
|
||||||
let (update_tx, update_rx) =
|
let (update_tx, update_rx) = async_std::channel::unbounded();
|
||||||
gtk::glib::MainContext::channel::<Update>(gtk::glib::Priority::DEFAULT);
|
|
||||||
let (event_tx, event_rx) = std::sync::mpsc::channel();
|
let (event_tx, event_rx) = std::sync::mpsc::channel();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
@ -281,6 +284,17 @@ fn main() {
|
|||||||
layout.append(&dashboard_lights);
|
layout.append(&dashboard_lights);
|
||||||
layout.append(&bike_lights);
|
layout.append(&bike_lights);
|
||||||
|
|
||||||
|
glib::spawn_future_local({
|
||||||
|
let dashboard_lights = dashboard_lights.clone();
|
||||||
|
let bike_lights = bike_lights.clone();
|
||||||
|
async move {
|
||||||
|
while let Ok(Update { dashboard, lights }) = update_rx.recv().await {
|
||||||
|
dashboard_lights.set_lights(dashboard);
|
||||||
|
bike_lights.set_lights(lights);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*
|
||||||
update_rx.attach(None, {
|
update_rx.attach(None, {
|
||||||
let dashboard_lights = dashboard_lights.clone();
|
let dashboard_lights = dashboard_lights.clone();
|
||||||
let bike_lights = bike_lights.clone();
|
let bike_lights = bike_lights.clone();
|
||||||
@ -290,6 +304,7 @@ fn main() {
|
|||||||
glib::ControlFlow::Continue
|
glib::ControlFlow::Continue
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
window.set_content(Some(&layout));
|
window.set_content(Some(&layout));
|
||||||
window.present();
|
window.present();
|
||||||
|
Loading…
Reference in New Issue
Block a user