Compare commits
6
Commits
cbcb5b0b5f
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b97bf144dc
|
||
|
|
27a280536e
|
||
|
|
4154bb8450
|
||
|
|
83b0b85fee
|
||
|
|
a4acfc0915
|
||
|
|
a45cb6efbd
|
Generated
+71
-76
@@ -58,7 +58,7 @@ checksum = "c0cb6f3d4773a2107b94cbeccaa5b5f0b35a88389b5d522d13d659f64317b22d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.4",
|
"syn 3.0.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -69,9 +69,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.13.1"
|
version = "2.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
|
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
@@ -90,7 +90,7 @@ checksum = "211713d2e9fb4793ce4360a712c0764264aff6be48932ccf02ca2a331c0436a9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"btuuid",
|
"btuuid",
|
||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"embedded-io 0.7.1",
|
"embedded-io 0.7.1",
|
||||||
"embedded-io-async 0.7.0",
|
"embedded-io-async 0.7.0",
|
||||||
"futures-intrusive",
|
"futures-intrusive",
|
||||||
@@ -126,9 +126,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.4.4"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
|
checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"shlex",
|
"shlex",
|
||||||
@@ -148,9 +148,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.4"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cipher"
|
name = "cipher"
|
||||||
@@ -202,7 +202,7 @@ dependencies = [
|
|||||||
"embassy-executor",
|
"embassy-executor",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-net",
|
"embassy-net",
|
||||||
"embassy-sync 0.8.0 (git+https://github.com/embassy-rs/embassy?branch=main)",
|
"embassy-sync 0.8.0",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"esp-alloc",
|
"esp-alloc",
|
||||||
"esp-backtrace",
|
"esp-backtrace",
|
||||||
@@ -214,6 +214,7 @@ dependencies = [
|
|||||||
"esp-storage",
|
"esp-storage",
|
||||||
"heapless 0.9.3",
|
"heapless 0.9.3",
|
||||||
"int-enum",
|
"int-enum",
|
||||||
|
"oneshot",
|
||||||
"picoserve",
|
"picoserve",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"postcard",
|
"postcard",
|
||||||
@@ -318,7 +319,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim",
|
"strsim",
|
||||||
"syn 3.0.4",
|
"syn 3.0.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -351,7 +352,7 @@ checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core 0.24.1",
|
"darling_core 0.24.1",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.4",
|
"syn 3.0.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -453,7 +454,7 @@ dependencies = [
|
|||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-hal-internal",
|
"embassy-hal-internal",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embedded-hal 0.2.7",
|
"embedded-hal 0.2.7",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
@@ -522,7 +523,7 @@ dependencies = [
|
|||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-net-driver",
|
"embassy-net-driver",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embedded-io-async 0.7.0",
|
"embedded-io-async 0.7.0",
|
||||||
"embedded-nal-async",
|
"embedded-nal-async",
|
||||||
@@ -583,19 +584,6 @@ dependencies = [
|
|||||||
"heapless 0.9.3",
|
"heapless 0.9.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "embassy-sync"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "git+https://github.com/embassy-rs/embassy?branch=main#0b51d4cea5c02b8aa5dc0fad74be46f36b83373d"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"critical-section",
|
|
||||||
"embedded-io-async 0.7.0",
|
|
||||||
"futures-core",
|
|
||||||
"futures-sink",
|
|
||||||
"heapless 0.9.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-time"
|
name = "embassy-time"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
@@ -725,15 +713,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-storage"
|
name = "embedded-storage"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032"
|
checksum = "c815b3ed4213d85d6cfd274b871f430c0681084e28dfd4a537877f47f844ec83"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-storage-async"
|
name = "embedded-storage-async"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc"
|
checksum = "69aa7787b8ba0cf4e626c95839f811d853b75e24a0f7312a1eef324fedc13b21"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-storage",
|
"embedded-storage",
|
||||||
]
|
]
|
||||||
@@ -838,7 +826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "9e2874462a2a0faca8b6318a10b0db87d2b7cd74dded82b3dfd780c07a319038"
|
checksum = "9e2874462a2a0faca8b6318a10b0db87d2b7cd74dded82b3dfd780c07a319038"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitfield",
|
"bitfield",
|
||||||
"bitflags 2.13.1",
|
"bitflags 2.13.2",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
@@ -848,7 +836,7 @@ dependencies = [
|
|||||||
"document-features",
|
"document-features",
|
||||||
"embassy-embedded-hal",
|
"embassy-embedded-hal",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"embedded-can",
|
"embedded-can",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
"embedded-hal-async",
|
"embedded-hal-async",
|
||||||
@@ -910,9 +898,9 @@ checksum = "42c2ee95b945a4780796e4359e72c033aed3b45073880e8029458f538532db8a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "esp-metadata-generated"
|
name = "esp-metadata-generated"
|
||||||
version = "0.5.0"
|
version = "0.5.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7237b66a6b13163199b9e094ea96958565a5b04d35f518ee5834dc61c044011d"
|
checksum = "911aadae41ec99104efa865bd0b6e486b4b735999f9b571963748a46d16495ab"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "esp-phy"
|
name = "esp-phy"
|
||||||
@@ -923,7 +911,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"esp-config",
|
"esp-config",
|
||||||
"esp-hal",
|
"esp-hal",
|
||||||
"esp-metadata-generated 0.4.0",
|
"esp-metadata-generated 0.4.0",
|
||||||
@@ -959,7 +947,7 @@ dependencies = [
|
|||||||
"docsplay",
|
"docsplay",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-net-driver",
|
"embassy-net-driver",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"embedded-io 0.6.1",
|
"embedded-io 0.6.1",
|
||||||
"embedded-io 0.7.1",
|
"embedded-io 0.7.1",
|
||||||
"embedded-io-async 0.6.1",
|
"embedded-io-async 0.6.1",
|
||||||
@@ -1020,7 +1008,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e933ff78374b763b65998b64ad671b4890ed4ba13a80deff9f53afe95ede289d"
|
checksum = "e933ff78374b763b65998b64ad671b4890ed4ba13a80deff9f53afe95ede289d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"document-features",
|
"document-features",
|
||||||
"esp-metadata-generated 0.5.0",
|
"esp-metadata-generated 0.5.3",
|
||||||
"esp32c6 0.24.0",
|
"esp32c6 0.24.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1035,7 +1023,7 @@ dependencies = [
|
|||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-executor",
|
"embassy-executor",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"embassy-time-driver",
|
"embassy-time-driver",
|
||||||
"embassy-time-queue-utils",
|
"embassy-time-queue-utils",
|
||||||
"esp-alloc",
|
"esp-alloc",
|
||||||
@@ -1078,7 +1066,7 @@ dependencies = [
|
|||||||
"document-features",
|
"document-features",
|
||||||
"embassy-sync 0.6.2",
|
"embassy-sync 0.6.2",
|
||||||
"embassy-sync 0.7.2",
|
"embassy-sync 0.7.2",
|
||||||
"embassy-sync 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"embassy-sync 0.8.0",
|
||||||
"esp-metadata-generated 0.4.0",
|
"esp-metadata-generated 0.4.0",
|
||||||
"riscv",
|
"riscv",
|
||||||
"xtensa-lx",
|
"xtensa-lx",
|
||||||
@@ -1248,9 +1236,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "find-msvc-tools"
|
name = "find-msvc-tools"
|
||||||
version = "0.1.11"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
|
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fnv"
|
name = "fnv"
|
||||||
@@ -1315,9 +1303,9 @@ checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generator"
|
name = "generator"
|
||||||
version = "0.8.9"
|
version = "0.8.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3b854b0e584ead1a33f18b2fcad7cf7be18b3875c78816b753639aa501513ae"
|
checksum = "54ade96dc9003043bce7c035c85a9df5a858bfb2039c5a2e6fdf00f324f6c551"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
@@ -1439,9 +1427,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.14.0"
|
version = "2.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@@ -1458,15 +1446,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instability"
|
name = "instability"
|
||||||
version = "0.3.13"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2bf84e73fa6f27f299dec58e13223cf70db80da872eb921d4f6138342a0eabc8"
|
checksum = "4c3b5acc1e2fd9375041a388da33d1eb8aed5f7a8c0dd3543e3ea2805adfbe20"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling 0.24.1",
|
"darling 0.24.1",
|
||||||
"indoc",
|
"indoc",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.4",
|
"syn 3.0.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1489,9 +1477,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jiff"
|
name = "jiff"
|
||||||
version = "0.2.35"
|
version = "0.2.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "668b7183bd07af9a4885f5c35b0cc5c83c4607a913c16b7e17291832910d2dcc"
|
checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
"jiff-core",
|
"jiff-core",
|
||||||
@@ -1504,18 +1492,19 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jiff-core"
|
name = "jiff-core"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7feca88439efe53da3754500c1851dedf3cb36c524dd5cf8225cc0794de95d09"
|
checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"defmt 1.1.1",
|
"defmt 1.1.1",
|
||||||
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jiff-static"
|
name = "jiff-static"
|
||||||
version = "0.2.35"
|
version = "0.2.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3a69dcb3a21cfb32ce1cd056169337ca284af0766dd766e7878819b251a49204"
|
checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jiff-core",
|
"jiff-core",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -1525,15 +1514,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.5.0"
|
version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.189"
|
version = "0.2.190"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked_list_allocator"
|
name = "linked_list_allocator"
|
||||||
@@ -1655,6 +1644,12 @@ version = "1.21.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "oneshot"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cfe21416a02c693fb9f980befcb230ecc70b0b3d1cc4abf88b9675c4c1457f0c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
@@ -1726,9 +1721,9 @@ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portable-atomic-util"
|
name = "portable-atomic-util"
|
||||||
version = "0.2.7"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"
|
checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
]
|
]
|
||||||
@@ -1953,9 +1948,9 @@ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sequential-storage"
|
name = "sequential-storage"
|
||||||
version = "8.0.1"
|
version = "8.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e750f14f4f6e5a81277c66311713a56106c8df0196df62a634d1fc806556832b"
|
checksum = "1550e4d0c7a6a54e2d7884309dc6bfe206d2d8884cb5498177fd936cb233616d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-storage-async",
|
"embedded-storage-async",
|
||||||
]
|
]
|
||||||
@@ -1999,7 +1994,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.4",
|
"syn 3.0.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2032,9 +2027,9 @@ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.15.2"
|
version = "1.16.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smoltcp"
|
name = "smoltcp"
|
||||||
@@ -2175,9 +2170,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "3.0.4"
|
version = "3.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
|
checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2195,22 +2190,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "2.0.20"
|
version = "2.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
|
checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "2.0.20"
|
version = "2.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
|
checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.4",
|
"syn 3.0.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2233,9 +2228,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.25.13+spec-1.1.0"
|
version = "0.25.15+spec-1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b"
|
checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
@@ -2327,9 +2322,9 @@ checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.24"
|
version = "1.0.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unsafe-libyaml"
|
name = "unsafe-libyaml"
|
||||||
|
|||||||
+6
-2
@@ -31,7 +31,7 @@ esp-backtrace = { version = "0.19.0", features = [
|
|||||||
] }
|
] }
|
||||||
esp-println = { version = "0.17.0", features = ["defmt-espflash", "esp32c6"] }
|
esp-println = { version = "0.17.0", features = ["defmt-espflash", "esp32c6"] }
|
||||||
|
|
||||||
embassy-sync = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
|
embassy-sync = { version = "0.8.0", features = ["defmt"] }
|
||||||
embassy-futures = { version = "0.1.2", features = ["defmt"] }
|
embassy-futures = { version = "0.1.2", features = ["defmt"] }
|
||||||
embassy-embedded-hal = { version = "0.6.0", features = ["defmt", "time"] }
|
embassy-embedded-hal = { version = "0.6.0", features = ["defmt", "time"] }
|
||||||
|
|
||||||
@@ -63,11 +63,15 @@ picoserve = { version = "0.19", features = ["defmt", "embassy", "json"] }
|
|||||||
|
|
||||||
sequential-storage = "8.0"
|
sequential-storage = "8.0"
|
||||||
esp-storage = { version = "0.9", features = ["defmt", "esp32c6"] }
|
esp-storage = { version = "0.9", features = ["defmt", "esp32c6"] }
|
||||||
postcard = { version = "1.1", default-features = false, features = ["defmt", "heapless"] }
|
postcard = { version = "1.1", default-features = false, features = [
|
||||||
|
"defmt",
|
||||||
|
"heapless",
|
||||||
|
] }
|
||||||
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
||||||
int-enum = "1.2.0"
|
int-enum = "1.2.0"
|
||||||
heapless = { version = "0.9.3", features = ["defmt", "serde"] }
|
heapless = { version = "0.9.3", features = ["defmt", "serde"] }
|
||||||
thiserror = { version = "2.0.20", default-features = false }
|
thiserror = { version = "2.0.20", default-features = false }
|
||||||
|
oneshot = { version = "0.2.1", features = ["async"] }
|
||||||
|
|
||||||
|
|
||||||
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
||||||
|
|||||||
Generated
+22
-22
@@ -95,11 +95,11 @@
|
|||||||
},
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777335812,
|
"lastModified": 1790899423,
|
||||||
"narHash": "sha256-bEg5xoAxAwsyfnGhkEX7RJViTIBIYPd8ISg4O1c0HFc=",
|
"narHash": "sha256-THGtz65UGJU+sonZidRboyCMk+9DclpMF7pwL4uDV4M=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "5e0fb2f64edff2822249f21293b8304dedaaf676",
|
"rev": "47b6b27ed9a3a9181415e4367d0c30ab2a0e0250",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -113,11 +113,11 @@
|
|||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778716662,
|
"lastModified": 1790898470,
|
||||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
"narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
"rev": "024633cd702b10285db5cb19b40ad48d2399ba60",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -146,11 +146,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780749050,
|
"lastModified": 1791260994,
|
||||||
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
|
"narHash": "sha256-Miqqk/ammqnTUxaoCyvtwoPeLbI1ksFyLxi/CazZpWY=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
|
"rev": "151fa4e8ddfdd8dd25d945ad94ed54a13de9f6e4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -162,11 +162,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777168982,
|
"lastModified": 1790477367,
|
||||||
"narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=",
|
"narHash": "sha256-oujbxmVKDhci2E4EM3KyAbRUgp5/IsCoiA/LfEF7OOk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14",
|
"rev": "f7cd230690d9fc982d06129f9189b101fddcfa3b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -238,11 +238,11 @@
|
|||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780887496,
|
"lastModified": 1791419199,
|
||||||
"narHash": "sha256-4mDOPU6Ey3SMsUsUeeNLkXC9uSdn0vpyzJIumw01HV8=",
|
"narHash": "sha256-eQx167Svp11qqWgwFrvV+tELtWZ+Wu2+zgKsAl8fx0M=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "0d1a37eef3e3954cc698b577edbc37eaa736b859",
|
"rev": "00ab3b0148e915f22ef6815a9fe24de5d8dde295",
|
||||||
"revCount": 45,
|
"revCount": 51,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.krantz.one/reed/project-templates"
|
"url": "https://git.krantz.one/reed/project-templates"
|
||||||
},
|
},
|
||||||
@@ -298,11 +298,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780197589,
|
"lastModified": 1791276535,
|
||||||
"narHash": "sha256-FVCr2Ij/jKf59a4LW481eeOF6rJRreOBrVgW/aUBTrw=",
|
"narHash": "sha256-iwqAmHTX1IgzTumJR3JayNAQAo5xEmmOuGzB6b2pT/Q=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "21632e942d89bf1cce4e5a63d7e58a215a0cbfcc",
|
"rev": "b962e5d0c8cd97196c6a882d659fe451b52ad989",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -334,11 +334,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775636079,
|
"lastModified": 1791203292,
|
||||||
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
|
"narHash": "sha256-vuzVwvjeucSnwKwMBpyP8r5IzdrMKCHEdwTrRFwUN7I=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
|
"rev": "03d8ee1bcbc8f9638907bb79edb9673151d0e22b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
+59
-25
@@ -13,19 +13,49 @@ use sntpc_time_embassy::EmbassyTimestampGenerator;
|
|||||||
// NTP server (pool.ntp.org is the usual choice)
|
// NTP server (pool.ntp.org is the usual choice)
|
||||||
const NTP_SERVER: &str = "pool.ntp.org";
|
const NTP_SERVER: &str = "pool.ntp.org";
|
||||||
const NTP_PORT: u16 = 123;
|
const NTP_PORT: u16 = 123;
|
||||||
|
// Unix epoch is 1900-01-01 + 70 years = 2_208_988_800 seconds.
|
||||||
|
const NTP_UNIX_OFFSET: u64 = 2_208_988_800;
|
||||||
|
|
||||||
|
static NTP_BOOT_OFFSET: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
|
#[allow(
|
||||||
|
clippy::large_stack_frames,
|
||||||
|
reason = "it's not unusual to allocate larger objects in service's start functions"
|
||||||
|
)]
|
||||||
|
pub fn start_ntp_sync(spawner: Spawner, net_stack: Stack<'static>) {
|
||||||
|
let service = crate::mk_static!(
|
||||||
|
NtpClient,
|
||||||
|
NtpClient {
|
||||||
|
net_stack,
|
||||||
|
|
||||||
|
rx_meta: [PacketMetadata::EMPTY; 16],
|
||||||
|
rx_buf: [0u8; 48],
|
||||||
|
tx_meta: [PacketMetadata::EMPTY; 16],
|
||||||
|
tx_buf: [0u8; 48],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
spawner.spawn(handler(service).unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn now() -> embassy_time::Instant {
|
pub fn now() -> embassy_time::Instant {
|
||||||
embassy_time::Instant::now() + Duration::from_secs(NTP_BOOT_OFFSET.load(Ordering::Relaxed))
|
embassy_time::Instant::now() + Duration::from_secs(NTP_BOOT_OFFSET.load(Ordering::Relaxed))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_ntp_sync(spawner: Spawner, net_stack: Stack<'static>) {
|
|
||||||
spawner.spawn(handler(net_stack).unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn handler(net_stack: Stack<'static>) {
|
async fn handler(service: &'static mut NtpClient) {
|
||||||
|
let address = loop {
|
||||||
|
match service.fetch_ntp_address(NTP_SERVER, NTP_PORT).await {
|
||||||
|
Ok(addr) => break addr,
|
||||||
|
Err(err) => {
|
||||||
|
defmt::error!("Failed to get the NTP server's address: {}", err);
|
||||||
|
Timer::after(Duration::from_secs(10)).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match fetch_ntp_time(net_stack).await {
|
match service.fetch_ntp_time(address).await {
|
||||||
Ok(unix_secs) => {
|
Ok(unix_secs) => {
|
||||||
NTP_BOOT_OFFSET.store(
|
NTP_BOOT_OFFSET.store(
|
||||||
unix_secs - embassy_time::Instant::now().as_secs(),
|
unix_secs - embassy_time::Instant::now().as_secs(),
|
||||||
@@ -41,46 +71,50 @@ async fn handler(net_stack: Stack<'static>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTP_BOOT_OFFSET: AtomicU64 = AtomicU64::new(0);
|
struct NtpClient {
|
||||||
|
net_stack: Stack<'static>,
|
||||||
|
|
||||||
pub async fn fetch_ntp_time(net_stack: Stack<'static>) -> Result<u64, &'static str> {
|
rx_meta: [PacketMetadata; 16],
|
||||||
|
rx_buf: [u8; 48],
|
||||||
|
tx_meta: [PacketMetadata; 16],
|
||||||
|
tx_buf: [u8; 48],
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NtpClient {
|
||||||
|
async fn fetch_ntp_address(&self, server: &str, port: u16) -> Result<SocketAddr, &'static str> {
|
||||||
// Resolve the NTP server hostname
|
// Resolve the NTP server hostname
|
||||||
let server_addr = net_stack
|
let server_addr = self
|
||||||
.dns_query(NTP_SERVER, embassy_net::dns::DnsQueryType::A)
|
.net_stack
|
||||||
|
.dns_query(server, embassy_net::dns::DnsQueryType::A)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| "DNS resolution failed")?
|
.map_err(|_| "DNS resolution failed")?
|
||||||
.first()
|
.first()
|
||||||
.copied()
|
.copied()
|
||||||
.ok_or("No DNS result")?;
|
.ok_or("No DNS result")?;
|
||||||
|
|
||||||
let socket_addr = SocketAddr::new(server_addr.into(), NTP_PORT);
|
Ok(SocketAddr::new(server_addr.into(), port))
|
||||||
|
}
|
||||||
// Allocate UDP buffers (can be small — SNTP packets are tiny)
|
|
||||||
let mut rx_meta = [PacketMetadata::EMPTY; 16];
|
|
||||||
let mut rx_buf = [0u8; 48];
|
|
||||||
let mut tx_meta = [PacketMetadata::EMPTY; 16];
|
|
||||||
let mut tx_buf = [0u8; 48];
|
|
||||||
|
|
||||||
|
async fn fetch_ntp_time(&mut self, address: SocketAddr) -> Result<u64, &'static str> {
|
||||||
let mut socket = UdpSocket::new(
|
let mut socket = UdpSocket::new(
|
||||||
net_stack,
|
self.net_stack,
|
||||||
&mut rx_meta,
|
&mut self.rx_meta,
|
||||||
&mut rx_buf,
|
&mut self.rx_buf,
|
||||||
&mut tx_meta,
|
&mut self.tx_meta,
|
||||||
&mut tx_buf,
|
&mut self.tx_buf,
|
||||||
);
|
);
|
||||||
socket.bind(0).map_err(|_| "bind failed")?;
|
socket.bind(0).map_err(|_| "bind failed")?;
|
||||||
|
|
||||||
let wrapped = UdpSocketWrapper::from(socket);
|
let wrapped = UdpSocketWrapper::from(socket);
|
||||||
let ctx = NtpContext::new(EmbassyTimestampGenerator::default());
|
let ctx = NtpContext::new(EmbassyTimestampGenerator::default());
|
||||||
|
|
||||||
let result = get_time(socket_addr, &wrapped, ctx)
|
let result = get_time(address, &wrapped, ctx)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| "SNTP request failed")?;
|
.map_err(|_| "SNTP request failed")?;
|
||||||
|
|
||||||
// result.sec is the NTP timestamp in seconds since 1900-01-01.
|
// result.sec is the NTP timestamp in seconds since 1900-01-01.
|
||||||
// Unix epoch is 1900-01-01 + 70 years = 2_208_988_800 seconds.
|
|
||||||
const NTP_UNIX_OFFSET: u64 = 2_208_988_800;
|
|
||||||
let unix_secs = result.sec().saturating_sub(NTP_UNIX_OFFSET);
|
let unix_secs = result.sec().saturating_sub(NTP_UNIX_OFFSET);
|
||||||
|
|
||||||
Ok(unix_secs)
|
Ok(unix_secs)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+75
-45
@@ -1,11 +1,13 @@
|
|||||||
|
use defmt::error;
|
||||||
use embassy_embedded_hal::adapter::BlockingAsync;
|
use embassy_embedded_hal::adapter::BlockingAsync;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, rpc_service::RpcService};
|
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, channel::Channel};
|
||||||
use esp_hal::peripherals::FLASH;
|
use esp_hal::peripherals::FLASH;
|
||||||
use esp_radio::wifi::sta::StationConfig;
|
use esp_radio::wifi::sta::StationConfig;
|
||||||
use esp_storage::FlashStorage;
|
use esp_storage::FlashStorage;
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use int_enum::IntEnum;
|
use int_enum::IntEnum;
|
||||||
|
use oneshot::Sender;
|
||||||
use postcard::to_slice;
|
use postcard::to_slice;
|
||||||
use sequential_storage::{
|
use sequential_storage::{
|
||||||
cache::{Cache, Uncached},
|
cache::{Cache, Uncached},
|
||||||
@@ -14,35 +16,28 @@ use sequential_storage::{
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
pub static CONFIG_SERVICE: RpcService<CriticalSectionRawMutex, ConfigService, 64> =
|
pub async fn start_config(spawner: Spawner, flash: FLASH<'static>) {
|
||||||
RpcService::new();
|
let storage = MapStorage::<ConfigKey, _, _>::new(
|
||||||
|
BlockingAsync::new(FlashStorage::new(flash)),
|
||||||
|
const { MapConfig::new(0x3F_0000..0x40_0000) },
|
||||||
|
Cache::new_uncached(),
|
||||||
|
);
|
||||||
|
|
||||||
pub struct ConfigService {
|
spawner.spawn(handler(storage).unwrap());
|
||||||
storage: MapStorage<
|
|
||||||
ConfigKey,
|
|
||||||
BlockingAsync<FlashStorage<'static>>,
|
|
||||||
Cache<Uncached, Uncached, Uncached, ConfigKey>,
|
|
||||||
>,
|
|
||||||
data_buffer: [u8; 256],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfigService {
|
pub async fn set_wifi_creds(value: WifiCredentials) -> Result<(), ConfigError> {
|
||||||
pub async fn set_wifi_creds(&mut self, value: WifiCredentials) -> Result<(), ConfigError> {
|
let (send, recv) = oneshot::channel();
|
||||||
let mut buf = [0u8; 256];
|
CONFIG_CHANNEL
|
||||||
to_slice(&value, &mut buf)?;
|
.send(ConfigOperationMessage::SetWifiCreds(value, send))
|
||||||
|
.await;
|
||||||
self.storage
|
recv.await?
|
||||||
.store_item(&mut self.data_buffer, &ConfigKey::Wifi, &buf)
|
|
||||||
.await
|
|
||||||
.map_err(|e| ConfigError::FlashError(e))?;
|
|
||||||
|
|
||||||
// TODO: send the change to the wifi service
|
|
||||||
// WIFI_SERVICE
|
|
||||||
// .call(|s| s.set_station_config(esp_radio::wifi::Config::Station(value.into())))
|
|
||||||
// .await;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CONFIG_CHANNEL: Channel<CriticalSectionRawMutex, ConfigOperationMessage, 5> = Channel::new();
|
||||||
|
|
||||||
|
enum ConfigOperationMessage {
|
||||||
|
SetWifiCreds(WifiCredentials, Sender<Result<(), ConfigError>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
@@ -59,24 +54,44 @@ impl From<WifiCredentials> for StationConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start_config(spawner: Spawner, flash: FLASH<'static>) {
|
// TODO: refactor this when try blocks are implemented
|
||||||
let storage = MapStorage::<ConfigKey, _, _>::new(
|
|
||||||
BlockingAsync::new(FlashStorage::new(flash)),
|
|
||||||
const { MapConfig::new(0x3F_0000..0x40_0000) },
|
|
||||||
Cache::new_uncached(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let service = ConfigService {
|
|
||||||
storage: storage,
|
|
||||||
data_buffer: [0u8; 256],
|
|
||||||
};
|
|
||||||
|
|
||||||
spawner.spawn(handler(service).unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn handler(mut service: ConfigService) -> ! {
|
async fn handler(
|
||||||
CONFIG_SERVICE.run(&mut service).await
|
mut storage: MapStorage<
|
||||||
|
ConfigKey,
|
||||||
|
BlockingAsync<FlashStorage<'static>>,
|
||||||
|
Cache<Uncached, Uncached, Uncached, ConfigKey>,
|
||||||
|
>,
|
||||||
|
) -> ! {
|
||||||
|
let mut data_buffer = [0u8; 256];
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let operation = CONFIG_CHANNEL.receive().await;
|
||||||
|
|
||||||
|
match operation {
|
||||||
|
ConfigOperationMessage::SetWifiCreds(value, resp) => {
|
||||||
|
let mut f = async || {
|
||||||
|
let mut buf = [0u8; 256];
|
||||||
|
to_slice(&value, &mut buf)?;
|
||||||
|
|
||||||
|
storage
|
||||||
|
.store_item(&mut data_buffer, &ConfigKey::Wifi, &buf)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// TODO: send the change to the wifi service
|
||||||
|
// WIFI_SERVICE
|
||||||
|
// .call(|s| s.set_station_config(esp_radio::wifi::Config::Station(value.into())))
|
||||||
|
// .await;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
};
|
||||||
|
if resp.send(f().await).is_err() {
|
||||||
|
// TODO: find a way to not hard-code symbols in a string
|
||||||
|
error!("ConfigOperationMessage::SetWifiCreds failed to respond")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, IntEnum)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, IntEnum)]
|
||||||
@@ -97,7 +112,7 @@ impl Key for ConfigKey {
|
|||||||
let val = buffer
|
let val = buffer
|
||||||
.get_mut(0)
|
.get_mut(0)
|
||||||
.ok_or(sequential_storage::map::SerializationError::BufferTooSmall)?;
|
.ok_or(sequential_storage::map::SerializationError::BufferTooSmall)?;
|
||||||
*val = self.clone().into();
|
*val = (*self).into();
|
||||||
Ok(1)
|
Ok(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +120,7 @@ impl Key for ConfigKey {
|
|||||||
buffer: &[u8],
|
buffer: &[u8],
|
||||||
) -> Result<(Self, usize), sequential_storage::map::SerializationError> {
|
) -> Result<(Self, usize), sequential_storage::map::SerializationError> {
|
||||||
let val = *buffer
|
let val = *buffer
|
||||||
.get(0)
|
.first()
|
||||||
.ok_or(sequential_storage::map::SerializationError::BufferTooSmall)?;
|
.ok_or(sequential_storage::map::SerializationError::BufferTooSmall)?;
|
||||||
Ok((
|
Ok((
|
||||||
val.try_into()
|
val.try_into()
|
||||||
@@ -122,4 +137,19 @@ pub enum ConfigError {
|
|||||||
|
|
||||||
#[error("Error storing data on the flash: {0:?}")]
|
#[error("Error storing data on the flash: {0:?}")]
|
||||||
FlashError(sequential_storage::Error<esp_storage::FlashStorageError>),
|
FlashError(sequential_storage::Error<esp_storage::FlashStorageError>),
|
||||||
|
|
||||||
|
#[error("Error receiving response: {0}")]
|
||||||
|
RecvError(oneshot::RecvError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<sequential_storage::Error<esp_storage::FlashStorageError>> for ConfigError {
|
||||||
|
fn from(v: sequential_storage::Error<esp_storage::FlashStorageError>) -> Self {
|
||||||
|
Self::FlashError(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<oneshot::RecvError> for ConfigError {
|
||||||
|
fn from(v: oneshot::RecvError) -> Self {
|
||||||
|
Self::RecvError(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-20
@@ -14,19 +14,30 @@ impl AppBuilder for HttpApiProps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(
|
||||||
|
clippy::large_stack_frames,
|
||||||
|
reason = "it's not unusual to allocate larger objects in service's start functions"
|
||||||
|
)]
|
||||||
pub fn start_http_api(spawner: Spawner, net_stack: Stack<'static>) {
|
pub fn start_http_api(spawner: Spawner, net_stack: Stack<'static>) {
|
||||||
spawner.spawn(
|
let service = crate::mk_static!(
|
||||||
handler(HttpApiApp::new(
|
HttpApiApp<'static, HttpApiProps>,
|
||||||
|
HttpApiApp {
|
||||||
|
config: Default::default(),
|
||||||
|
|
||||||
net_stack,
|
net_stack,
|
||||||
Default::default(),
|
app: HttpApiProps.build_app(),
|
||||||
Default::default(),
|
|
||||||
))
|
tcp_rx_buffer: [0; 1024],
|
||||||
.unwrap(),
|
tcp_tx_buffer: [0; 1024],
|
||||||
|
http_buffer: [0; 2048],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
spawner.spawn(handler(service).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn handler(mut service: HttpApiApp<'static, HttpApiProps>) {
|
async fn handler(service: &'static mut HttpApiApp<'static, HttpApiProps>) {
|
||||||
service.run().await;
|
service.run().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,19 +67,6 @@ pub struct HttpApiApp<'a, AB: AppBuilder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, AB: AppBuilder> HttpApiApp<'a, AB> {
|
impl<'a, AB: AppBuilder> HttpApiApp<'a, AB> {
|
||||||
pub fn new(net_stack: Stack<'a>, config: HttpApiConfig, app: AB) -> Self {
|
|
||||||
Self {
|
|
||||||
config: config,
|
|
||||||
|
|
||||||
net_stack: net_stack,
|
|
||||||
app: app.build_app(),
|
|
||||||
|
|
||||||
tcp_rx_buffer: [0; 1024],
|
|
||||||
tcp_tx_buffer: [0; 1024],
|
|
||||||
http_buffer: [0; 2048],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn run(&mut self) {
|
pub async fn run(&mut self) {
|
||||||
picoserve::Server::new(
|
picoserve::Server::new(
|
||||||
&self.app,
|
&self.app,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#![deny(clippy::large_stack_frames)]
|
#![deny(clippy::large_stack_frames)]
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
|
||||||
|
extern crate alloc;
|
||||||
|
|
||||||
pub mod http_api;
|
pub mod http_api;
|
||||||
|
|
||||||
pub mod clock;
|
pub mod clock;
|
||||||
|
|||||||
+71
-49
@@ -1,37 +1,21 @@
|
|||||||
|
use alloc::boxed::Box;
|
||||||
use defmt::{error, info};
|
use defmt::{error, info};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_futures::select::{Either, select};
|
||||||
use embassy_net::{Runner, Stack};
|
use embassy_net::{Runner, Stack};
|
||||||
use embassy_sync::{
|
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||||
blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex, rpc_service::RpcService,
|
use embassy_sync::channel::Channel;
|
||||||
};
|
use embassy_sync::signal::Signal;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use esp_hal::peripherals::WIFI;
|
use esp_hal::peripherals::WIFI;
|
||||||
use esp_radio::wifi::sta::StationConfig;
|
use esp_radio::wifi::sta::StationConfig;
|
||||||
use esp_radio::wifi::{ControllerConfig, Interface, WifiController, WifiError};
|
use esp_radio::wifi::{ControllerConfig, Interface, WifiController};
|
||||||
|
use oneshot::{RecvError, Sender};
|
||||||
pub static WIFI_SERVICE: RpcService<CriticalSectionRawMutex, WifiService, 64> = RpcService::new();
|
|
||||||
|
|
||||||
pub struct WifiService {
|
|
||||||
pub net_stack: Stack<'static>,
|
|
||||||
wifi_controller: &'static Mutex<CriticalSectionRawMutex, WifiController<'static>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WifiService {
|
|
||||||
pub async fn set_station_config(
|
|
||||||
&self,
|
|
||||||
config: esp_radio::wifi::Config,
|
|
||||||
) -> Result<(), WifiError> {
|
|
||||||
let mut controller = self.wifi_controller.lock().await;
|
|
||||||
controller.set_config(&config)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_dhcp_config(&self, config: embassy_net::DhcpConfig) {
|
|
||||||
self.net_stack
|
|
||||||
.set_config_v4(embassy_net::ConfigV4::Dhcp(config));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#[allow(
|
||||||
|
clippy::large_stack_frames,
|
||||||
|
reason = "it's not unusual to allocate larger objects in service's start functions"
|
||||||
|
)]
|
||||||
pub fn start_wifi(spawner: Spawner, wifi: WIFI<'static>) -> Stack<'static> {
|
pub fn start_wifi(spawner: Spawner, wifi: WIFI<'static>) -> Stack<'static> {
|
||||||
let wifi_config = esp_radio::wifi::Config::Station(StationConfig::default());
|
let wifi_config = esp_radio::wifi::Config::Station(StationConfig::default());
|
||||||
|
|
||||||
@@ -58,50 +42,88 @@ pub fn start_wifi(spawner: Spawner, wifi: WIFI<'static>) -> Stack<'static> {
|
|||||||
seed,
|
seed,
|
||||||
);
|
);
|
||||||
|
|
||||||
let service = WifiService {
|
|
||||||
net_stack: net_stack,
|
|
||||||
wifi_controller: crate::mk_static!(Mutex<CriticalSectionRawMutex, WifiController<'static>>, Mutex::new(wifi_controller)),
|
|
||||||
};
|
|
||||||
|
|
||||||
spawner.spawn(net_handler(net_runner).unwrap());
|
spawner.spawn(net_handler(net_runner).unwrap());
|
||||||
spawner.spawn(connection_handler(service.wifi_controller).unwrap());
|
spawner.spawn(connection_handler(wifi_controller).unwrap());
|
||||||
spawner.spawn(handler(service).unwrap());
|
spawner.spawn(handler(net_stack).unwrap());
|
||||||
spawner.spawn(ip_logger(net_stack).unwrap());
|
spawner.spawn(ip_logger(net_stack).unwrap());
|
||||||
|
|
||||||
net_stack
|
net_stack
|
||||||
}
|
}
|
||||||
|
|
||||||
#[embassy_executor::task]
|
pub async fn set_station_config(config: Box<esp_radio::wifi::Config>) -> Result<(), RecvError> {
|
||||||
async fn handler(mut service: WifiService) -> ! {
|
let (send, recv) = oneshot::channel();
|
||||||
WIFI_SERVICE.run(&mut service).await
|
WIFI_CHANNEL
|
||||||
|
.send(WifiOperationMessage::SetStationConfig(config, send))
|
||||||
|
.await;
|
||||||
|
recv.await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn set_dhcp_config(config: Box<embassy_net::DhcpConfig>) -> Result<(), RecvError> {
|
||||||
|
let (send, recv) = oneshot::channel();
|
||||||
|
WIFI_CHANNEL
|
||||||
|
.send(WifiOperationMessage::SetDhcpConfig(config, send))
|
||||||
|
.await;
|
||||||
|
recv.await
|
||||||
|
}
|
||||||
|
|
||||||
|
static WIFI_CHANNEL: Channel<CriticalSectionRawMutex, WifiOperationMessage, 5> = Channel::new();
|
||||||
|
|
||||||
|
enum WifiOperationMessage {
|
||||||
|
SetStationConfig(Box<esp_radio::wifi::Config>, Sender<()>),
|
||||||
|
SetDhcpConfig(Box<embassy_net::DhcpConfig>, Sender<()>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn connection_handler(
|
async fn handler(net_stack: Stack<'static>) -> ! {
|
||||||
controller: &'static Mutex<CriticalSectionRawMutex, WifiController<'static>>,
|
|
||||||
) -> ! {
|
|
||||||
loop {
|
loop {
|
||||||
|
match WIFI_CHANNEL.receive().await {
|
||||||
|
WifiOperationMessage::SetStationConfig(config, resp) => {
|
||||||
|
WIFI_HANDLER_RPC.signal(*config);
|
||||||
|
if resp.send(()).is_err() {
|
||||||
|
// TODO: find a way to not hard-code symbols in a string
|
||||||
|
error!("WifiOperationMessage::SetStationConfig failed to respond")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
WifiOperationMessage::SetDhcpConfig(config, resp) => {
|
||||||
|
net_stack.set_config_v4(embassy_net::ConfigV4::Dhcp(*config));
|
||||||
|
if resp.send(()).is_err() {
|
||||||
|
// TODO: find a way to not hard-code symbols in a string
|
||||||
|
error!("WifiOperationMessage::SetDhcpConfig failed to respond")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static WIFI_HANDLER_RPC: Signal<CriticalSectionRawMutex, esp_radio::wifi::Config> = Signal::new();
|
||||||
|
|
||||||
|
#[embassy_executor::task]
|
||||||
|
async fn connection_handler(mut controller: WifiController<'static>) -> ! {
|
||||||
|
async fn connection(controller: &mut WifiController<'static>) {
|
||||||
info!("Connecting to WiFi...");
|
info!("Connecting to WiFi...");
|
||||||
|
|
||||||
match controller.lock().await.connect_async().await {
|
match controller.connect_async().await {
|
||||||
Ok(info) => {
|
Ok(info) => {
|
||||||
info!("Wifi connected to {:?}", info);
|
info!("Wifi connected to {:?}", info);
|
||||||
|
|
||||||
// wait until we're no longer connected
|
// wait until we're no longer connected
|
||||||
// TODO: reimplement the wait for disconnect
|
let info = controller.wait_for_disconnect_async().await.ok();
|
||||||
// let info = controller
|
info!("Disconnected: {:?}", info);
|
||||||
// .lock()
|
|
||||||
// .await
|
|
||||||
// .wait_for_disconnect_async()
|
|
||||||
// .await
|
|
||||||
// .ok();
|
|
||||||
// info!("Disconnected: {:?}", info);
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Failed to connect to wifi: {:?}", e);
|
error!("Failed to connect to wifi: {:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loop {
|
||||||
|
if let Either::First(req) =
|
||||||
|
select(WIFI_HANDLER_RPC.wait(), connection(&mut controller)).await
|
||||||
|
&& let Some(err) = controller.set_config(&req).err()
|
||||||
|
{
|
||||||
|
error!("Wifi controller failed to set a new config: {:?}", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
|
|||||||
Reference in New Issue
Block a user