Skip to content
Snippets Groups Projects
Commit f5335270 authored by Alberto Nidasio's avatar Alberto Nidasio
Browse files

Rebased

parent ac1282f5
No related branches found
No related tags found
No related merge requests found
mod default; mod default;
mod messages_viewer; mod messages_viewer;
mod pid;
mod pid_drawing_tool; mod pid_drawing_tool;
pub mod plot; pub mod plot;
...@@ -48,7 +49,12 @@ pub enum PaneKind { ...@@ -48,7 +49,12 @@ pub enum PaneKind {
#[strum(message = "Plot 2D")] #[strum(message = "Plot 2D")]
Plot2D(plot::Plot2DPane), Plot2D(plot::Plot2DPane),
PidDrawingTool(pid_drawing_tool::PidPane),
#[strum(message = "PID Old")]
PidOld(pid_drawing_tool::PidPane),
#[strum(message = "PID New")]
Pid(pid::Pid),
} }
impl Default for PaneKind { impl Default for PaneKind {
......
use super::PaneBehavior; use super::PaneBehavior;
use super::{pid_drawing_tool::PidPane, plot::Plot2DPane, Pane, PaneBehavior, PaneKind};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::debug; use tracing::debug;
...@@ -39,11 +38,6 @@ impl PaneBehavior for DefaultPane { ...@@ -39,11 +38,6 @@ impl PaneBehavior for DefaultPane {
if ui.button("Widget Gallery").clicked() { if ui.button("Widget Gallery").clicked() {
response.set_action(PaneAction::ReplaceThroughGallery(Some(tile_id))); response.set_action(PaneAction::ReplaceThroughGallery(Some(tile_id)));
} }
if ui.button("Pid Drawing Tool").clicked() {
response.set_action(PaneAction::Replace(Pane::boxed(
PaneKind::PidDrawingTool(PidPane::default()),
)));
}
}) })
.response .response
}); });
......
...@@ -6,6 +6,7 @@ mod symbols; ...@@ -6,6 +6,7 @@ mod symbols;
use connections::Connection; use connections::Connection;
use core::f32; use core::f32;
use egui::{Color32, Context, CursorIcon, PointerButton, Response, Sense, Theme, Ui}; use egui::{Color32, Context, CursorIcon, PointerButton, Response, Sense, Theme, Ui};
use egui_tiles::TileId;
use elements::Element; use elements::Element;
use glam::Vec2; use glam::Vec2;
use grid::GridInfo; use grid::GridInfo;
...@@ -54,7 +55,7 @@ impl PartialEq for PidPane { ...@@ -54,7 +55,7 @@ impl PartialEq for PidPane {
} }
impl PaneBehavior for PidPane { impl PaneBehavior for PidPane {
fn ui(&mut self, ui: &mut egui::Ui) -> PaneResponse { fn ui(&mut self, ui: &mut egui::Ui, _: TileId) -> PaneResponse {
let theme = PidPane::find_theme(ui.ctx()); let theme = PidPane::find_theme(ui.ctx());
if self.center_content && !self.editable { if self.center_content && !self.editable {
......
...@@ -6,6 +6,8 @@ use motor_valve::MotorValve; ...@@ -6,6 +6,8 @@ use motor_valve::MotorValve;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumIter}; use strum_macros::{Display, EnumIter};
use crate::mavlink::ViewId;
#[derive(Clone, Serialize, Deserialize, PartialEq, EnumIter, Display, Debug)] #[derive(Clone, Serialize, Deserialize, PartialEq, EnumIter, Display, Debug)]
pub enum Symbol { pub enum Symbol {
Arrow, Arrow,
...@@ -172,7 +174,7 @@ struct MavlinkValue { ...@@ -172,7 +174,7 @@ struct MavlinkValue {
field: String, field: String,
#[serde(skip)] #[serde(skip)]
view_id: egui::Id, view_id: ViewId,
} }
#[derive(Deserialize)] #[derive(Deserialize)]
...@@ -186,7 +188,7 @@ impl From<SerialMavlinkValue> for MavlinkValue { ...@@ -186,7 +188,7 @@ impl From<SerialMavlinkValue> for MavlinkValue {
Self { Self {
msg_id: value.msg_id, msg_id: value.msg_id,
field: value.field, field: value.field,
view_id: egui::Id::new(""), view_id: ViewId::new(),
} }
} }
} }
use crate::mavlink::{extract_from_message, MavlinkResult, MessageView, TimedMessage}; use crate::mavlink::{extract_from_message, MavlinkResult, MessageView, TimedMessage, ViewId};
use super::MavlinkValue; use super::MavlinkValue;
...@@ -19,7 +19,7 @@ impl Default for MotorValve { ...@@ -19,7 +19,7 @@ impl Default for MotorValve {
source: MavlinkValue { source: MavlinkValue {
msg_id: orion::GSE_TM_DATA::ID, msg_id: orion::GSE_TM_DATA::ID,
field: "n2o_filling_valve_state".to_string(), field: "n2o_filling_valve_state".to_string(),
view_id: egui::Id::new(""), view_id: ViewId::new(),
}, },
last_value: None, last_value: None,
} }
...@@ -27,8 +27,8 @@ impl Default for MotorValve { ...@@ -27,8 +27,8 @@ impl Default for MotorValve {
} }
impl MessageView for MotorValve { impl MessageView for MotorValve {
fn widget_id(&self) -> &egui::Id { fn view_id(&self) -> ViewId {
&self.source.view_id self.source.view_id
} }
fn id_of_interest(&self) -> u32 { fn id_of_interest(&self) -> u32 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment