Basic working impedance.

This commit is contained in:
2025-08-14 17:31:46 +02:00
parent 03a04bf789
commit bf3f00cfb0
4 changed files with 70 additions and 16 deletions

View File

@@ -22,7 +22,7 @@ use postcard_rpc::{
use bioz_icd_rs::{PingEndpoint, GetUniqueIdEndpoint, SetGreenLedEndpoint, StartImpedanceEndpoint, StopImpedanceEndpoint, StartImpedance, Impedance, ImpedanceTopic, ENDPOINT_LIST, TOPICS_IN_LIST, TOPICS_OUT_LIST};
use crate::impedance_test::{ImpedanceTest, IMPEDANCE_TEST};
use crate::impedance_test::{ImpedanceTest, IMPEDANCE_TEST, IMPEDANCE_CHANNEL};
// Postcard RPC types
type AppDriver = usb::Driver<'static, peripherals::USB>;
@@ -179,13 +179,21 @@ pub async fn start_impedance_handler(context: SpawnCtx, header: VarHeader, rqst:
let mut ticker = Ticker::every(Duration::from_hz(rqst.update_frequency.into()));
let mut seq: u8 = 0;
while !*STOP.lock().await {
ticker.next().await;
// ticker.next().await;
impedance.update(rqst.sinus_frequency);
// impedance.update(rqst.sinus_frequency);
// let msg = Impedance {
// magnitude: impedance.magnitude,
// phase: impedance.phase,
// };
let data = IMPEDANCE_CHANNEL.receive().await;
let msg = Impedance {
magnitude: impedance.magnitude,
phase: impedance.phase,
magnitude: data,
phase: data,
};
if sender