From 76058b572a26c572386bd8efb2a988dc09f60ba0 Mon Sep 17 00:00:00 2001 From: rhetenor Date: Thu, 3 Sep 2026 13:36:12 +0200 Subject: [PATCH] use own wifi implementation to connect to wifi. store credentials in flash. no wifi connection yet --- Cargo.lock | 1612 +----------------------- Cargo.toml | 6 +- partitions.csv | 9 +- src/background_tasks/nfc.rs | 3 +- src/bin/main.rs | 33 +- src/drivers/spi_bus.rs | 2 +- src/lib.rs | 16 +- src/navigation/navigation.rs | 4 +- src/network/wifi.rs | 183 ++- src/peripherals.rs | 4 +- src/peripherals/storage.rs | 1 + src/peripherals/storage/flash_store.rs | 112 -- src/peripherals/storage/settings.rs | 1 + src/peripherals/storage/store.rs | 2 + src/peripherals/storage/wifistore.rs | 136 ++ wokwi.toml | 9 +- 16 files changed, 344 insertions(+), 1789 deletions(-) delete mode 100644 src/peripherals/storage/flash_store.rs create mode 100644 src/peripherals/storage/wifistore.rs diff --git a/Cargo.lock b/Cargo.lock index 0c347ec..f6961f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,36 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.15", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "getrandom 0.3.4", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.5" @@ -41,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - [[package]] name = "allocator-api2" version = "0.3.1" @@ -77,25 +41,6 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" -[[package]] -name = "base64-simd" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" -dependencies = [ - "simd-abstraction", -] - -[[package]] -name = "base64-simd" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" -dependencies = [ - "outref 0.5.2", - "vsimd", -] - [[package]] name = "binary_serde" version = "1.0.25" @@ -157,18 +102,6 @@ version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" -[[package]] -name = "bitvec" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -178,43 +111,12 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" -dependencies = [ - "allocator-api2 0.2.21", -] - [[package]] name = "byte-slice-cast" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" -[[package]] -name = "bytecheck" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "bytemuck" version = "1.25.2" @@ -227,21 +129,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" - -[[package]] -name = "castaway" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" -dependencies = [ - "rustversion", -] - [[package]] name = "cc" version = "1.4.4" @@ -268,50 +155,12 @@ dependencies = [ "embedded-hal 1.0.0", ] -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror", -] - -[[package]] -name = "compact_str" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab" -dependencies = [ - "castaway", - "cfg-if", - "itoa", - "rustversion", - "ryu", - "static_assertions", -] - [[package]] name = "const-default" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" -[[package]] -name = "const-str" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f12cc9948ed9604230cdddc7c86e270f9401ccbe3c2e98a4378c5e7632212f" - -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "cordyceps" version = "0.3.5" @@ -322,21 +171,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "cow-utils" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" - -[[package]] -name = "crc32fast" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550" -dependencies = [ - "cfg-if", -] - [[package]] name = "creaturedex" version = "0.1.0" @@ -359,11 +193,12 @@ dependencies = [ "embedded-storage", "embedded-text", "esp-alloc", + "esp-backtrace", "esp-bootloader-esp-idf", "esp-hal", - "esp-hal-wifimanager", "esp-nvs", "esp-println", + "esp-radio", "esp-rtos", "esp-storage", "i2c-character-display", @@ -380,31 +215,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" -[[package]] -name = "crossbeam-deque" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" - [[package]] name = "crypto-common" version = "0.1.7" @@ -415,38 +225,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "cssparser" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98" -dependencies = [ - "cssparser-macros", - "dtoa-short", - "itoa", - "phf 0.13.1", - "smallvec", -] - -[[package]] -name = "cssparser-color" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa233e1dcd9c13a5d3e3a8a2c0f5a727bac380398345dbcb31db4597edc86b" -dependencies = [ - "cssparser", -] - -[[package]] -name = "cssparser-macros" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a2a99df6e410a8ff4245aa2006499ea662245f967cc7c0a38c83ef8eb44dbf" -dependencies = [ - "quote", - "syn 2.0.119", -] - [[package]] name = "darling" version = "0.20.11" @@ -550,34 +328,6 @@ dependencies = [ "syn 3.0.4", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - -[[package]] -name = "data-encoding" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" - -[[package]] -name = "data-url" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" -dependencies = [ - "matches", -] - [[package]] name = "defmt" version = "1.1.1" @@ -677,51 +427,6 @@ dependencies = [ "litrs", ] -[[package]] -name = "dragonbox_ecma" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d742b56656e8b14d63e7ea9806597b1849ae25412584c8adf78c0f67bd985e66" - -[[package]] -name = "dtoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" - -[[package]] -name = "dtoa-short" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" -dependencies = [ - "dtoa", -] - -[[package]] -name = "edge-dhcp" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0b32c831ced877a78378312fe0b6f7cdd5759f3ba272578f582ff9bba5291d" -dependencies = [ - "edge-raw", - "heapless 0.9.3", - "num_enum", - "rand_core 0.9.5", -] - -[[package]] -name = "edge-raw" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "466dfce9c2172a4e947b81b556f1f07a86029fbac679e323cfb66c738cc2faea" - -[[package]] -name = "either" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" - [[package]] name = "embassy-embedded-hal" version = "0.6.0" @@ -785,23 +490,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "embassy-net" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "347bc855bdbdf50ed9c5a1d80e8204badb0ba149b8732dde38e1e9708ed9d313" -dependencies = [ - "document-features", - "embassy-net-driver", - "embassy-sync 0.8.0", - "embassy-time", - "embedded-io-async 0.7.0", - "embedded-nal-async", - "heapless 0.9.3", - "managed", - "smoltcp", -] - [[package]] name = "embassy-net-driver" version = "0.2.0" @@ -975,12 +663,6 @@ dependencies = [ "embedded-hal 1.0.0", ] -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - [[package]] name = "embedded-io" version = "0.6.1" @@ -1011,25 +693,6 @@ dependencies = [ "embedded-io 0.7.1", ] -[[package]] -name = "embedded-nal" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "embedded-nal-async" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5a1bd585135d302f8f6d7de329310938093da6271b37a6c94b8798795c0c6d" -dependencies = [ - "embedded-io-async 0.7.0", - "embedded-nal", -] - [[package]] name = "embedded-storage" version = "0.3.1" @@ -1089,7 +752,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46ced060d4085858283df950b80a4da2348e1707d7d07b1e966308582dae79f5" dependencies = [ - "allocator-api2 0.3.1", + "allocator-api2", "cfg-if", "document-features", "enumset", @@ -1099,6 +762,23 @@ dependencies = [ "rlsf", ] +[[package]] +name = "esp-backtrace" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37950e24b2dfd98f1581102d1798281d4d9547af881e6bffc2c2b534c026ec8f" +dependencies = [ + "cfg-if", + "document-features", + "esp-config", + "esp-metadata-generated", + "esp-println", + "heapless 0.9.3", + "riscv", + "semihosting", + "xtensa-lx", +] + [[package]] name = "esp-bootloader-esp-idf" version = "0.5.0" @@ -1187,32 +867,6 @@ dependencies = [ "xtensa-lx-rt", ] -[[package]] -name = "esp-hal-dhcp-server" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15dbfc886c70ad3f81ea6eaec936e41b95fff21279620371715f5635df85f5ff" -dependencies = [ - "edge-dhcp", - "embassy-futures", - "embassy-net", - "embassy-sync 0.8.0", - "embassy-time", - "heapless 0.9.3", - "log", -] - -[[package]] -name = "esp-hal-ota" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b4ced6d9984fd29c88b586286634f44fa0d96b4ee5f4d68facdfb643336533" -dependencies = [ - "embedded-storage", - "esp32s3", - "log", -] - [[package]] name = "esp-hal-procmacros" version = "0.22.0" @@ -1228,36 +882,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "esp-hal-wifimanager" -version = "0.3.1" -source = "git+https://github.com/rhetenor/esp-hal-wifimanager.git#c35c2b35c9c4b724138f2c62a8aed9adf6365a7f" -dependencies = [ - "embassy-executor", - "embassy-futures", - "embassy-net", - "embassy-sync 0.7.2", - "embassy-time", - "embedded-io-async 0.7.0", - "embedded-storage", - "esp-hal", - "esp-hal-dhcp-server", - "esp-hal-ota", - "esp-nvs", - "esp-radio", - "esp-rtos", - "esp-storage", - "getrandom 0.2.15", - "heapless 0.9.3", - "include-minifier", - "log", - "portable-atomic", - "rand_core 0.6.4", - "serde", - "serde_json", - "static_cell", -] - [[package]] name = "esp-metadata-generated" version = "0.4.0" @@ -1309,28 +933,24 @@ dependencies = [ [[package]] name = "esp-radio" -version = "1.0.0-beta.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f25cc4e3ce27476b42c4a68943f10a92f9dec3c24bb001269958f0318fef02c" +checksum = "23fbff98b06a96b6ce3791ecec5c668524052a068e23aacd23afe17ddba844ce" dependencies = [ - "allocator-api2 0.3.1", + "allocator-api2", "cfg-if", "docsplay", "document-features", "embassy-net-driver", "embassy-sync 0.8.0", - "embedded-io 0.6.1", - "embedded-io 0.7.1", - "embedded-io-async 0.6.1", - "embedded-io-async 0.7.0", "enumset", + "esp-alloc", "esp-config", "esp-hal", "esp-hal-procmacros", "esp-metadata-generated", "esp-phy", "esp-radio-rtos-driver", - "esp-rom-sys", "esp-sync", "esp-wifi-sys-esp32s3", "esp32s3", @@ -1383,7 +1003,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "551f90766e1527edaa0c91e8d559e9e2a60397b545e93357ac61fb31845e5712" dependencies = [ - "allocator-api2 0.3.1", + "allocator-api2", "cfg-if", "document-features", "embassy-executor", @@ -1517,29 +1137,12 @@ dependencies = [ "vcell", ] -[[package]] -name = "fastrand" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" - [[package]] name = "find-msvc-tools" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" -[[package]] -name = "flate2" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" -dependencies = [ - "crc32fast", - "miniz_oxide", - "zlib-rs", -] - [[package]] name = "float-cmp" version = "0.9.0" @@ -1564,12 +1167,6 @@ dependencies = [ "gcd", ] -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures-core" version = "0.3.34" @@ -1597,7 +1194,6 @@ dependencies = [ "futures-core", "futures-task", "pin-project-lite", - "slab", ] [[package]] @@ -1631,29 +1227,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasip2", -] - [[package]] name = "hash32" version = "0.3.1" @@ -1663,30 +1236,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -dependencies = [ - "allocator-api2 0.2.21", -] - [[package]] name = "hashbrown" version = "0.17.1" @@ -1746,19 +1295,6 @@ dependencies = [ "embedded-hal 1.0.0", ] -[[package]] -name = "include-minifier" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4aab0efa4c730ef528fc8249cd190c69f193c64128fb20b204e0855fec19dc1" -dependencies = [ - "minify-html", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.119", -] - [[package]] name = "indexmap" version = "2.14.1" @@ -1766,9 +1302,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb" dependencies = [ "equivalent", - "hashbrown 0.17.1", - "serde", - "serde_core", + "hashbrown", ] [[package]] @@ -1793,24 +1327,6 @@ dependencies = [ "syn 3.0.4", ] -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.18" @@ -1853,23 +1369,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "js-sys" -version = "0.3.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" -dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", -] - -[[package]] -name = "json-escape-simd" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22a2041e3874a055a4eb03ea2395aaccdefa84ce75b31d542d72a741c3c6ad3" - [[package]] name = "lazy_static" version = "1.5.0" @@ -1882,46 +1381,6 @@ version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" -[[package]] -name = "lightningcss" -version = "1.0.0-alpha.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d31b760f96e8fdfe1d0c295e4bf76c503d6f15d2d470d53bd8cd1f7aa8c7d934" -dependencies = [ - "ahash 0.8.12", - "bitflags 2.13.1", - "const-str", - "cssparser", - "cssparser-color", - "dashmap", - "data-encoding", - "getrandom 0.3.4", - "indexmap", - "itertools 0.10.5", - "lazy_static", - "lightningcss-derive", - "parcel_selectors", - "parcel_sourcemap", - "pastey", - "pathdiff", - "rayon", - "serde", - "serde-content", - "smallvec", -] - -[[package]] -name = "lightningcss-derive" -version = "1.0.0-alpha.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12744d1279367caed41739ef094c325d53fb0ffcd4f9b84a368796f870252" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "linked_list_allocator" version = "0.10.6" @@ -1934,15 +1393,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.34" @@ -1962,12 +1412,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "managed" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" - [[package]] name = "matchers" version = "0.2.0" @@ -1977,12 +1421,6 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "memchr" version = "2.8.3" @@ -1995,50 +1433,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815" -[[package]] -name = "minify-html" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644c1511457e5f70dcbc03c932d4bd26351eceb8657b119c919dde2e65b6d120" -dependencies = [ - "ahash 0.8.12", - "aho-corasick", - "lightningcss", - "memchr", - "minify-html-common", - "once_cell", - "oxc_allocator", - "oxc_codegen", - "oxc_minifier", - "oxc_parser", - "oxc_span", -] - -[[package]] -name = "minify-html-common" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c3d71ae301c4e36949937ed9d121e1bf6847f2dc69ec20929b379d14659aac" -dependencies = [ - "ahash 0.8.12", - "aho-corasick", - "itertools 0.14.0", - "memchr", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", - "simd-adler32", -] - [[package]] name = "nb" version = "0.1.3" @@ -2054,12 +1448,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" -[[package]] -name = "nonmax" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" - [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -2069,16 +1457,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "num-bigint" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-derive" version = "0.4.2" @@ -2090,15 +1468,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "num-integer" -version = "0.1.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" -dependencies = [ - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -2150,514 +1519,12 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" -[[package]] -name = "outref" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" - -[[package]] -name = "outref" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" - -[[package]] -name = "owo-colors" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c45bb4a6ae1280ec0803b1ef9d3455eb50f01efbbe1447ab020f1d54fba9d8" - -[[package]] -name = "oxc-browserslist" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb7a1163a5501f935f8722d839b576491b749c695e7a066aa0b8df988b806df" -dependencies = [ - "flate2", - "postcard", - "rustc-hash", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "oxc-miette" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4356a61f2ed4c9b3610245215fbf48970eb277126919f87db9d0efa93a74245c" -dependencies = [ - "cfg-if", - "owo-colors", - "oxc-miette-derive", - "textwrap", - "thiserror", - "unicode-segmentation", - "unicode-width", -] - -[[package]] -name = "oxc-miette-derive" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b237422b014f8f8fff75bb9379e697d13f8d57551a22c88bebb39f073c1bf696" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "oxc_allocator" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433214c659b860685d987ca25a523a544d35ebf87ee3658a942fd1c664cfa49b" -dependencies = [ - "allocator-api2 0.2.21", - "bumpalo", - "hashbrown 0.16.1", - "oxc_data_structures", - "rustc-hash", -] - -[[package]] -name = "oxc_ast" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e78ea25d23521092edcd509198635dd0bd96df7fb71349bcd8087bb8f6a615d" -dependencies = [ - "bitflags 2.13.1", - "oxc_allocator", - "oxc_ast_macros", - "oxc_data_structures", - "oxc_diagnostics", - "oxc_estree", - "oxc_regular_expression", - "oxc_span", - "oxc_syntax", -] - -[[package]] -name = "oxc_ast_macros" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f29bf83925451a7ebbd30d3ff449414cc230c9b63aba70487c2ca74ea1e3ed" -dependencies = [ - "phf 0.13.1", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "oxc_ast_visit" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808862f42c9331954cf187261d6a48dbf471ccbe60b6a35f6b1056c11f32e95b" -dependencies = [ - "oxc_allocator", - "oxc_ast", - "oxc_span", - "oxc_syntax", -] - -[[package]] -name = "oxc_codegen" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "480bab938439c921d34750708abf15aacf253ea11e2f348e4b085cbf697f4ea2" -dependencies = [ - "bitflags 2.13.1", - "cow-utils", - "dragonbox_ecma", - "itoa", - "oxc_allocator", - "oxc_ast", - "oxc_data_structures", - "oxc_index", - "oxc_semantic", - "oxc_sourcemap", - "oxc_span", - "oxc_syntax", - "rustc-hash", -] - -[[package]] -name = "oxc_compat" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd06b5cb59ece933be410adc6f811108a10c567fa2d105321f8d0f01cc4ab0c6" -dependencies = [ - "cow-utils", - "oxc-browserslist", - "oxc_syntax", - "rustc-hash", - "serde", -] - -[[package]] -name = "oxc_data_structures" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd090988aa69c1e394f424289abb9bb1281448a072419ca556a07228ad36b854" - -[[package]] -name = "oxc_diagnostics" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b8a09558d38ee7f23faf0249cdb37b5b26f53a7375941f8636c41c661b283ce" -dependencies = [ - "cow-utils", - "oxc-miette", - "percent-encoding", -] - -[[package]] -name = "oxc_ecmascript" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0002ece1cc266aa6654913d39cf552b0cf501afce9d953b87c283dfcd307266" -dependencies = [ - "cow-utils", - "num-bigint", - "num-traits", - "oxc_allocator", - "oxc_ast", - "oxc_span", - "oxc_syntax", -] - -[[package]] -name = "oxc_estree" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af85b24b7e10bf0ccb252f16d38492f51236c1ba146f62013993667cbf7fa649" - -[[package]] -name = "oxc_index" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3e6120999627ec9703025eab7c9f410ebb7e95557632a8902ca48210416c2b" -dependencies = [ - "nonmax", - "serde", -] - -[[package]] -name = "oxc_mangler" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb751e1971f0809547347edfebe3755d5bed354aacf3ca7fe7216b901a11dd1d" -dependencies = [ - "itertools 0.14.0", - "oxc_allocator", - "oxc_ast", - "oxc_data_structures", - "oxc_index", - "oxc_semantic", - "oxc_span", - "oxc_syntax", - "rustc-hash", -] - -[[package]] -name = "oxc_minifier" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e836caa36befa6f9603eebf56b0c08d1e164ae31160c8e99ab3f535203065a4c" -dependencies = [ - "cow-utils", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_codegen", - "oxc_compat", - "oxc_data_structures", - "oxc_ecmascript", - "oxc_index", - "oxc_mangler", - "oxc_parser", - "oxc_regular_expression", - "oxc_semantic", - "oxc_span", - "oxc_syntax", - "oxc_traverse", - "rustc-hash", -] - -[[package]] -name = "oxc_parser" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb730ab93ff23bbc471ef7109f847afa709bb284dd52a5d3366283d724858158" -dependencies = [ - "bitflags 2.13.1", - "cow-utils", - "memchr", - "num-bigint", - "num-traits", - "oxc_allocator", - "oxc_ast", - "oxc_data_structures", - "oxc_diagnostics", - "oxc_ecmascript", - "oxc_regular_expression", - "oxc_span", - "oxc_syntax", - "rustc-hash", - "seq-macro", -] - -[[package]] -name = "oxc_regular_expression" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27bafc3035e3b0fe555ae56f7bbc108a7ee520b0858250ba16d197e44ca83746" -dependencies = [ - "bitflags 2.13.1", - "oxc_allocator", - "oxc_ast_macros", - "oxc_diagnostics", - "oxc_span", - "phf 0.13.1", - "rustc-hash", - "unicode-id-start", -] - -[[package]] -name = "oxc_semantic" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e5fa0b975a28e1d1ffa6c81c8df094545fe3c3225956d4e93ffe1ade3dae0" -dependencies = [ - "itertools 0.14.0", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_data_structures", - "oxc_diagnostics", - "oxc_ecmascript", - "oxc_index", - "oxc_span", - "oxc_syntax", - "phf 0.13.1", - "rustc-hash", - "self_cell", -] - -[[package]] -name = "oxc_sourcemap" -version = "6.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d378eb8bad20e89d66276aebab51f6a5408571092cac94abdd3eabb773713d6" -dependencies = [ - "base64-simd 0.8.0", - "json-escape-simd", - "rustc-hash", - "serde", - "serde_json", -] - -[[package]] -name = "oxc_span" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71243fe1ece27f71a6be5e2ab11d051792eeb578f3b056d7c9bbe82ec8043bf3" -dependencies = [ - "compact_str", - "oxc-miette", - "oxc_allocator", - "oxc_ast_macros", - "oxc_estree", -] - -[[package]] -name = "oxc_syntax" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c99e555ed497111004a71fb2aa6f8fb90b0d3e2733aceeb035e24701d69634" -dependencies = [ - "bitflags 2.13.1", - "cow-utils", - "dragonbox_ecma", - "nonmax", - "oxc_allocator", - "oxc_ast_macros", - "oxc_data_structures", - "oxc_estree", - "oxc_index", - "oxc_span", - "phf 0.13.1", - "unicode-id-start", -] - -[[package]] -name = "oxc_traverse" -version = "0.95.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68d00264248ef474988ea02bfa44ccacd9a1d8716f0efb33a9cd6f992cf07b7b" -dependencies = [ - "itoa", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_data_structures", - "oxc_ecmascript", - "oxc_semantic", - "oxc_span", - "oxc_syntax", - "rustc-hash", -] - -[[package]] -name = "parcel_selectors" -version = "0.28.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05f71e01edca03d245ab0a9f7ce13a974ceb79baaae8faf2ba0b11de6b90913" -dependencies = [ - "bitflags 2.13.1", - "cssparser", - "log", - "phf 0.11.3", - "phf_codegen", - "precomputed-hash", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "parcel_sourcemap" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485b74d7218068b2b7c0e3ff12fbc61ae11d57cb5d8224f525bd304c6be05bbb" -dependencies = [ - "base64-simd 0.7.0", - "data-url", - "rkyv", - "serde", - "serde_json", - "vlq", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", -] - [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pastey" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" - -[[package]] -name = "pathdiff" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "phf" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" -dependencies = [ - "phf_shared 0.11.3", -] - -[[package]] -name = "phf" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" -dependencies = [ - "phf_macros", - "phf_shared 0.13.1", - "serde", -] - -[[package]] -name = "phf_codegen" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" -dependencies = [ - "phf_generator 0.11.3", - "phf_shared 0.11.3", -] - -[[package]] -name = "phf_generator" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" -dependencies = [ - "phf_shared 0.11.3", - "rand", -] - -[[package]] -name = "phf_generator" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" -dependencies = [ - "fastrand", - "phf_shared 0.13.1", -] - -[[package]] -name = "phf_macros" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" -dependencies = [ - "phf_generator 0.13.1", - "phf_shared 0.13.1", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "phf_shared" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project-lite" version = "0.2.17" @@ -2710,24 +1577,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "postcard" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -2746,26 +1595,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "quote" version = "1.0.47" @@ -2775,41 +1604,17 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "ral-registers" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46b71a9d9206e8b46714c74255adcaea8b11e0350c1d8456165073c3f75fc81a" -[[package]] -name = "rand" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" -dependencies = [ - "rand_core 0.6.4", -] - [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.15", -] [[package]] name = "rand_core" @@ -2823,41 +1628,12 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" -[[package]] -name = "rayon" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "recursive_array" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69bad83913c3b39011ad9d43b7ac0cae139cec5d7e7288fbea5bb4b4e3cc78f6" -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.13.1", -] - [[package]] name = "regex-automata" version = "0.4.18" @@ -2875,15 +1651,6 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" -[[package]] -name = "rend" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" -dependencies = [ - "bytecheck", -] - [[package]] name = "riscv" version = "0.15.0" @@ -2943,35 +1710,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1376b15f3ff160e9b1e8ea564ce427f2f6fcf77528cc0a8bf405cb476f9cea7" -[[package]] -name = "rkyv" -version = "0.7.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1" -dependencies = [ - "bitvec", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rlsf" version = "0.2.3" @@ -2984,12 +1722,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "rustc-hash" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" - [[package]] name = "rustversion" version = "1.0.23" @@ -3009,28 +1741,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] -name = "scopeguard" -version = "1.2.0" +name = "semihosting" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "self_cell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" - -[[package]] -name = "seq-macro" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" +checksum = "f8e4abf97879f4e80db69a9fba7bd64998e9bdad25f58ef045a778e191172fd4" [[package]] name = "serde" @@ -3042,15 +1756,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-content" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3753ca04f350fa92d00b6146a3555e63c55388c9ef2e11e09bce2ff1c0b509c6" -dependencies = [ - "serde", -] - [[package]] name = "serde_core" version = "1.0.229" @@ -3071,19 +1776,6 @@ dependencies = [ "syn 3.0.4", ] -[[package]] -name = "serde_json" -version = "1.0.151" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - [[package]] name = "serde_yaml" version = "0.9.34+deprecated" @@ -3112,64 +1804,12 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" -[[package]] -name = "simd-abstraction" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" -dependencies = [ - "outref 0.1.0", -] - -[[package]] -name = "simd-adler32" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" - -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - -[[package]] -name = "siphasher" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - [[package]] name = "smallvec" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f" -[[package]] -name = "smawk" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100" - -[[package]] -name = "smoltcp" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f73d40463bba65efc9adc6370b56df76d563cc46e2482bba58351b4afb7535e" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "cfg-if", - "heapless 0.9.3", - "managed", -] - [[package]] name = "somni-expr" version = "0.2.0" @@ -3197,15 +1837,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "static_cell" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" -dependencies = [ - "portable-atomic", -] - [[package]] name = "strsim" version = "0.11.1" @@ -3266,12 +1897,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "termcolor" version = "1.4.1" @@ -3281,17 +1906,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" -dependencies = [ - "smawk", - "unicode-linebreak", - "unicode-width", -] - [[package]] name = "thiserror" version = "2.0.20" @@ -3341,21 +1955,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "tinyvec" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -3459,36 +2058,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" -[[package]] -name = "unicode-id-start" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b79ad29b5e19de4260020f8919b443b2ef0277d242ce532ec7b7a2cc8b6007" - [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -3505,16 +2080,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "uuid" -version = "1.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5772d71c9be8a8a6ac2117d949c5b224c1b72241bb611d9a3012edcf8af7812" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "valuable" version = "0.1.1" @@ -3533,84 +2098,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "vlq" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" - [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "vsimd" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 2.0.119", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" -dependencies = [ - "unicode-ident", -] - [[package]] name = "winapi-util" version = "0.1.11" @@ -3653,21 +2146,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "xtensa-lx" version = "0.13.0" @@ -3698,35 +2176,3 @@ dependencies = [ "quote", "syn 2.0.119", ] - -[[package]] -name = "zerocopy" -version = "0.8.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "zlib-rs" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12" - -[[package]] -name = "zmij" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index c9686e4..f591fdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,10 +32,6 @@ embassy-executor = { version = "0.10.0", features = ["trace", "metadata-name"] } embassy-time = { version = "0.5.1", default-features = false } embassy-futures = "0.1.2" esp-alloc = "0.10.0" -esp-hal-wifimanager = { git = "https://github.com/rhetenor/esp-hal-wifimanager.git", default-features = false, features = [ - "ap", - "esp32s3", -] } esp-println = { version = "0.17.0", features = ["esp32s3", "log-04"] } display-interface-spi = "0.5.0" ili9341 = "0.6.0" @@ -56,6 +52,8 @@ binary_serde = "1.0.25" static_assertions = { version = "1.1.0", default-features = false } embedded-text = "0.7.3" esp-nvs = { version = "0.5.0", features = ["esp32s3"] } +esp-backtrace = { version = "0.19.0", features = ["esp32s3", "panic-handler", "println"] } +esp-radio = { version = "0.18.0", features = ["esp32s3", "wifi"] } [build-dependencies] log = "0.4.27" diff --git a/partitions.csv b/partitions.csv index c3b956e..8fff563 100644 --- a/partitions.csv +++ b/partitions.csv @@ -1,9 +1,4 @@ # ESP-IDF Partition Table # Name,Type,SubType,Offset,Size,Flags -nvs,data,nvs,0x9000,0x6000, -phy_init,data,phy,0xf000,0x1000, -# We keep the default layout more or less. But here we add a partition for more data before our application -more_nvs,data,nvs,0x10000,0xfa000, -# no offset given -> tool infers it for us -factory,app,factory, ,0xea6000, - +nvs,data,nvs,0x9000,0xa00000, +factory,app,factory,0xa10000,0x200000, diff --git a/src/background_tasks/nfc.rs b/src/background_tasks/nfc.rs index 155a382..5d32c48 100644 --- a/src/background_tasks/nfc.rs +++ b/src/background_tasks/nfc.rs @@ -1,6 +1,7 @@ use crate::navigation::navigation::display_error; use crate::{ - navigation::{navigation::Mutex, outputs::Outputs, state::NavigationState}, + Mutex, + navigation::{outputs::Outputs, state::NavigationState}, peripherals::Peripherals, }; use alloc::string::ToString; diff --git a/src/bin/main.rs b/src/bin/main.rs index bd57423..4e37738 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -9,6 +9,7 @@ use alloc::boxed::Box; use alloc::sync::Arc; +use creaturedex::Mutex; use creaturedex::background_tasks; use creaturedex::drivers::i2c_bus::I2cBusPinConfiguration; use creaturedex::drivers::nfc_pn532::NfcPn532Driver; @@ -19,14 +20,15 @@ use creaturedex::drivers::tertiary_lcd::{ BOX, EMPTY, EXAMPLE, HEART, TertiaryDisplay, TertiaryDisplayPinConfiguration, }; use creaturedex::navigation::inputs::Inputs; -use creaturedex::navigation::navigation::Mutex; use creaturedex::navigation::navigation::{self}; use creaturedex::navigation::outputs::Outputs; use creaturedex::navigation::state::NavigationState; -use creaturedex::network::wifi::setup_wifi; +use creaturedex::network::wifi::Wifi; +use creaturedex::network::wifi::wait_for_wifi_credentials; use creaturedex::peripherals::Peripherals; use creaturedex::peripherals::storage::cardstore::CardStore; use creaturedex::peripherals::storage::store::Store; +use creaturedex::peripherals::storage::wifistore::WifiStore; use embassy_executor::Spawner; use embedded_graphics::pixelcolor::BinaryColor; use embedded_graphics::{ @@ -38,22 +40,16 @@ use embedded_hal_bus::i2c::AtomicDevice; use esp_hal::clock::CpuClock; use esp_hal::gpio::{Input, InputConfig, Pull}; use esp_hal::timer::timg::TimerGroup; -use log::error; +use esp_backtrace as _; use esp_hal::rtc_cntl::Rtc; -#[panic_handler] -fn panic(panic_info: &core::panic::PanicInfo) -> ! { - error!("{}", panic_info); - loop {} -} - extern crate alloc; const HEAP_SIZE: usize = 73744; -const NVS_PARTITION_OFFSET: usize = 0x10000; -const NVS_PARTITION_SIZE: usize = 0xfa000; +const NVS_PARTITION_OFFSET: usize = 0x9000; +const NVS_PARTITION_SIZE: usize = 0xa0000; // This creates a default app-descriptor required by the esp-idf bootloader. // For more information see: @@ -133,18 +129,23 @@ async fn main(spawner: Spawner) { .expect("failed to create nvs"), )); - setup_wifi(esp_peripherals.WIFI, Arc::clone(&nvs), &spawner).await; + let wifi_store = WifiStore::new(nvs.clone()).await.expect("Could not initialize WiFi store"); - let card_store = CardStore::new(nvs) + let init_credentials = Wifi::initialize_credentials(&wifi_store).await.expect("Could not get init WiFi credentials"); + + let wifi = Wifi::new(esp_peripherals.WIFI, init_credentials).expect("Could not initialize WiFi"); + + let card_store = CardStore::new(nvs.clone()) .await .expect("Could not initialize Card Store"); - let store = Store { card_store }; + let store = Store { card_store, wifi_store }; let rtc = Rtc::new(esp_peripherals.LPWR); let peripherals = Box::leak(Box::new(Peripherals { store: Mutex::new(store), rtc, + wifi: Mutex::new(wifi), })); let mut nfc_driver = NfcPn532Driver::new(AtomicDevice::new(shared_i2c)); @@ -191,6 +192,10 @@ async fn main(spawner: Spawner) { background_tasks::nfc_scanner(nfc_driver, outputs, peripherals, navigation_state) .expect("nfc scanner task failed"), ); + spawner.spawn( + wait_for_wifi_credentials(outputs, peripherals) + .expect("wifi credential task failed"), + ); core::future::pending::<()>().await } diff --git a/src/drivers/spi_bus.rs b/src/drivers/spi_bus.rs index cb39249..25c5960 100644 --- a/src/drivers/spi_bus.rs +++ b/src/drivers/spi_bus.rs @@ -170,7 +170,7 @@ where dc: dc.clone(), } .build(); - + let primary = PrimaryDisplayPinConfiguration { spi_bus: bus_static, cs: low_active(self.cs_primary), diff --git a/src/lib.rs b/src/lib.rs index 93384ea..b9e5352 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ #![no_std] -#![feature(vec_into_chunks)] + +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; extern crate alloc; @@ -13,8 +14,11 @@ pub mod network; pub mod peripherals; pub mod views; +pub type Mutex = embassy_sync::mutex::Mutex; +pub type Signal = embassy_sync::signal::Signal; + #[unsafe(no_mangle)] -pub extern "Rust" fn _embassy_trace_poll_start(executor_id: u32) {} +pub extern "Rust" fn _embassy_trace_poll_start(_executor_id: u32) {} /// This callback is called AFTER a task is initialized/allocated, and BEFORE /// it is enqueued to run for the first time. If the task ends (and does not @@ -40,7 +44,7 @@ pub extern "Rust" fn _embassy_trace_task_end(executor_id: u32, task_id: u32) { /// This marks the TASK state transition from WAITING -> RUNNING /// This marks the EXECUTOR state transition from SCHEDULING -> POLLING #[unsafe(no_mangle)] -pub extern "Rust" fn _embassy_trace_task_exec_begin(executor_id: u32, task_id: u32) {} +pub extern "Rust" fn _embassy_trace_task_exec_begin(_executor_id: u32, _task_id: u32) {} /// This callback is called AFTER a task has completed polling. There will /// always be a matching call to `_embassy_trace_task_exec_begin`. @@ -53,7 +57,7 @@ pub extern "Rust" fn _embassy_trace_task_exec_begin(executor_id: u32, task_id: u /// /// This marks the EXECUTOR state transition from POLLING -> SCHEDULING #[unsafe(no_mangle)] -pub extern "Rust" fn _embassy_trace_task_exec_end(excutor_id: u32, task_id: u32) {} +pub extern "Rust" fn _embassy_trace_task_exec_end(_executor_id: u32, _task_id: u32) {} /// This callback is called AFTER the waker for a task is awoken, and BEFORE it /// is added to the run queue. @@ -67,7 +71,7 @@ pub extern "Rust" fn _embassy_trace_task_exec_end(excutor_id: u32, task_id: u32) /// NOTE: This may be called from an interrupt, outside the contpub ext of the current /// task or executor. #[unsafe(no_mangle)] -pub extern "Rust" fn _embassy_trace_task_ready_begin(executor_id: u32, task_id: u32) {} +pub extern "Rust" fn _embassy_trace_task_ready_begin(_executor_id: u32, _task_id: u32) {} /// This callback is called AFTER all dequeued tasks in a single call to poll /// have been processed. This will always be paired with a call to @@ -77,4 +81,4 @@ pub extern "Rust" fn _embassy_trace_task_ready_begin(executor_id: u32, task_id: /// This marks the EXECUTOR state transition from SCHEDULING -> IDLE /// #[unsafe(no_mangle)] -pub extern "Rust" fn _embassy_trace_executor_idle(executor_id: u32) {} +pub extern "Rust" fn _embassy_trace_executor_idle(_executor_id: u32) {} diff --git a/src/navigation/navigation.rs b/src/navigation/navigation.rs index 583719f..d3c2e79 100644 --- a/src/navigation/navigation.rs +++ b/src/navigation/navigation.rs @@ -1,3 +1,4 @@ +use crate::Mutex; use crate::card::model::Card; use crate::navigation::inputs::ButtonAction; use crate::navigation::inputs::Inputs; @@ -12,11 +13,8 @@ use alloc::string::ToString; use core::error; use embassy_futures::select::{Either, select}; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_time::{Duration, Timer}; -pub type Mutex = embassy_sync::mutex::Mutex; -pub type Signal = embassy_sync::signal::Signal; pub static CARD_DATA: Mutex> = Mutex::new(None); const DEBOUNCE_DURATION_MILLIS: u64 = 100; diff --git a/src/network/wifi.rs b/src/network/wifi.rs index 205f457..649e996 100644 --- a/src/network/wifi.rs +++ b/src/network/wifi.rs @@ -1,67 +1,144 @@ -use crate::navigation::navigation::Mutex; -use crate::peripherals::storage::Nvs; -use alloc::sync::Arc; -use embassy_executor::Spawner; - +use crate::Mutex; +use crate::alloc::string::ToString; +use crate::Signal; +use crate::navigation::outputs::Outputs; +use crate::peripherals::Peripherals; #[cfg(not(feature = "wokwi"))] -pub async fn setup_wifi( - wifi: esp_hal::peripherals::WIFI<'static>, - nvs: Arc>, - spawner: &Spawner, -) { - let espnvs = esp_hal_wifimanager::Nvs::new_from_nvs(nvs, 0, 0); +use crate::peripherals::storage::wifistore::WifiStore; +use crate::peripherals::storage::wifistore::WifiStoreError; +use alloc::string::String; +use core::error::Error; +use core::fmt::Display; +use esp_radio::wifi::WifiController; +use esp_radio::*; - let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); - - wm_settings.ssid.clear(); - _ = core::fmt::write( - &mut wm_settings.ssid, - format_args!("CreatureDex-{:X}", esp_hal_wifimanager::get_efuse_mac()), - ); - - wm_settings.wifi_conn_timeout = 30000; - wm_settings.esp_reset_timeout = Some(300000); // 5min - - let wifi_res = - esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&espnvs), wifi, None).await; - - log::info!("wifi_res: {wifi_res:?}"); +#[derive(Debug)] +pub struct WifiCredentials { + pub ssid: String, + pub pass: String, } -#[cfg(feature = "wokwi")] -pub async fn setup_wifi( - wifi: esp_hal::peripherals::WIFI<'static>, - nvs: Arc>, - spawner: &Spawner, -) { - log::info!("Wokwi mode active: pre-seeding WiFi Manager with Wokwi credentials"); +pub static WIFI_CREDENTIALS: Signal = Signal::new(); - use esp_nvs::Key; - const WIFIMANAGER_NAMESPACE: Key = Key::from_str("wifimanager"); - const WIFIMANAGER_NVS_KEY: Key = Key::from_str("WIFI_SETUP"); - if let Err(e) = nvs.lock().await.set( - &WIFIMANAGER_NAMESPACE, - &WIFIMANAGER_NVS_KEY, - "{\"ssid\":\"Wokwi-GUEST\",\"psk\":\"\",\"data\":{}}", - ) { - log::error!("Failed to store Wokwi WiFi config in NVS: {e:?}"); - return; +#[derive(Debug)] +pub struct Wifi { + pub controller: WifiController<'static>, + pub interfaces: wifi::Interfaces<'static>, + pub credentials: WifiCredentials, +} + +#[derive(Debug)] +pub enum WifiError { + Store(WifiStoreError), + Radio(esp_radio::wifi::WifiError), + NoCredentialsStored, +} + +impl Error for WifiError {} + +impl Display for WifiError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + WifiError::Store(e) => e.fmt(f), + WifiError::Radio(e) => e.fmt(f), + WifiError::NoCredentialsStored => write!(f, "No WiFi credentials stored in flash"), + } + } +} + +impl From for WifiError { + fn from(error: WifiStoreError) -> WifiError { + WifiError::Store(error) + } +} + +impl From for WifiError { + fn from(error: esp_radio::wifi::WifiError) -> WifiError { + WifiError::Radio(error) + } +} + +impl Wifi { + pub fn new( + wifi: esp_hal::peripherals::WIFI<'static>, + credentials: WifiCredentials + ) -> Result { + let wifi = wifi::new(wifi, Default::default())?; + + Ok(Self { + controller: wifi.0, + interfaces: wifi.1, + credentials + }) } - // Preload connection data so init_wm can connect immediately without AP setup. - let nvs = esp_hal_wifimanager::Nvs::new_from_nvs(nvs, 0, 0); + pub async fn initialize_credentials( + wifi_store: &WifiStore, + ) -> Result { + let stored_credentials = wifi_store.load_credentials().await?; + let ssid = option_env!("WIFI_SSID").map_or(stored_credentials.ssid, |v| v.to_string()); + let pass = option_env!("WIFI_PASS").map_or(stored_credentials.pass, |v| v.to_string()); - let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); + log::info!("initial wifi credentials:\nssid:{ssid}, pass:{pass}"); + Ok(WifiCredentials {ssid, pass}) + } - // Wokwi simulation uses a default open network called "Wokwi-GUEST" - wm_settings.ssid.clear(); - _ = core::fmt::write(&mut wm_settings.ssid, format_args!("Wokwi-GUEST")); + #[cfg(feature = "wokwi")] + pub async fn setup( + wifi: esp_hal::peripherals::WIFI<'static>, + nvs: Arc>, + spawner: &Spawner, + ) { + log::info!("Wokwi mode active: pre-seeding WiFi Manager with Wokwi credentials"); - wm_settings.wifi_conn_timeout = 30000; + const WIFIMANAGER_NAMESPACE: Key = Key::from_str("wifimanager"); + const WIFIMANAGER_NVS_KEY: Key = Key::from_str("WIFI_SETUP"); - // Initialize Wi-Fi connection through WiFi Manager using the pre-seeded NVS data. - let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; + if let Err(e) = nvs.lock().await.set( + &WIFIMANAGER_NAMESPACE, + &WIFIMANAGER_NVS_KEY, + "{\"ssid\":\"Wokwi-GUEST\",\"psk\":\"\",\"data\":{}}", + ) { + log::error!("Failed to store Wokwi WiFi config in NVS: {e:?}"); + return; + } - log::info!("Wokwi wifi_res: {wifi_res:?}"); + // Preload connection data so init_wm can connect immediately without AP setup. + let nvs = esp_hal_wifimanager::Nvs::new_from_nvs(nvs, 0, 0); + + let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); + + // Wokwi simulation uses a default open network called "Wokwi-GUEST" + wm_settings.ssid.clear(); + _ = core::fmt::write(&mut wm_settings.ssid, format_args!("Wokwi-GUEST")); + + wm_settings.wifi_conn_timeout = 30000; + + // Initialize Wi-Fi connection through WiFi Manager using the pre-seeded NVS data. + let wifi_res = + esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; + + log::info!("Wokwi wifi_res: {wifi_res:?}"); + } } + +#[embassy_executor::task] +pub async fn wait_for_wifi_credentials(_outputs: &'static Mutex, peripherals: &'static Peripherals) { + + loop { + log::info!("Waiting for new WiFi credentials"); + let credentials = WIFI_CREDENTIALS.wait().await; + + log::info!("Received new WiFi credentials:\nssid: {}, pass: {}", credentials.ssid, credentials.pass); + if let Err(err) = peripherals.store.lock().await.wifi_store.save_credentials(&credentials).await { + log::error!("Error storing credentials: {err}"); + continue; + } + + log::info!("Saved new WiFi credentials. Restarting WiFi"); + + } +} + + diff --git a/src/peripherals.rs b/src/peripherals.rs index 281d318..8f188ec 100644 --- a/src/peripherals.rs +++ b/src/peripherals.rs @@ -1,6 +1,7 @@ pub mod storage; -use crate::navigation::navigation::Mutex; +use crate::Mutex; +use crate::network::wifi::Wifi; use crate::peripherals::storage::store::Store; use esp_hal::rtc_cntl::Rtc; @@ -8,4 +9,5 @@ use esp_hal::rtc_cntl::Rtc; pub struct Peripherals { pub store: Mutex, pub rtc: Rtc<'static>, + pub wifi: Mutex, } diff --git a/src/peripherals/storage.rs b/src/peripherals/storage.rs index 6d406a1..7b612e5 100644 --- a/src/peripherals/storage.rs +++ b/src/peripherals/storage.rs @@ -5,3 +5,4 @@ pub type Nvs = esp_nvs::Nvs>; pub mod cardstore; pub mod settings; pub mod store; +pub mod wifistore; diff --git a/src/peripherals/storage/flash_store.rs b/src/peripherals/storage/flash_store.rs deleted file mode 100644 index 60ed958..0000000 --- a/src/peripherals/storage/flash_store.rs +++ /dev/null @@ -1,112 +0,0 @@ -use core::error::Error; -use core::fmt::Display; - -use crate::navigation::navigation::Mutex; -use embedded_storage::nor_flash::NorFlash; -use embedded_storage::nor_flash::ReadNorFlash; -use esp_storage::{FlashStorage, FlashStorageError}; - -use crate::peripherals::storage::MAGIC_REGION; - -#[derive(Debug)] -pub struct FlashStoreError(FlashStorageError); - -impl From for FlashStoreError { - fn from(value: FlashStorageError) -> Self { - Self(value) - } -} - -impl Error for FlashStoreError {} - -impl Display for FlashStoreError { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(f, "FlashStoreError:\n{:?}", self.0) - } -} - -const FLASH_ADDR: u32 = 0x200000; - -const INITIALIZATION_SIZE: usize = 0x1000; -const FLASH_INITIALIZE_MAGIC: u32 = 0xde6de6de; - -pub struct FlashStore { - pub storage: Mutex>, -} - -impl FlashStore { - pub fn new(flash: esp_hal::peripherals::FLASH<'static>) -> Result { - let mut storage = FlashStorage::new(flash); - - let mut magic: [u8; 4] = [0, 0, 0, 0]; - storage.read(FLASH_ADDR + MAGIC_REGION.offset, &mut magic)?; - log::debug!("Magic bytes are {magic:?}"); - - if Self::has_magic_bytes(&mut storage)? { - log::info!("Skipped flash initialization, magic bytes already present."); - } else { - log::info!("Initializing flash because no magic bytes found."); - Self::initialize_flash(&mut storage)?; - } - - Ok(Self { - storage: Mutex::new(storage), - }) - } - - pub async fn read(&self, offset: u32, bytes: &mut [u8]) -> Result<(), FlashStoreError> { - self.storage.lock().await.read(FLASH_ADDR + offset, bytes)?; - Ok(()) - } - - pub async fn write(&self, offset: u32, bytes: &mut [u8]) -> Result<(), FlashStoreError> { - log::debug!("Writing {} bytes at offset 0x{offset:08x}", bytes.len()); - self.storage - .lock() - .await - .write(FLASH_ADDR + offset, bytes)?; - Ok(()) - } - - pub async fn write_erase(&self, offset: u32, bytes: &mut [u8]) -> Result<(), FlashStoreError> { - log::debug!( - "Erasing and Writing {} bytes at offset 0x{offset:08x}", - bytes.len() - ); - let mut lock = self.storage.lock().await; - let addr = FLASH_ADDR + offset; - let to = FLASH_ADDR + offset + bytes.len() as u32; - log::debug!("Erasing from 0x{addr:x} to 0x{to:x}"); - //lock.erase(addr, to)?; - - log::debug!("Writing bytes..."); - lock.write(addr, bytes)?; - Ok(()) - } - - pub fn has_magic_bytes(storage: &mut FlashStorage) -> Result { - let mut magic: [u8; 4] = [0, 0, 0, 0]; - storage.read(FLASH_ADDR + MAGIC_REGION.offset, &mut magic)?; - log::debug!("Magic bytes are {magic:?}"); - - Ok(u32::from_ne_bytes(magic) == FLASH_INITIALIZE_MAGIC) - } - - pub fn initialize_flash(storage: &mut FlashStorage) -> Result<(), FlashStoreError> { - storage.erase(FLASH_ADDR, FLASH_ADDR + INITIALIZATION_SIZE as u32)?; - let zeros: [u8; INITIALIZATION_SIZE] = [0; INITIALIZATION_SIZE]; - storage.write(FLASH_ADDR + MAGIC_REGION.end() as u32, &zeros)?; - storage.write( - FLASH_ADDR + MAGIC_REGION.offset, - &FLASH_INITIALIZE_MAGIC.to_ne_bytes(), - )?; - - if Self::has_magic_bytes(storage)? { - Ok(()) - } else { - Err(FlashStoreError(FlashStorageError::Other( - FLASH_INITIALIZE_MAGIC as i32, - ))) - } - } -} diff --git a/src/peripherals/storage/settings.rs b/src/peripherals/storage/settings.rs index e69de29..8b13789 100644 --- a/src/peripherals/storage/settings.rs +++ b/src/peripherals/storage/settings.rs @@ -0,0 +1 @@ + diff --git a/src/peripherals/storage/store.rs b/src/peripherals/storage/store.rs index 211c364..45fcbf0 100644 --- a/src/peripherals/storage/store.rs +++ b/src/peripherals/storage/store.rs @@ -1,5 +1,7 @@ use crate::peripherals::storage::cardstore::CardStore; +use crate::peripherals::storage::wifistore::WifiStore; pub struct Store { pub card_store: CardStore, + pub wifi_store: WifiStore, } diff --git a/src/peripherals/storage/wifistore.rs b/src/peripherals/storage/wifistore.rs new file mode 100644 index 0000000..12fa043 --- /dev/null +++ b/src/peripherals/storage/wifistore.rs @@ -0,0 +1,136 @@ +use alloc::string::String; +use crate::network::wifi::WifiCredentials; +use crate::Mutex; +use crate::peripherals::storage::Nvs; +use alloc::sync::Arc; +use core::error::Error; +use core::fmt::Display; +use esp_nvs::Key; + +const NVS_NAMESPACE_WIFI: Key = Key::from_str("WIFI"); +const NVS_WIFI_SSID_KEY: Key = Key::from_str("WIFI_SSID"); +const NVS_WIFI_PASS_KEY: Key = Key::from_str("WIFI_PASS"); +const NVS_WIFI_INITIALIZED_KEY: Key = Key::from_str("INITIALIZED"); + +#[derive(Debug)] +pub enum WifiStoreError { + Store(esp_nvs::error::Error), +} + +impl Error for WifiStoreError {} + +impl Display for WifiStoreError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + WifiStoreError::Store(e) => e.fmt(f), + } + } +} + +impl From for WifiStoreError { + fn from(error: esp_nvs::error::Error) -> WifiStoreError { + WifiStoreError::Store(error) + } +} + +pub struct WifiStore { + nvs: Arc>, +} + +impl WifiStore { + pub async fn new(nvs: Arc>) -> Result { + if !Self::is_initialized(&nvs).await? { + log::info!("WifiStore has not been initialized"); + Self::initialize(&nvs).await?; + } + + log::info!("WifiStore has been initialized"); + + Ok(Self { nvs }) + } + + async fn is_initialized(nvs: &Mutex) -> Result { + log::info!("check initialization"); + let mut nvs_lock = nvs.lock().await; + match nvs_lock.get::(&NVS_NAMESPACE_WIFI, &NVS_WIFI_INITIALIZED_KEY) { + Ok(initialized) => { + log::debug!("initialization_check: initialized {initialized:?}"); + return Ok(true); + } + Err(esp_nvs::error::Error::NamespaceNotFound) => { + log::debug!("initialization_check: error: namespace not found"); + return Ok(false); + } + Err(esp_nvs::error::Error::KeyNotFound) => { + log::debug!("initialization_check: error: key not found"); + return Ok(false); + } + Err(error) => return Err(error.into()), + }; + } + + async fn initialize(nvs: &Mutex) -> Result<(), WifiStoreError> { + log::info!("initializing wifi store"); + + let mut nvs_lock = nvs.lock().await; + + log::debug!("initialization: write dummy ssid"); + nvs_lock.set::<&str>( + &NVS_NAMESPACE_WIFI, + &NVS_WIFI_SSID_KEY, + "" + )?; + + log::debug!("initialization: write dummy pass"); + nvs_lock.set::<&str>( + &NVS_NAMESPACE_WIFI, + &NVS_WIFI_PASS_KEY, + "" + )?; + + // set initialized + log::debug!("initialization: write initialized"); + nvs_lock.set::( + &NVS_NAMESPACE_WIFI, + &NVS_WIFI_INITIALIZED_KEY, + true, + )?; + + Ok(()) + } + + pub async fn load_credentials(&self) -> Result { + log::debug!("loading wifi credentials"); + log::debug!("loading ssid"); + let mut nvs_lock = self.nvs.lock().await; + let ssid = nvs_lock.get::(&NVS_NAMESPACE_WIFI, &NVS_WIFI_SSID_KEY)?; + log::debug!("ssid: {ssid}"); + + log::debug!("loading pass"); + let pass = nvs_lock.get::(&NVS_NAMESPACE_WIFI, &NVS_WIFI_PASS_KEY)?; + log::debug!("pass: {pass}"); + + Ok(WifiCredentials{ssid, pass}) + } + + pub async fn save_credentials(&self, credentials: &WifiCredentials) -> Result<(), WifiStoreError> { + log::debug!("writing wifi credentials"); + log::debug!("writing ssid...\nssid: {}", credentials.ssid); + + self.nvs.lock().await.set::<&str>( + &NVS_NAMESPACE_WIFI, + &NVS_WIFI_SSID_KEY, + &credentials.ssid, + )?; + + log::debug!("writing pass...\npass: {}", credentials.pass); + + self.nvs.lock().await.set::<&str>( + &NVS_NAMESPACE_WIFI, + &NVS_WIFI_PASS_KEY, + &credentials.pass, + )?; + + Ok(()) + } +} diff --git a/wokwi.toml b/wokwi.toml index c6e133d..297f99c 100644 --- a/wokwi.toml +++ b/wokwi.toml @@ -1,9 +1,10 @@ [wokwi] version = 1 gdbServerPort = 3333 -elf = "target/xtensa-esp32s3-none-elf/debug/creaturedex" -firmware = "target/xtensa-esp32s3-none-elf/debug/creaturedex" +elf = "target/xtensa-esp32s3-none-elf/release/creaturedex" +firmware = "target/xtensa-esp32s3-none-elf/release/creaturedex" [[chip]] -name = 'ch1115' -binary = 'wokwi/ch1115.chip.wasm' \ No newline at end of file +name = 'ch1115' +binary = 'wokwi/ch1115.chip.wasm' +