Clean up old warnings and set up tasks to build all active projects #287

Merged
savanni merged 9 commits from nix-build-updates into main 2025-01-19 19:57:13 +00:00
3 changed files with 26 additions and 9 deletions
Showing only changes of commit d5b4d051a5 - Show all commits

1
Cargo.lock generated
View File

@ -3743,6 +3743,7 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
name = "simulator"
version = "0.1.0"
dependencies = [
"async-std",
"cairo-rs",
"fixed",
"gio",

View File

@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] }
async-std = "1.13.0"
cairo-rs = { version = "0.18" }
fixed = { version = "1" }
gio = { version = "0.18" }

View File

@ -1,6 +1,7 @@
use adw::prelude::*;
use async_std::channel::Sender;
use fixed::types::{I8F8, U128F0};
use glib::{Object, Sender};
use glib::Object;
use gtk::subclass::prelude::*;
use lights_core::{
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) {
self.tx
let tx = self.tx.clone();
glib::spawn_future(async move {
let _ = tx
.send(Update {
dashboard: dashboard_lights,
lights,
})
.unwrap();
.await;
});
}
}
@ -188,8 +192,7 @@ fn main() {
.build();
adw_app.connect_activate(move |adw_app| {
let (update_tx, update_rx) =
gtk::glib::MainContext::channel::<Update>(gtk::glib::Priority::DEFAULT);
let (update_tx, update_rx) = async_std::channel::unbounded();
let (event_tx, event_rx) = std::sync::mpsc::channel();
std::thread::spawn(move || {
@ -281,6 +284,17 @@ fn main() {
layout.append(&dashboard_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, {
let dashboard_lights = dashboard_lights.clone();
let bike_lights = bike_lights.clone();
@ -290,6 +304,7 @@ fn main() {
glib::ControlFlow::Continue
}
});
*/
window.set_content(Some(&layout));
window.present();