mirror of
https://github.com/hubaldv/bioz-icd-rs.git
synced 2026-01-22 18:34:32 +00:00
Updated start/stop/log using postcard-rpc.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
[package]
|
||||
name = "bioz-icd-rs"
|
||||
name = "EQ-DA-icd"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
postcard-rpc = { version = "0.11.12" }
|
||||
defmt = "1.0.1"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0.219"
|
||||
|
||||
43
src/lib.rs
43
src/lib.rs
@@ -4,6 +4,8 @@ use postcard_rpc::{endpoints, topics, TopicDirection};
|
||||
use postcard_schema::Schema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use defmt::Format;
|
||||
|
||||
// ---
|
||||
|
||||
endpoints! {
|
||||
@@ -13,9 +15,10 @@ endpoints! {
|
||||
| ---------- | --------- | ---------- | ---- |
|
||||
| PingEndpoint | u32 | u32 | "ping" |
|
||||
| GetUniqueIdEndpoint | () | [u8; 12] | "get_id" |
|
||||
| SetGreenLedEndpoint | f32 | () | "led/green" |
|
||||
| StartImpedanceEndpoint | StartImpedance | () | "imp/start" |
|
||||
| StopImpedanceEndpoint | () | bool | "imp/stop" |
|
||||
| StartDataEndpoint | () | () | "data/start" |
|
||||
| StopDataEndpoint | () | bool | "data/stop" |
|
||||
| SetAlgorithmEndpoint | SetAlgorithm | () | "algorithm/start" |
|
||||
|
||||
}
|
||||
|
||||
topics! {
|
||||
@@ -30,17 +33,35 @@ topics! {
|
||||
direction = TopicDirection::ToClient;
|
||||
| TopicTy | MessageTy | Path | Cfg |
|
||||
| ------- | --------- | ---- | --- |
|
||||
| ImpedanceTopic | Impedance | "imp/data" | |
|
||||
| AllDataTopic | AllData | "data/all" | |
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq)]
|
||||
pub struct Impedance {
|
||||
pub magnitude: f32,
|
||||
pub phase: f32,
|
||||
pub struct AllData {
|
||||
pub pressure: f32,
|
||||
pub pressure_filtered: f32,
|
||||
pub setpoint_rp: f32,
|
||||
pub setpoint_cascade: f32,
|
||||
pub temperature: f32,
|
||||
pub valve_a: u16,
|
||||
pub valve_b: u16,
|
||||
pub external_sensor: f32,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq)]
|
||||
pub struct StartImpedance {
|
||||
pub update_frequency: u32,
|
||||
pub sinus_frequency: f32,
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq, Clone, Format)]
|
||||
pub enum Algorithm {
|
||||
None,
|
||||
Embed_RP,
|
||||
Embed_Cascade_PID,
|
||||
Embed_Cascade_S,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq, Format)]
|
||||
pub struct SetAlgorithm {
|
||||
pub run: bool,
|
||||
pub algorithm: Algorithm,
|
||||
pub setpoint: f32,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user