From b63986711d4d96fe815d675c8eaeeabb0b948e17 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Sat, 22 Mar 2025 15:27:49 -0400 Subject: [PATCH] run (untested) --- interface/src/auto.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/src/auto.rs b/interface/src/auto.rs index 2a954f3..7aa55f8 100644 --- a/interface/src/auto.rs +++ b/interface/src/auto.rs @@ -1,10 +1,10 @@ -use std::{collections::VecDeque, ops::{Deref, Div, Index, Range, Sub}, sync::Arc}; +use std::{collections::VecDeque, future::Future, ops::{Deref, Div, Index, Range, Sub}, pin::Pin, sync::Arc}; use common::{CamState, ControlPacket, SensorData, TelemetryPacket}; use anyhow::{Context, Ok, Result}; use eframe::Storage; use libloading::{Library, Symbol}; -use tokio::sync::{self, broadcast, mpsc, watch}; +use tokio::{sync::{self, broadcast, mpsc, watch}, task::JoinHandle}; use crate::storage::StorageManager; @@ -118,7 +118,12 @@ impl Auto { } /// entrypoint - async fn run(&self, interface: &AutoInterface) { + pub async fn run(&self, interface: &AutoInterface) -> Result> { + let func: Symbol Pin + Send>>> = unsafe {self.library.get(b"entry")?}; + + let fut = unsafe { func(interface.clone()) }; + + Ok(tokio::spawn(fut)) } pub fn configs(&self) -> &'static [Configurable] {