Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
0fef57c37d
|
|||
|
a5197922a2
|
|||
|
1c518b6b95
|
|||
|
73c2710e77
|
|||
|
dc2ec7542b
|
|||
|
453777e232
|
|||
|
2e7c6fafa9
|
@@ -1,5 +1,5 @@
|
||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||
runner = "./wrapper.sh"
|
||||
runner = "probe-rs run --chip RP2040"
|
||||
|
||||
[build]
|
||||
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
|
||||
|
||||
377
Cargo.lock
generated
377
Cargo.lock
generated
@@ -48,8 +48,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "air_filter"
|
||||
version = "0.1.0"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"bme280",
|
||||
"cfg-if",
|
||||
"const_format",
|
||||
"cortex-m",
|
||||
@@ -66,12 +67,13 @@ dependencies = [
|
||||
"embassy-futures",
|
||||
"embassy-net",
|
||||
"embassy-rp",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embassy-time",
|
||||
"git-version",
|
||||
"heapless 0.7.16",
|
||||
"nourl",
|
||||
"panic-probe",
|
||||
"portable-atomic",
|
||||
"rand",
|
||||
"rust-mqtt",
|
||||
"serde",
|
||||
@@ -222,11 +224,22 @@ dependencies = [
|
||||
"generic-array 0.14.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bme280"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/Remmirad/bme280-rs/?branch=fix_reset_setup_time#67700603706fccd5ffab8c465cf38d04058b7f48"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"maybe-async-cfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "buffered-io"
|
||||
version = "0.2.1"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9de70b60ec8429fe379d65fbc49bdd6d53d68486ff1e3482f07ab47814912782"
|
||||
checksum = "562975127ad66dbe4b9d990aaa8e9eaa13189e04e31693b5c969e31eb02b34ae"
|
||||
dependencies = [
|
||||
"embedded-io",
|
||||
"embedded-io-async",
|
||||
@@ -401,17 +414,17 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "cyw43"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59d6ec798758febb089bd969109385b48dd0fb966193fe97a5f0f8b2d622145e"
|
||||
dependencies = [
|
||||
"atomic-polyfill 0.1.11",
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"defmt",
|
||||
"embassy-futures",
|
||||
"embassy-net-driver-channel",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embassy-time",
|
||||
"embedded-hal 1.0.0-rc.1",
|
||||
"embedded-hal 1.0.0",
|
||||
"futures",
|
||||
"num_enum",
|
||||
]
|
||||
@@ -419,7 +432,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "cyw43-pio"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f429446fe9420ee0a8743fdffb1d08a90f9332116635bbc819f63649264e480c"
|
||||
dependencies = [
|
||||
"cyw43",
|
||||
"defmt",
|
||||
@@ -560,6 +574,15 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "document-features"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95"
|
||||
dependencies = [
|
||||
"litrs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.7"
|
||||
@@ -568,9 +591,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
|
||||
[[package]]
|
||||
name = "ed25519"
|
||||
version = "1.5.3"
|
||||
version = "2.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7"
|
||||
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
|
||||
dependencies = [
|
||||
"signature",
|
||||
]
|
||||
@@ -602,13 +625,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-boot"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e917a2dba10553ab6188fdafd81e971b0441953c663842285709eaf2a5de5e5b"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
"digest",
|
||||
"embassy-embedded-hal",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embedded-storage",
|
||||
"embedded-storage-async",
|
||||
"salty",
|
||||
@@ -617,8 +641,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-boot-rp"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d8a53abc2a101dd352794666370ec0a13c53715dbec788f9aafde799ec1f2c2"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cortex-m",
|
||||
@@ -626,7 +651,7 @@ dependencies = [
|
||||
"defmt",
|
||||
"embassy-boot",
|
||||
"embassy-rp",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embassy-time",
|
||||
"embedded-storage",
|
||||
"embedded-storage-async",
|
||||
@@ -635,14 +660,15 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "embassy-embedded-hal"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eca4a9380d03e61063067b8239f67d2fa9f108ede7c46b4273804f6b79e59a1d"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
"embassy-futures",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embassy-time",
|
||||
"embedded-hal 0.2.7",
|
||||
"embedded-hal 1.0.0-rc.1",
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"embedded-storage",
|
||||
"embedded-storage-async",
|
||||
@@ -651,42 +677,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-executor"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
dependencies = [
|
||||
"atomic-polyfill 1.0.3",
|
||||
"cortex-m",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"embassy-macros",
|
||||
"embassy-time",
|
||||
"futures-util",
|
||||
"static_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-futures"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-hal-internal"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec648daedd2143466eff4b3e8002024f9f6c1de4ab7666bb679688752624c925"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"num-traits",
|
||||
"document-features",
|
||||
"embassy-executor-macros",
|
||||
"embassy-time-driver",
|
||||
"embassy-time-queue-driver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-macros"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
name = "embassy-executor-macros"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad454accf80050e9cf7a51e994132ba0e56286b31f9317b68703897c328c59b5"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
@@ -695,22 +703,44 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net"
|
||||
name = "embassy-futures"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-hal-internal"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0ec47cf8bab914018d4bd2b4f0aaeb46e4f52ab1e7985df88aeef2c6eda5aed"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55cf91dd36dfd623de32242af711fd294d41159f02130052fc93c5c5ba93febe"
|
||||
dependencies = [
|
||||
"as-slice 0.2.1",
|
||||
"atomic-polyfill 1.0.3",
|
||||
"atomic-pool",
|
||||
"defmt",
|
||||
"document-features",
|
||||
"embassy-net-driver",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embassy-time",
|
||||
"embedded-io-async",
|
||||
"embedded-nal-async",
|
||||
"futures",
|
||||
"generic-array 0.14.7",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
"managed",
|
||||
"smoltcp",
|
||||
"stable_deref_trait",
|
||||
@@ -718,26 +748,29 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net-driver"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net-driver-channel"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "584ab4da7e5612efaa7d55ee76161d9549adf788eab48d49362eddbf322f9933"
|
||||
dependencies = [
|
||||
"embassy-futures",
|
||||
"embassy-net-driver",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-rp"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "438f170cbd97d4a870e8d57e1738ee815255028ad31dd409d891e2bf797dc531"
|
||||
dependencies = [
|
||||
"atomic-polyfill 1.0.3",
|
||||
"cfg-if",
|
||||
@@ -745,14 +778,16 @@ dependencies = [
|
||||
"cortex-m-rt",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"document-features",
|
||||
"embassy-embedded-hal",
|
||||
"embassy-futures",
|
||||
"embassy-hal-internal",
|
||||
"embassy-sync",
|
||||
"embassy-sync 0.5.0",
|
||||
"embassy-time",
|
||||
"embassy-time-driver",
|
||||
"embassy-usb-driver",
|
||||
"embedded-hal 0.2.7",
|
||||
"embedded-hal 1.0.0-rc.1",
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"embedded-hal-nb",
|
||||
"embedded-io",
|
||||
@@ -762,7 +797,6 @@ dependencies = [
|
||||
"fixed",
|
||||
"futures",
|
||||
"nb 1.1.0",
|
||||
"paste",
|
||||
"pio",
|
||||
"pio-proc",
|
||||
"rand_core",
|
||||
@@ -772,36 +806,69 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-sync"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0525b466ca3ace30b57f2db868a35215dfaecd038d8668cb2db03feb7c069a0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"futures-util",
|
||||
"heapless 0.7.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-sync"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd938f25c0798db4280fcd8026bf4c2f48789aebf8f77b6e5cf8a7693ba114ec"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"embedded-io-async",
|
||||
"futures-util",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9c844070d9f80dc66ee739299183312baee2e1cdeb6e90b4ea2af44f4676da5"
|
||||
dependencies = [
|
||||
"atomic-polyfill 1.0.3",
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"document-features",
|
||||
"embassy-time-driver",
|
||||
"embassy-time-queue-driver",
|
||||
"embedded-hal 0.2.7",
|
||||
"embedded-hal 1.0.0-rc.1",
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"futures-util",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time-driver"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e0c214077aaa9206958b16411c157961fb7990d4ea628120a78d1a5a28aed24"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time-queue-driver"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1177859559ebf42cd24ae7ba8fe6ee707489b01d0bf471f8827b7b12dcb0bc0"
|
||||
|
||||
[[package]]
|
||||
name = "embassy-usb-driver"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy#af7c93abba768057f1d3299c7b4f4aa4501b3e56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
]
|
||||
@@ -818,43 +885,43 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embedded-hal"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2894bc2f0457b8ca3d6b8ab8aad64d9337583672494013457f86c5a9146c0e22"
|
||||
checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
|
||||
|
||||
[[package]]
|
||||
name = "embedded-hal-async"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76a8a3517745342155b3b00895a0f78417a453fb800d97a8bf4777d5720acde9"
|
||||
checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884"
|
||||
dependencies = [
|
||||
"embedded-hal 1.0.0-rc.1",
|
||||
"embedded-hal 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-hal-nb"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "257e3bb0163c69195acb0ebe0083b017b963235861d5ea9741626abdc55f39c9"
|
||||
checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605"
|
||||
dependencies = [
|
||||
"embedded-hal 1.0.0-rc.1",
|
||||
"embedded-hal 1.0.0",
|
||||
"nb 1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-io"
|
||||
version = "0.5.0"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "658bbadc628dc286b9ae02f0cb0f5411c056eb7487b72f0083203f115de94060"
|
||||
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-io-async"
|
||||
version = "0.5.0"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1394754ad749a560b25a0c70dcd2b66a450824a1311fc475bb2ccbfabe7f8414"
|
||||
checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
"embedded-io",
|
||||
@@ -862,47 +929,45 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embedded-nal"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447416d161ba378782c13e82b11b267d6d2104b4913679a7c5640e7e94f96ea7"
|
||||
checksum = "b8a943fad5ed3d3f8a00f1e80f6bba371f1e7f0df28ec38477535eb318dc19cc"
|
||||
dependencies = [
|
||||
"heapless 0.7.16",
|
||||
"nb 1.1.0",
|
||||
"no-std-net",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-nal-async"
|
||||
version = "0.5.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e706b5288eceaa582155b24d54e23385429402e4e99ae984f4a0a6a65b635f15"
|
||||
checksum = "72229137a4fc12d239b0b7f50f04b30790678da6d782a0f3f1909bf57ec4b759"
|
||||
dependencies = [
|
||||
"embedded-io-async",
|
||||
"embedded-nal",
|
||||
"heapless 0.7.16",
|
||||
"no-std-net",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-storage"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "156d7a2fdd98ebbf9ae579cbceca3058cff946e13f8e17b90e3511db0508c723"
|
||||
checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032"
|
||||
|
||||
[[package]]
|
||||
name = "embedded-storage-async"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "052997a894670d0cde873faa7405bc98e2fd29f569d2acd568561bc1c396b35a"
|
||||
checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc"
|
||||
dependencies = [
|
||||
"embedded-storage",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-tls"
|
||||
version = "0.15.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0427cd46c51f67e68abe046a63f2c1d3820d9f1a99b55792869a407d981afd5"
|
||||
checksum = "a6efb76fdd004a4ef787640177237b83449e6c5847765ea50bf15900061fd601"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"atomic-polyfill 1.0.3",
|
||||
@@ -912,7 +977,7 @@ dependencies = [
|
||||
"embedded-io-async",
|
||||
"generic-array 0.14.7",
|
||||
"heapless 0.6.1",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
"hkdf",
|
||||
"hmac",
|
||||
"p256",
|
||||
@@ -1175,6 +1240,15 @@ dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.0"
|
||||
@@ -1208,6 +1282,17 @@ dependencies = [
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
"hash32 0.3.1",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.2"
|
||||
@@ -1356,6 +1441,12 @@ version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.10"
|
||||
@@ -1378,6 +1469,19 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d"
|
||||
|
||||
[[package]]
|
||||
name = "maybe-async-cfg"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21fb8fac02158b9b529eb692491895d8459dbac939f3bc6e32159969646ffe55"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"pulldown-cmark",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.2"
|
||||
@@ -1592,6 +1696,15 @@ dependencies = [
|
||||
"universal-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
@@ -1652,6 +1765,17 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"memchr",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.33"
|
||||
@@ -1753,7 +1877,9 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
|
||||
|
||||
[[package]]
|
||||
name = "reqwless"
|
||||
version = "0.5.0"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10f238db3a2f18fbe0aace4c28c3c673f5cfb584ffc3684d6327ed287a6c86e4"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"buffered-io",
|
||||
@@ -1762,7 +1888,7 @@ dependencies = [
|
||||
"embedded-io-async",
|
||||
"embedded-nal-async",
|
||||
"embedded-tls",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
"hex",
|
||||
"httparse",
|
||||
"nourl",
|
||||
@@ -1791,12 +1917,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust-mqtt"
|
||||
version = "0.1.5"
|
||||
source = "git+https://git.huizinga.dev/Dreaded_X/rust-mqtt#a040fef484227697a7b3bfa45f990a84d2c47c61"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85c4b1fbe2ff726d3309ab119029b939ac8d5dd96a2aa8c82603dc15f3b8546f"
|
||||
dependencies = [
|
||||
"defmt",
|
||||
"embedded-io",
|
||||
"embedded-io-async",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
@@ -1845,8 +1973,9 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "salty"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/ycrypto/salty.git?rev=a9f17911a5024698406b75c0fac56ab5ccf6a8c7#a9f17911a5024698406b75c0fac56ab5ccf6a8c7"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b947325a585e90733e0e9ec097228f40b637cc346f9bd68f84d5c6297d0fcfef"
|
||||
dependencies = [
|
||||
"ed25519",
|
||||
"subtle",
|
||||
@@ -1937,9 +2066,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "1.6.4"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
|
||||
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
@@ -1955,15 +2084,15 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
||||
|
||||
[[package]]
|
||||
name = "smoltcp"
|
||||
version = "0.10.0"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d2e3a36ac8fea7b94e666dfa3871063d6e0a5c9d5d4fec9a1a6b7b6760f0229"
|
||||
checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"byteorder",
|
||||
"cfg-if",
|
||||
"defmt",
|
||||
"heapless 0.7.16",
|
||||
"heapless 0.8.0",
|
||||
"managed",
|
||||
]
|
||||
|
||||
@@ -1984,11 +2113,11 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_cell"
|
||||
version = "1.2.0"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49cd323fc21eb534f903ee78d781d622099f9716c5b408ed23bcf39f8f1651c0"
|
||||
checksum = "fa6ba4cf83bf80d3eb25f098ea5e790a0a1fcb5e357442259b231e412c2d3ca0"
|
||||
dependencies = [
|
||||
"atomic-polyfill 1.0.3",
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2093,6 +2222,15 @@ version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.11"
|
||||
@@ -2139,6 +2277,7 @@ dependencies = [
|
||||
"heapless 0.7.16",
|
||||
"impl-tools",
|
||||
"nourl",
|
||||
"portable-atomic",
|
||||
"rand_core",
|
||||
"reqwless",
|
||||
"rust-mqtt",
|
||||
@@ -2282,3 +2421,17 @@ name = "zeroize"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9"
|
||||
dependencies = [
|
||||
"zeroize_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize_derive"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
74
Cargo.toml
74
Cargo.toml
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "air_filter"
|
||||
version = "0.1.0"
|
||||
version = "0.3.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
@@ -8,93 +8,73 @@ cortex-m = { version = "0.7", features = ["inline-asm"] }
|
||||
cortex-m-rt = "0.7"
|
||||
defmt = "0.3"
|
||||
defmt-rtt = "0.4"
|
||||
embassy-embedded-hal = { version = "0.1.0", features = ["nightly", "defmt"] }
|
||||
embassy-executor = { version = "0.3", features = [
|
||||
embassy-embedded-hal = { version = "0.1.0", features = ["defmt"] }
|
||||
embassy-executor = { version = "0.5", features = [
|
||||
"nightly",
|
||||
"arch-cortex-m",
|
||||
"executor-thread",
|
||||
"executor-interrupt",
|
||||
"defmt",
|
||||
"nightly",
|
||||
"integrated-timers",
|
||||
] }
|
||||
embassy-rp = { version = "0.1", features = [
|
||||
"defmt",
|
||||
"unstable-traits",
|
||||
"nightly",
|
||||
"unstable-pac",
|
||||
"time-driver",
|
||||
"critical-section-impl",
|
||||
"intrinsics",
|
||||
"rom-v2-intrinsics",
|
||||
] }
|
||||
embassy-boot-rp = { version = "0.1", features = ["nightly", "defmt"] }
|
||||
embassy-boot = { version = "0.1", features = ["nightly", "defmt"] }
|
||||
embassy-time = { version = "0.1", features = [
|
||||
embassy-boot-rp = { version = "0.2", features = ["defmt"] }
|
||||
embassy-boot = { version = "0.2", features = ["defmt"] }
|
||||
embassy-time = { version = "0.3", features = [
|
||||
"defmt",
|
||||
"unstable-traits",
|
||||
"defmt-timestamp-uptime",
|
||||
"nightly",
|
||||
] }
|
||||
embassy-net = { version = "0.1", features = [
|
||||
embassy-net = { version = "0.4", features = [
|
||||
"tcp",
|
||||
"dhcpv4",
|
||||
"nightly",
|
||||
"medium-ethernet",
|
||||
"defmt",
|
||||
"dns",
|
||||
] }
|
||||
embassy-sync = { version = "0.2", features = ["defmt"] }
|
||||
embassy-sync = { version = "0.5", features = ["defmt"] }
|
||||
embassy-futures = { version = "0.1", features = ["defmt"] }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
cfg-if = "1.0.0"
|
||||
static_cell = { version = "1.1", features = ["nightly"] }
|
||||
cyw43 = { git = "https://github.com/embassy-rs/embassy", features = [
|
||||
"defmt",
|
||||
"firmware-logs",
|
||||
] }
|
||||
cyw43-pio = { git = "https://github.com/embassy-rs/embassy", features = [
|
||||
"defmt",
|
||||
] }
|
||||
rand = { version = "0.8.5", features = [
|
||||
cfg-if = "1.0"
|
||||
static_cell = { version = "2", features = ["nightly"] }
|
||||
cyw43 = { version = "0.1", features = ["defmt", "firmware-logs"] }
|
||||
cyw43-pio = { version = "0.1", features = ["defmt"] }
|
||||
rand = { version = "0.8", features = [
|
||||
"nightly",
|
||||
"small_rng",
|
||||
"std_rng",
|
||||
], default-features = false }
|
||||
rust-mqtt = { version = "0.1.5", features = [
|
||||
rust-mqtt = { version = "0.2", features = [
|
||||
"defmt",
|
||||
"no_std",
|
||||
"tls",
|
||||
], default-features = false }
|
||||
const_format = "0.2.31"
|
||||
git-version = "0.3.5"
|
||||
serde = { version = "1.0.188", default-features = false, features = ["derive"] }
|
||||
heapless = { version = "0.7.16", features = ["defmt", "serde"] }
|
||||
serde-json-core = "0.5.1"
|
||||
nourl = { version = "0.1.1", features = ["defmt"] }
|
||||
const_format = "0.2"
|
||||
git-version = "0.3"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
||||
heapless = { version = "0.7", features = ["defmt", "serde"] }
|
||||
serde-json-core = "0.5"
|
||||
nourl = { version = "0.1", features = ["defmt"] }
|
||||
# Embassy harfcodes a max of 6 dns servers, if there are more it crashes. This is a workaround
|
||||
# Ideally embassy returns an error instead of crashing...
|
||||
# Interestingly though, I only get 2 DNS servers...
|
||||
smoltcp = { version = "0.10.0", default-features = false, features = [
|
||||
smoltcp = { version = "0.11", default-features = false, features = [
|
||||
"dns-max-server-count-4",
|
||||
] }
|
||||
updater = { version = "0.1.0", path = "../iot_tools/updater" }
|
||||
portable-atomic = { version = "1.6", features = ["critical-section"] }
|
||||
bme280 = { version = "0.5.0", features = ["async", "defmt"] }
|
||||
|
||||
[patch.crates-io]
|
||||
embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-executor = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-rp = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-time = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-net = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-sync = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-futures = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-boot-rp = { git = "https://github.com/embassy-rs/embassy" }
|
||||
embassy-boot = { git = "https://github.com/embassy-rs/embassy" }
|
||||
|
||||
# Updated to embedded-io 0.5.0
|
||||
rust-mqtt = { git = "https://git.huizinga.dev/Dreaded_X/rust-mqtt" }
|
||||
# Make mqtt:// and mqtts:// actually work
|
||||
nourl = { git = "https://git.huizinga.dev/Dreaded_X/nourl" }
|
||||
|
||||
# Waiting for this to get updated to embedded-io 0.5 properly
|
||||
reqwless = { path = "../reqwless" }
|
||||
bme280 = { git = "https://github.com/Remmirad/bme280-rs/", branch = "fix_reset_setup_time" }
|
||||
|
||||
[features]
|
||||
include_firmwares = []
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly"
|
||||
channel = "nightly-2024-03-01"
|
||||
targets = ["thumbv6m-none-eabi"]
|
||||
components = ["rustfmt", "clippy", "llvm-tools"]
|
||||
|
||||
79
src/main.rs
79
src/main.rs
@@ -2,30 +2,30 @@
|
||||
#![no_main]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use core::fmt::Debug;
|
||||
use core::{cell::RefCell, str::from_utf8};
|
||||
|
||||
use bme280::{i2c::AsyncBME280, Measurements};
|
||||
use const_format::formatcp;
|
||||
use cyw43::PowerManagementMode;
|
||||
use cyw43_pio::PioSpi;
|
||||
use defmt::{debug, error, info, warn, Display2Format, Format};
|
||||
use embassy_boot::{AlignedBuffer, BlockingFirmwareUpdater, FirmwareUpdaterConfig};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_futures::{
|
||||
select::{select3, select4, Either3},
|
||||
yield_now,
|
||||
};
|
||||
use embassy_futures::select::{select3, select4, Either3};
|
||||
use embassy_net::{dns::DnsQueryType, tcp::TcpSocket, Config, Stack, StackResources};
|
||||
use embassy_rp::{
|
||||
bind_interrupts,
|
||||
clocks::RoscRng,
|
||||
flash::{Flash, WRITE_SIZE},
|
||||
gpio::{Flex, Input, Level, Output, Pin, Pull},
|
||||
peripherals::{DMA_CH1, PIN_23, PIN_25, PIO0},
|
||||
i2c,
|
||||
peripherals::{DMA_CH1, I2C0, PIN_23, PIN_25, PIO0},
|
||||
pio::{self, Pio},
|
||||
Peripheral,
|
||||
};
|
||||
use embassy_sync::blocking_mutex::Mutex;
|
||||
use embassy_time::{Duration, Ticker, Timer};
|
||||
use embassy_time::{Delay, Duration, Ticker, Timer};
|
||||
use heapless::Vec;
|
||||
use nourl::Url;
|
||||
use rand::{
|
||||
@@ -46,6 +46,7 @@ use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
PIO0_IRQ_0 => pio::InterruptHandler<PIO0>;
|
||||
I2C0_IRQ => i2c::InterruptHandler<I2C0>;
|
||||
});
|
||||
|
||||
const ID: &str = env!("ID");
|
||||
@@ -54,7 +55,7 @@ const TOPIC_STATUS: &str = formatcp!("{}/status", TOPIC_BASE);
|
||||
const TOPIC_UPDATE: &str = formatcp!("{}/update", TOPIC_BASE);
|
||||
const TOPIC_SET: &str = formatcp!("{}/set", TOPIC_BASE);
|
||||
const VERSION: &str = git_version::git_version!();
|
||||
const PUBLIC_SIGNING_KEY: &[u8] = include_bytes!("../key.pub");
|
||||
const PUBLIC_SIGNING_KEY: &[u8; 32] = include_bytes!("../key.pub");
|
||||
const FLASH_SIZE: usize = 2 * 1024 * 1024;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -66,14 +67,23 @@ struct SetMessage {
|
||||
struct StateMessage {
|
||||
state: State,
|
||||
manual: bool,
|
||||
temperature: f32,
|
||||
humidity: f32,
|
||||
pressure: f32,
|
||||
}
|
||||
|
||||
impl StateMessage {
|
||||
pub fn new((state, manual): (State, bool)) -> Self {
|
||||
Self { state, manual }
|
||||
pub fn new<E: Debug>((state, manual): (State, bool), measurements: Measurements<E>) -> Self {
|
||||
Self {
|
||||
state,
|
||||
manual,
|
||||
temperature: measurements.temperature,
|
||||
humidity: measurements.humidity,
|
||||
pressure: measurements.pressure,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn vec(&self) -> Vec<u8, 64> {
|
||||
pub fn vec(&self) -> Vec<u8, 128> {
|
||||
serde_json_core::to_vec(self)
|
||||
.expect("The buffer should be large enough to contain all the data")
|
||||
}
|
||||
@@ -243,14 +253,17 @@ unsafe fn get_firmware() -> (&'static [u8], &'static [u8]) {
|
||||
async fn wait_for_config(
|
||||
stack: &'static Stack<cyw43::NetDriver<'static>>,
|
||||
) -> embassy_net::StaticConfigV4 {
|
||||
loop {
|
||||
for _ in 0..120 {
|
||||
// We are essentially busy looping here since there is no Async API for this
|
||||
if let Some(config) = stack.config_v4() {
|
||||
return config;
|
||||
}
|
||||
|
||||
yield_now().await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
|
||||
info!("Restarting...");
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
@@ -287,6 +300,11 @@ async fn main(spawner: Spawner) {
|
||||
|
||||
let mut controller = Controller::new(p.PIN_28, p.PIN_27, p.PIN_26, p.PIN_22);
|
||||
|
||||
let i2c = i2c::I2c::new_async(p.I2C0, p.PIN_9, p.PIN_8, Irqs, i2c::Config::default());
|
||||
let mut bme280 = AsyncBME280::new_primary(i2c);
|
||||
let mut delay = Delay {};
|
||||
bme280.init(&mut delay).await.unwrap();
|
||||
|
||||
let pwr = Output::new(p.PIN_23, Level::Low);
|
||||
let cs = Output::new(p.PIN_25, Level::High);
|
||||
|
||||
@@ -380,11 +398,19 @@ async fn main(spawner: Spawner) {
|
||||
let mut recv_buffer = [0; 1024];
|
||||
let mut write_buffer = [0; 1024];
|
||||
|
||||
let mut client =
|
||||
MqttClient::<_, 5, _>::new(socket, &mut write_buffer, &mut recv_buffer, config);
|
||||
let mut client = MqttClient::<_, 5, _>::new(
|
||||
socket,
|
||||
&mut write_buffer,
|
||||
1024,
|
||||
&mut recv_buffer,
|
||||
1024,
|
||||
config,
|
||||
);
|
||||
|
||||
info!("Connecting to MQTT...");
|
||||
client.connect_to_broker().await.unwrap();
|
||||
if client.connect_to_broker().await.is_err() {
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
};
|
||||
info!("MQTT Connected!");
|
||||
|
||||
// We wait with marking as booted until everything is connected
|
||||
@@ -404,10 +430,10 @@ async fn main(spawner: Spawner) {
|
||||
)
|
||||
.await
|
||||
{
|
||||
Either3::First(_) => {
|
||||
client.send_ping().await.unwrap();
|
||||
None
|
||||
}
|
||||
Either3::First(_) => Some(StateMessage::new(
|
||||
controller.get_state(),
|
||||
bme280.measure(&mut delay).await.unwrap(),
|
||||
)),
|
||||
Either3::Second(message) => match message {
|
||||
Ok((TOPIC_UPDATE, url)) => {
|
||||
let url: Vec<_, 256> = match Vec::from_slice(url) {
|
||||
@@ -449,15 +475,24 @@ async fn main(spawner: Spawner) {
|
||||
|
||||
controller.set_state(message.get_state());
|
||||
|
||||
Some(StateMessage::new(controller.get_state()))
|
||||
Some(StateMessage::new(
|
||||
controller.get_state(),
|
||||
bme280.measure(&mut delay).await.unwrap(),
|
||||
))
|
||||
}
|
||||
Ok(_) => None,
|
||||
Err(err) => {
|
||||
error!("{}", err);
|
||||
None
|
||||
info!("Restarting in 5s...");
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
info!("Restarting...");
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
}
|
||||
},
|
||||
Either3::Third(state) => Some(StateMessage::new(state)),
|
||||
Either3::Third(state) => Some(StateMessage::new(
|
||||
state,
|
||||
bme280.measure(&mut delay).await.unwrap(),
|
||||
)),
|
||||
};
|
||||
|
||||
if let Some(message) = message {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
probe-run --chip RP2040 --log-format="{L} {s}
|
||||
└─ [{t}] {m} @ {F}:{l}" $@
|
||||
Reference in New Issue
Block a user