changed NET_STACK_SIZE & WEB_TASK_SIZE

This commit is contained in:
Djeeberjr 2025-10-07 22:48:17 +02:00
parent 082f1faba9
commit 92c7fec283
2 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,10 @@ use embassy_time::{Duration, Timer};
use esp_wifi::wifi::WifiDevice; use esp_wifi::wifi::WifiDevice;
use static_cell::make_static; use static_cell::make_static;
pub const NETWORK_STACK_SIZE: usize = 5; use crate::webserver::WEB_TAKS_SIZE;
pub const NETWORK_STACK_SIZE: usize = WEB_TAKS_SIZE + 2; // + 2 for other network taks. Breaks
// without
pub fn setup_network<'a>(seed: u64, wifi: WifiDevice<'static>, spawner: &mut Spawner) -> Stack<'a> { pub fn setup_network<'a>(seed: u64, wifi: WifiDevice<'static>, spawner: &mut Spawner) -> Stack<'a> {
let gw_ip_addr_str = "192.168.2.1"; let gw_ip_addr_str = "192.168.2.1";

View File

@ -8,7 +8,6 @@ use static_cell::make_static;
use crate::{ use crate::{
UsedStore, UsedStore,
init::network::NETWORK_STACK_SIZE,
webserver::app::{AppProps, AppState}, webserver::app::{AppProps, AppState},
}; };
@ -17,6 +16,8 @@ mod assets;
mod api; mod api;
mod app; mod app;
pub const WEB_TAKS_SIZE: usize = 3; // Up this number if request start fail with Timeouts.
pub fn start_webserver( pub fn start_webserver(
spawner: &mut Spawner, spawner: &mut Spawner,
stack: Stack<'static>, stack: Stack<'static>,
@ -33,12 +34,12 @@ pub fn start_webserver(
write: Some(Duration::from_secs(5)), write: Some(Duration::from_secs(5)),
})); }));
for task_id in 0..NETWORK_STACK_SIZE { for task_id in 0..WEB_TAKS_SIZE {
spawner.must_spawn(webserver_task(task_id, stack, app, config, state)); spawner.must_spawn(webserver_task(task_id, stack, app, config, state));
} }
} }
#[embassy_executor::task(pool_size = NETWORK_STACK_SIZE)] #[embassy_executor::task(pool_size = WEB_TAKS_SIZE)]
async fn webserver_task( async fn webserver_task(
task_id: usize, task_id: usize,
stack: embassy_net::Stack<'static>, stack: embassy_net::Stack<'static>,