diff --git a/Cargo.lock b/Cargo.lock index f8fad4f..101f53b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bare-metal" @@ -53,7 +53,7 @@ dependencies = [ "arbitrary-int", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -100,7 +100,7 @@ checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -117,9 +117,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.15" +version = "1.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "3bbb537bb4a30b90362caddba8f360c0a56bc13d3a5570028e7197204cb54a17" dependencies = [ "jobserver", "libc", @@ -198,7 +198,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -209,7 +209,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -460,9 +460,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", @@ -485,9 +485,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libgit2-sys" @@ -560,9 +560,9 @@ dependencies = [ [[package]] name = "miniconf" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8954fad4aada6a559edc5753c428cde9bc1d317f7672a5898b9943e7be414abc" +checksum = "5c6b2564a43efc42f7a739630c9752504f4eead801b5db791398538c7f1ebe27" dependencies = [ "itoa", "miniconf_derive", @@ -573,21 +573,21 @@ dependencies = [ [[package]] name = "miniconf_derive" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0cba49d607e4b2ab1b511d182112d5833397f6bb3f404b666e1be6bf94bd43" +checksum = "1767ec579af0f56cfa836adabcc69f90a0fd6d65036a3899136d355277590d13" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] name = "miniconf_mqtt" -version = "0.14.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b62859f66f4e14fa77ec84605845a6ad9b95447630b05535e529507db35dafc" +checksum = "177c142faa49a5bc71ced59afc159fc67820d99677a206e7d8992fe7bce93970" dependencies = [ "embedded-io", "heapless 0.8.0", @@ -596,6 +596,7 @@ dependencies = [ "minimq", "serde-json-core", "smlang 0.8.0", + "strum", ] [[package]] @@ -740,7 +741,7 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -788,15 +789,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] name = "postcard" @@ -890,7 +891,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -1049,7 +1050,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -1072,13 +1073,13 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] name = "serial-settings" version = "0.1.0" -source = "git+https://github.com/quartiq/stabilizer.git#82995474fb08c51c5b5a96a50b5ea64514ef53a4" +source = "git+https://github.com/quartiq/stabilizer.git#e7a228e2313a8bd305700315480386cafad9b184" dependencies = [ "embedded-io", "heapless 0.8.0", @@ -1254,7 +1255,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.76", + "syn 2.0.79", ] [[package]] @@ -1270,9 +1271,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -1367,15 +1368,15 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] diff --git a/Cargo.toml b/Cargo.toml index e7ed4e1..5d000da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,8 +63,8 @@ bytemuck = { version = "1.18.0", features = [ "derive", ], default-features = false } # Note: Keep in-sync with `py/setup.py` -miniconf = { version = "0.14", features = ["json-core", "derive", "postcard"] } -miniconf_mqtt = { version = "0.14" } +miniconf = { version = "0.15", features = ["json-core", "derive", "postcard"] } +miniconf_mqtt = { version = "0.15" } strum = { version = "0.26.1", default-features = false, features = ["derive"] } serial-settings = "0.1" postcard = "1" diff --git a/src/hardware/setup.rs b/src/hardware/setup.rs index 7262365..6f52070 100644 --- a/src/hardware/setup.rs +++ b/src/hardware/setup.rs @@ -126,9 +126,7 @@ pub fn setup( clock: crate::SystemTimer, ) -> ThermostatDevices where - C: serial_settings::Settings - + for<'d> miniconf::JsonCoreSlash<'d, Y> - + crate::settings::AppSettings, + C: serial_settings::Settings + crate::settings::AppSettings, { // Set up RTT logging { diff --git a/src/net/mod.rs b/src/net/mod.rs index d656ded..fe47681 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -24,7 +24,7 @@ use telemetry::TelemetryClient; use core::fmt::Write; use heapless::String; -use miniconf::{JsonCoreSlash, Tree}; +use miniconf::{Tree, TreeDeserializeOwned, TreeSerialize}; pub type NetworkReference = smoltcp_nal::shared::NetworkStackProxy<'static, NetworkStack>; @@ -57,7 +57,7 @@ pub enum NetworkState { /// A structure of Stabilizer's default network users. pub struct NetworkUsers where - for<'de> S: Default + JsonCoreSlash<'de, Y> + Clone, + S: Default + TreeDeserializeOwned + TreeSerialize + Clone, { pub miniconf: miniconf_mqtt::MqttClient< 'static, @@ -75,7 +75,7 @@ where impl NetworkUsers where - for<'de> S: Default + JsonCoreSlash<'de, Y> + Clone, + S: Default + TreeDeserializeOwned + TreeSerialize + Clone, { /// Construct Stabilizer's default network users. /// diff --git a/src/settings.rs b/src/settings.rs index fe80f04..08a56dd 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -27,7 +27,7 @@ use core::fmt::Write; use embassy_futures::block_on; use embedded_io::Write as EioWrite; use heapless::{String, Vec}; -use miniconf::{JsonCoreSlash, Path, Postcard, Tree}; +use miniconf::{postcard, Path, Tree, TreeDeserializeOwned, TreeSerialize}; use sequential_storage::{ cache::NoCache, map::{fetch_item, store_item, SerializationError}, @@ -80,7 +80,7 @@ pub struct SettingsKey(Vec); impl sequential_storage::map::Key for SettingsKey { fn serialize_into(&self, buffer: &mut [u8]) -> Result { - Ok(postcard::to_slice(self, buffer) + Ok(::postcard::to_slice(self, buffer) .map_err(|_| SerializationError::BufferTooSmall)? .len()) } @@ -88,7 +88,7 @@ impl sequential_storage::map::Key for SettingsKey { fn deserialize_from(buffer: &[u8]) -> Result<(Self, usize), SerializationError> { let original_length = buffer.len(); let (result, remainder) = - postcard::take_from_bytes(buffer).map_err(|_| SerializationError::BufferTooSmall)?; + ::postcard::take_from_bytes(buffer).map_err(|_| SerializationError::BufferTooSmall)?; Ok((result, original_length - remainder.len())) } } @@ -108,7 +108,7 @@ pub struct SerialSettingsPlatform { impl SerialSettingsPlatform where - C: for<'d> JsonCoreSlash<'d, Y>, + C: TreeDeserializeOwned + TreeSerialize, { pub fn load(structure: &mut C, storage: &mut Flash) { // Loop over flash and read settings @@ -140,8 +140,8 @@ where log::info!("Loading initial `{}` from flash", path.as_str()); - let flavor = postcard::de_flavors::Slice::new(value); - if let Err(e) = structure.set_postcard_by_key(&path, flavor) { + let flavor = ::postcard::de_flavors::Slice::new(value); + if let Err(e) = postcard::set_by_key(structure, &path, flavor) { log::warn!( "Failed to deserialize `{}` from flash: {e:?}", path.as_str()