Move configure out of run

This commit is contained in:
Ulf Lilleengen 2024-09-05 10:31:51 +02:00
parent 836e8add1b
commit 5d0ed24640
2 changed files with 3 additions and 3 deletions

View File

@ -284,8 +284,7 @@ impl<'a> Control<'a> {
} }
/// Run a control loop for this context, ensuring that reaattach is handled. /// Run a control loop for this context, ensuring that reaattach is handled.
pub async fn run<F: Fn(&Status)>(&self, config: &Config<'_>, reattach: F) -> Result<(), Error> { pub async fn run<F: Fn(&Status)>(&self, reattach: F) -> Result<(), Error> {
self.configure(config).await?;
let status = self.wait_attached().await?; let status = self.wait_attached().await?;
let mut fd = self.control.open_raw_socket().await; let mut fd = self.control.open_raw_socket().await;
reattach(&status); reattach(&status);

View File

@ -56,9 +56,10 @@ async fn control_task(
config: context::Config<'static>, config: context::Config<'static>,
stack: &'static Stack<embassy_net_nrf91::NetDriver<'static>>, stack: &'static Stack<embassy_net_nrf91::NetDriver<'static>>,
) { ) {
unwrap!(control.configure(&config).await);
unwrap!( unwrap!(
control control
.run(&config, |status| { .run(|status| {
stack.set_config_v4(status_to_config(status)); stack.set_config_v4(status_to_config(status));
}) })
.await .await