refactor: move net_task to network module

This commit is contained in:
2026-05-17 12:21:32 +02:00
parent cd4d0cc683
commit ba654a904b
2 changed files with 10 additions and 6 deletions

View File

@@ -40,7 +40,9 @@ use esp_radio::wifi::sta::StationConfig;
use esp_radio::wifi::{AuthenticationMethod, Config, Interface, WifiController};
use log::{error, info, warn};
use portable_atomic::AtomicBool;
use sntpc::{get_time, NtpContext, NtpTimestampGenerator, NtpUdpSocket};
use sntpc::{NtpContext, NtpTimestampGenerator, NtpUdpSocket, get_time};
use crate::network::net_task;
#[esp_hal::ram(unstable(rtc_fast), unstable(persistent))]
static mut LAST_WATERING_TIMESTAMP: [i64; PLANT_COUNT] = [0; PLANT_COUNT];
@@ -658,11 +660,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]
async fn run_dhcp(stack: Stack<'static>, ip: Ipv4Addr) {
use core::net::SocketAddrV4;

View File

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