change wifi name + handle client bad request

This commit is contained in:
Arkitu 2025-04-27 15:21:33 +02:00
parent c0402e0dca
commit 937aafb099
2 changed files with 23 additions and 5 deletions

View File

@ -123,8 +123,8 @@ async fn main(spawner: Spawner) {
unwrap(spawner.spawn(net_task(runner))).await;
#[cfg(not(feature = "wifi-connect"))]
//control.start_ap_open("cyw43", 5).await;
control.start_ap_wpa2("cyw43", "password", 5).await;
control.start_ap_open("TicTacToe", 5).await;
// control.start_ap_wpa2("TicTacToe", "password", 5).await;
#[cfg(feature = "wifi-connect")]
{

View File

@ -5,7 +5,6 @@ use embassy_time::{Duration, Timer};
use embedded_io_async::Write as _;
use heapless::Vec;
use log::{info, warn};
use pico_website::unwrap;
use crate::game::{GameClient, Team};
@ -77,7 +76,17 @@ pub async fn listen_task(stack: embassy_net::Stack<'static>, team: Team, port: u
Some(b"GET") => HttpRequestType::Get,
Some(b"POST") => HttpRequestType::Post,
Some(t) => {
warn!("Unknown request type : {}", unwrap(from_utf8(t)).await);
match from_utf8(t) {
Ok(t) => {
warn!("Unknown request type : {}", t);
}
Err(e) => {
warn!(
"Error while parsing request type : {}\nRaw type : {:?}",
e, t
);
}
}
break;
}
None => {
@ -86,7 +95,16 @@ pub async fn listen_task(stack: embassy_net::Stack<'static>, team: Team, port: u
}
},
match l1.next() {
Some(path) => unwrap(from_utf8(path)).await,
Some(path) => match from_utf8(path) {
Ok(p) => p,
Err(e) => {
warn!(
"Error while parsing requested path : {}\nRaw path : {:?}",
e, path
);
break;
}
},
None => {
warn!("No path");
break;