refactor: move net_task to network module

This commit is contained in:
2026-05-10 13:34:23 +02:00
parent 1d8af1b6c4
commit 6f22881007
2 changed files with 8 additions and 5 deletions

View File

@@ -47,6 +47,7 @@ use portable_atomic::AtomicBool;
use sntpc::{NtpContext, NtpTimestampGenerator, NtpUdpSocket, get_time}; use sntpc::{NtpContext, NtpTimestampGenerator, NtpUdpSocket, get_time};
use super::shared_flash::MutexFlashStorage; use super::shared_flash::MutexFlashStorage;
use crate::network::net_task;
#[esp_hal::ram(unstable(rtc_fast), unstable(persistent))] #[esp_hal::ram(unstable(rtc_fast), unstable(persistent))]
static mut LAST_WATERING_TIMESTAMP: [i64; PLANT_COUNT] = [0; PLANT_COUNT]; static mut LAST_WATERING_TIMESTAMP: [i64; PLANT_COUNT] = [0; PLANT_COUNT];
@@ -732,11 +733,6 @@ impl Esp<'_> {
} }
#[embassy_executor::task(pool_size = 2)]
async fn net_task(mut runner: Runner<'static, Interface<'static>>) {
runner.run().await;
}
#[embassy_executor::task] #[embassy_executor::task]
async fn run_dhcp(stack: Stack<'static>, ip: Ipv4Addr) { async fn run_dhcp(stack: Stack<'static>, ip: Ipv4Addr) {
use core::net::SocketAddrV4; use core::net::SocketAddrV4;

View File

@@ -1,5 +1,7 @@
use alloc::string::String; use alloc::string::String;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use embassy_net::Runner;
use esp_radio::wifi::Interface;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize, Debug, PartialEq)] #[derive(Serialize, Debug, PartialEq)]
@@ -17,3 +19,8 @@ pub enum NetworkMode {
}, },
OFFLINE, OFFLINE,
} }
#[embassy_executor::task(pool_size = 2)]
pub(crate) async fn net_task(mut runner: Runner<'static, Interface<'static>>) {
runner.run().await;
}