16 Commits

Author SHA1 Message Date
0ab1ea3635 build: add build artifacts to .gitignore 2026-05-10 14:39:24 +02:00
ae73f12d1c build: add image_build.sh and erase_ota.sh scripts 2026-05-10 14:39:22 +02:00
cfe1c2c6d8 build: add flash.sh and all.sh scripts 2026-05-10 14:39:20 +02:00
578379c0d9 build: remove webpack integration from build.rs and add always-rebuild sentinel 2026-05-10 14:39:19 +02:00
2ff219a1cb build: add reusable build_website.sh script 2026-05-10 14:39:16 +02:00
96023c8dc3 Merge branch 'refactor/mkstatic-util' into legacy/v3-support 2026-05-10 14:04:25 +02:00
7497a8c05d refactor: create util module with shared mk_static
- use crate::util::mk_static in network module
- use crate::util::mk_static in mqtt module
- use crate::util::mk_static in hal module
- remove dead mk_static macro from esp module
2026-05-10 14:01:57 +02:00
d3d8d829be Merge branch 'refactor/network-module' into legacy/v3-support 2026-05-10 13:38:24 +02:00
6889ba4561 refactor: move try_connect_wifi_sntp_mqtt to network module 2026-05-10 13:34:34 +02:00
18095349f3 refactor: move wifi to network module 2026-05-10 13:34:32 +02:00
3d8fd893f5 refactor: move wifi_ap to network module 2026-05-10 13:34:30 +02:00
1bea7ef2f4 refactor: move sntp to network module 2026-05-10 13:34:28 +02:00
f5b9674840 refactor: move run_dhcp to network module 2026-05-10 13:34:25 +02:00
6f22881007 refactor: move net_task to network module 2026-05-10 13:34:23 +02:00
1d8af1b6c4 refactor: create network module
- move NetworkMode and SntpMode enums
2026-05-10 13:33:52 +02:00
2c532359fc Merge branch 'refactor/mqtt-module' into legacy/v3-support 2026-05-10 01:59:07 +02:00
6 changed files with 14 additions and 34 deletions

View File

@@ -120,15 +120,6 @@ pub struct Esp<'a> {
// CPU cores/threads, reconsider this.
unsafe impl Send for Esp<'_> {}
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
impl Esp<'_> {
pub fn get_time(&self) -> DateTime<Utc> {
DateTime::from_timestamp_micros(self.rtc.current_time_us() as i64)

View File

@@ -282,14 +282,7 @@ pub struct FreePeripherals<'a> {
pub adc1: ADC1<'a>,
}
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
use crate::util::mk_static;
impl PlantHal {
pub async fn create() -> Result<Mutex<CriticalSectionRawMutex, HAL<'static>>, FatError> {

View File

@@ -71,6 +71,7 @@ mod mqtt;
mod network;
mod plant_state;
mod tank;
mod util;
mod webserver;
extern crate alloc;

View File

@@ -110,14 +110,7 @@ async fn publish_inner(subtopic: &str, message: &str) -> FatResult<()> {
}
}
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
use crate::util::mk_static;
pub async fn mqtt_init(
network_config: &'static NetworkConfig,

View File

@@ -3,6 +3,7 @@ use crate::config::NetworkConfig;
use crate::fat_error::{ContextExt, FatError, FatResult};
use crate::hal::{PlantHal, HAL};
use crate::mqtt;
use crate::util::mk_static;
use alloc::string::{String, ToString};
use alloc::sync::Arc;
use chrono::{DateTime, Utc};
@@ -196,15 +197,6 @@ pub(crate) async fn run_dhcp(stack: Stack<'static>, ip: Ipv4Addr) {
}
}
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
pub async fn wifi_ap(
ssid: String,
interface_ap: Interface<'static>,

10
rust/src/util.rs Normal file
View File

@@ -0,0 +1,10 @@
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
pub(crate) use mk_static;