From b7c100c2bdf0f66cc226badec7735c5c57c9f7eb Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 26 Sep 2024 13:17:48 +0800 Subject: [PATCH] pounder: update patch --- mcu-contrib/default.nix | 10 ++--- mcu-contrib/pounder-725.diff | 66 ++++++++++++++++++++-------- mcu-contrib/pounder-cargo-patch.diff | 28 ------------ 3 files changed, 53 insertions(+), 51 deletions(-) delete mode 100644 mcu-contrib/pounder-cargo-patch.diff diff --git a/mcu-contrib/default.nix b/mcu-contrib/default.nix index bb35f6a..5190326 100644 --- a/mcu-contrib/default.nix +++ b/mcu-contrib/default.nix @@ -24,12 +24,12 @@ let cargo = rust; }); - buildStm32Firmware = { name, src, cargoDepsName ? name, cargoPatches ? [], patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }: + buildStm32Firmware = { name, src, cargoDepsName ? name, patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }: rustPlatform.buildRustPackage rec { inherit name cargoDepsName; version = "0.0.0"; - inherit src cargoPatches; + inherit src; cargoLock = { lockFile = "${src}/Cargo.lock"; inherit outputHashes; }; @@ -66,10 +66,10 @@ in patchPhase = '' patch -p1 < ${./pounder-725.diff} ''; - cargoPatches = [ - ./pounder-cargo-patch.diff - ]; doCheck = false; + outputHashes = { + "menu-0.6.0" = "sha256-Zilj27J4a/T/Je2qJr6igFj2OEw0/4fU4f0t+afm4TY="; + }; } // value))) { dual-iir = {}; dual-iir-pounder_v1_0 = { diff --git a/mcu-contrib/pounder-725.diff b/mcu-contrib/pounder-725.diff index 4c9185c..fc7b2c3 100644 --- a/mcu-contrib/pounder-725.diff +++ b/mcu-contrib/pounder-725.diff @@ -216,9 +216,18 @@ index 025f7d4f..59578cce 100644 fn add_write(&mut self, register: Register, value: &[u8]) { let data = &mut self.data[self.index..]; diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs -index a4a04be8..83dcdefb 100644 +index ea566e14..84bde34a 100644 --- a/src/bin/dual-iir.rs +++ b/src/bin/dual-iir.rs +@@ -28,7 +28,7 @@ + #![no_std] + #![no_main] + +-use core::mem::MaybeUninit; ++use core::mem::{MaybeUninit, size_of}; + use core::sync::atomic::{fence, Ordering}; + use serde::{Deserialize, Serialize}; + @@ -47,6 +47,8 @@ use stabilizer::{ dac::{Dac0Output, Dac1Output, DacCode}, hal, @@ -231,7 +240,7 @@ index a4a04be8..83dcdefb 100644 @@ -179,6 +181,16 @@ pub struct DualIir { /// See [signal_generator::BasicConfig#miniconf] #[tree(depth = 2)] - signal_generator: [signal_generator::BasicConfig; 2], + source: [signal_generator::BasicConfig; 2], + + /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations + /// @@ -246,9 +255,9 @@ index a4a04be8..83dcdefb 100644 impl Default for DualIir { @@ -206,6 +218,8 @@ impl Default for DualIir { - signal_generator: [signal_generator::BasicConfig::default(); 2], + source: Default::default(), - stream_target: StreamTarget::default(), + stream: Default::default(), + + pounder: None.into(), } @@ -257,7 +266,7 @@ index a4a04be8..83dcdefb 100644 @@ -222,6 +236,7 @@ mod app { active_settings: DualIir, telemetry: TelemetryBuffer, - signal_generator: [SignalGenerator; 2], + source: [SignalGenerator; 2], + pounder: Option, } @@ -313,12 +322,12 @@ index a4a04be8..83dcdefb 100644 } } -- #[task(priority = 1, local=[afes], shared=[network, settings, active_settings, signal_generator])] -+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, signal_generator, pounder])] +- #[task(priority = 1, local=[afes], shared=[network, settings, active_settings, source])] ++ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, source, pounder])] async fn settings_update(mut c: settings_update::Context) { c.shared.settings.lock(|settings| { c.local.afes.0.set_gain(settings.dual_iir.afe[0]); -@@ -482,6 +507,17 @@ mod app { +@@ -480,6 +505,17 @@ mod app { ), } } @@ -334,9 +343,9 @@ index a4a04be8..83dcdefb 100644 + } + }); - let target = settings.dual_iir.stream_target.into(); - c.shared.network.lock(|net| net.direct_stream(target)); -@@ -492,22 +528,31 @@ mod app { + c.shared + .network +@@ -491,21 +527,30 @@ mod app { }); } @@ -344,8 +353,7 @@ index a4a04be8..83dcdefb 100644 + #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])] async fn telemetry(mut c: telemetry::Context) { loop { - let telemetry: TelemetryBuffer = - c.shared.telemetry.lock(|telemetry| *telemetry); + let telemetry = c.shared.telemetry.lock(|telemetry| *telemetry); - let (gains, telemetry_period) = + let (gains, telemetry_period, pounder_config) = @@ -372,10 +380,19 @@ index a4a04be8..83dcdefb 100644 }); diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs -index e0cfb58f..c9b26831 100644 +index 3ddecd7c..77a7474b 100644 --- a/src/bin/lockin.rs +++ b/src/bin/lockin.rs -@@ -551,6 +551,7 @@ mod app { +@@ -29,7 +29,7 @@ + + use core::{ + convert::TryFrom, +- mem::MaybeUninit, ++ mem::{MaybeUninit, size_of}, + sync::atomic::{fence, Ordering}, + }; + +@@ -547,6 +547,7 @@ mod app { gains[0], gains[1], c.local.cpu_temp_sensor.get_temperature().unwrap(), @@ -691,11 +708,24 @@ index 5bc7e9ff..5b8d5d30 100644 + } + } +} +diff --git a/src/net/data_stream.rs b/src/net/data_stream.rs +index 714ec57f..d442f197 100644 +--- a/src/net/data_stream.rs ++++ b/src/net/data_stream.rs +@@ -25,7 +25,7 @@ + + #![allow(non_camel_case_types)] // https://github.com/rust-embedded/heapless/issues/411 + +-use core::{fmt::Write, mem::MaybeUninit}; ++use core::{fmt::Write, mem::{MaybeUninit, size_of_val}}; + use heapless::{ + box_pool, + pool::boxed::{Box, BoxBlock}, diff --git a/src/net/mod.rs b/src/net/mod.rs -index a10b7cdb..efa2b8c8 100644 +index 43733fa8..a8b90f86 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs -@@ -33,14 +33,14 @@ pub type NetworkReference = +@@ -32,14 +32,14 @@ pub type NetworkReference = pub struct MqttStorage { telemetry: [u8; 2048], @@ -713,7 +743,7 @@ index a10b7cdb..efa2b8c8 100644 } } diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs -index 4aa82601..3dc3086c 100644 +index c8eb536b..116382a3 100644 --- a/src/net/telemetry.rs +++ b/src/net/telemetry.rs @@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication}; diff --git a/mcu-contrib/pounder-cargo-patch.diff b/mcu-contrib/pounder-cargo-patch.diff deleted file mode 100644 index 6d19cfe..0000000 --- a/mcu-contrib/pounder-cargo-patch.diff +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index 7c796acf..cee5ba60 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -983,9 +983,9 @@ dependencies = [ - - [[package]] - name = "serde" --version = "1.0.203" -+version = "1.0.202" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" -+checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" - dependencies = [ - "serde_derive", - ] -@@ -1003,9 +1003,9 @@ dependencies = [ - - [[package]] - name = "serde_derive" --version = "1.0.203" -+version = "1.0.202" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" -+checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" - dependencies = [ - "proc-macro2", - "quote", \ No newline at end of file