adda lot of basic webserver back

This commit is contained in:
2025-09-15 01:21:50 +02:00
parent 049a9d027c
commit 65f6670ca4
6 changed files with 279 additions and 142 deletions

View File

@@ -35,7 +35,9 @@ use embassy_net::{IpListenEndpoint, Ipv4Cidr, Runner, Stack, StackResources, Sta
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_sync::once_lock::OnceLock;
use embassy_time::{Duration, Timer};
use esp_bootloader_esp_idf::partitions::DataPartitionSubType;
use esp_bootloader_esp_idf::partitions::{
AppPartitionSubType, DataPartitionSubType, PartitionEntry,
};
use esp_hal::clock::CpuClock;
use esp_hal::gpio::{Input, InputConfig, Io, Pull};
use esp_hal::timer::systimer::SystemTimer;
@@ -286,6 +288,23 @@ impl PlantHal {
println!("current {:?} - next {:?}", current, current.next());
let ota_state = ota.current_ota_state()?;
let current_app = if current.number() == 0 {
pt.find_partition(esp_bootloader_esp_idf::partitions::PartitionType::App(
AppPartitionSubType::Ota0,
))
} else {
pt.find_partition(esp_bootloader_esp_idf::partitions::PartitionType::App(
AppPartitionSubType::Ota1,
))
};
let app_address = match current_app {
Result::Ok(part) => match part {
None => 0,
Some(entry) => entry.offset(),
},
Err(_) => 0,
};
let mut esp = Esp {
rng,
controller: Some(controller),
@@ -294,6 +313,7 @@ impl PlantHal {
mqtt_client: None,
storage,
slot: current.number(),
slot_addres: app_address,
next_slot: current.next().number(),
ota_state,
wall_clock_offset: 0,