Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename sender to node #102

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions boards/beacon/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use messages::sender::Sender;
use messages::sender::Sender::BeaconBoard;
use messages::node::Node;
use messages::node::Node::BeaconBoard;

// -------
// Sender ID
// Node ID
// -------
pub static COM_ID: Sender = BeaconBoard;
pub static COM_ID: Node = BeaconBoard;

Check warning on line 7 in boards/beacon/src/types.rs

View workflow job for this annotation

GitHub Actions / clippy

static `COM_ID` is never used

warning: static `COM_ID` is never used --> boards/beacon/src/types.rs:7:12 | 7 | pub static COM_ID: Node = BeaconBoard; | ^^^^^^
2 changes: 1 addition & 1 deletion boards/camera/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,26 @@
}

pub struct CanDevice0 {
pub can: Can<
'static,
Can0,
Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>,
Capacities,
>,

Check warning on line 53 in boards/camera/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> boards/camera/src/communication.rs:48:14 | 48 | pub can: Can< | ______________^ 49 | | 'static, 50 | | Can0, 51 | | Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>, 52 | | Capacities, 53 | | >, | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
line_interrupts: OwnedInterruptSet<Can0, EnabledLine0>,
}

impl CanDevice0 {
pub fn new<S>(
can_rx: Pin<PA23, AlternateI>,
can_tx: Pin<PA22, AlternateI>,
pclk_can: Pclk<Can0, Gclk0Id>,
ahb_clock: AhbClk<Can0>,
peripheral: CAN0,
gclk0: S,
can_memory: &'static mut SharedMemory<Capacities>,
loopback: bool,
) -> (Self, S::Inc)

Check warning on line 67 in boards/camera/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> boards/camera/src/communication.rs:58:5 | 58 | / pub fn new<S>( 59 | | can_rx: Pin<PA23, AlternateI>, 60 | | can_tx: Pin<PA22, AlternateI>, 61 | | pclk_can: Pclk<Can0, Gclk0Id>, ... | 66 | | loopback: bool, 67 | | ) -> (Self, S::Inc) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments = note: `#[warn(clippy::too_many_arguments)]` on by default
where
S: Source<Id = Gclk0Id> + Increment,
{
Expand Down Expand Up @@ -103,7 +103,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::SensorBoard.into())
filter: ecan::StandardId::new(messages::node::Node::SensorBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand Down
6 changes: 3 additions & 3 deletions boards/camera/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use messages::sender::{Sender, Sender::CameraBoard};
use messages::node::{Node, Node::CameraBoard};
// -------
// Sender ID
// Node ID
// -------
pub static _COM_ID: Sender = CameraBoard;
pub static _COM_ID: Node = CameraBoard;
8 changes: 4 additions & 4 deletions boards/communication/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@
}

pub struct CanDevice0 {
pub can: Can<
'static,
Can0,
Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>,
Capacities,
>,

Check warning on line 67 in boards/communication/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> boards/communication/src/communication.rs:62:14 | 62 | pub can: Can< | ______________^ 63 | | 'static, 64 | | Can0, 65 | | Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>, 66 | | Capacities, 67 | | >, | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
line_interrupts: OwnedInterruptSet<Can0, EnabledLine0>,
}

impl CanDevice0 {
pub fn new<S>(
can_rx: Pin<PA23, AlternateI>,
can_tx: Pin<PA22, AlternateI>,
pclk_can: Pclk<Can0, Gclk0Id>,
ahb_clock: AhbClk<Can0>,
peripheral: CAN0,
gclk0: S,
can_memory: &'static mut SharedMemory<Capacities>,
loopback: bool,
) -> (Self, S::Inc)

Check warning on line 81 in boards/communication/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> boards/communication/src/communication.rs:72:5 | 72 | / pub fn new<S>( 73 | | can_rx: Pin<PA23, AlternateI>, 74 | | can_tx: Pin<PA22, AlternateI>, 75 | | pclk_can: Pclk<Can0, Gclk0Id>, ... | 80 | | loopback: bool, 81 | | ) -> (Self, S::Inc) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments = note: `#[warn(clippy::too_many_arguments)]` on by default
where
S: Source<Id = Gclk0Id> + Increment,
{
Expand Down Expand Up @@ -120,7 +120,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::RecoveryBoard.into())
filter: ecan::StandardId::new(messages::node::Node::RecoveryBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand All @@ -129,7 +129,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo1,
filter: ecan::StandardId::new(messages::sender::Sender::SensorBoard.into())
filter: ecan::StandardId::new(messages::node::Node::SensorBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand All @@ -138,15 +138,15 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::PowerBoard.into()).unwrap(),
filter: ecan::StandardId::new(messages::node::Node::PowerBoard.into()).unwrap(),
mask: ecan::StandardId::ZERO,
})
.unwrap_or_else(|_| panic!("Power filter"));

can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::GroundStation.into())
filter: ecan::StandardId::new(messages::node::Node::GroundStation.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand Down Expand Up @@ -299,16 +299,16 @@
// Do we need the header?
match msg {
mavlink::uorocketry::MavMessage::POSTCARD_MESSAGE(msg) => {
return Ok(postcard::from_bytes::<Message>(&msg.message)?);

Check warning on line 302 in boards/communication/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded `return` statement

warning: unneeded `return` statement --> boards/communication/src/communication.rs:302:21 | 302 | return Ok(postcard::from_bytes::<Message>(&msg.message)?); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return = note: `#[warn(clippy::needless_return)]` on by default help: remove `return` | 302 - return Ok(postcard::from_bytes::<Message>(&msg.message)?); 302 + Ok(postcard::from_bytes::<Message>(&msg.message)?) |
// weird Ok syntax to coerce to hydra error type.
}
_ => {
herror!(Error, ErrorContext::UnkownPostcardMessage);
return Err(mavlink::error::MessageReadError::Io.into());

Check warning on line 307 in boards/communication/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded `return` statement

warning: unneeded `return` statement --> boards/communication/src/communication.rs:307:21 | 307 | return Err(mavlink::error::MessageReadError::Io.into()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 307 - return Err(mavlink::error::MessageReadError::Io.into()); 307 + Err(mavlink::error::MessageReadError::Io.into()) |
}
}
} else {
return Err(mavlink::error::MessageReadError::Io.into());

Check warning on line 311 in boards/communication/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded `return` statement

warning: unneeded `return` statement --> boards/communication/src/communication.rs:311:13 | 311 | return Err(mavlink::error::MessageReadError::Io.into()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 311 - return Err(mavlink::error::MessageReadError::Io.into()); 311 + Err(mavlink::error::MessageReadError::Io.into()) |
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions boards/communication/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use atsamd_hal::gpio::*;
use atsamd_hal::sercom::uart::EightBit;
use atsamd_hal::sercom::{uart, IoSet1, Sercom5};
use messages::sender::Sender;
use messages::sender::Sender::CommunicationBoard;
use messages::node::Node;
use messages::node::Node::CommunicationBoard;

// -------
// Sender ID
// Node ID
// -------
pub static COM_ID: Sender = CommunicationBoard;
pub static COM_ID: Node = CommunicationBoard;

// -------
// Ground Station
Expand Down
2 changes: 1 addition & 1 deletion boards/power/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@
}

pub struct CanDevice0 {
pub can: Can<
'static,
Can0,
Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>,
Capacities,
>,

Check warning on line 55 in boards/power/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> boards/power/src/communication.rs:50:14 | 50 | pub can: Can< | ______________^ 51 | | 'static, 52 | | Can0, 53 | | Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>, 54 | | Capacities, 55 | | >, | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
line_interrupts: OwnedInterruptSet<Can0, EnabledLine0>,

Check warning on line 56 in boards/power/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

field `line_interrupts` is never read

warning: field `line_interrupts` is never read --> boards/power/src/communication.rs:56:5 | 49 | pub struct CanDevice0 { | ---------- field in this struct ... 56 | line_interrupts: OwnedInterruptSet<Can0, EnabledLine0>, | ^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default
}

impl CanDevice0 {
pub fn new<S>(
can_rx: Pin<PA23, AlternateI>,
can_tx: Pin<PA22, AlternateI>,
pclk_can: Pclk<Can0, Gclk0Id>,
ahb_clock: AhbClk<Can0>,
peripheral: CAN0,
gclk0: S,
can_memory: &'static mut SharedMemory<Capacities>,
loopback: bool,
) -> (Self, S::Inc)

Check warning on line 69 in boards/power/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> boards/power/src/communication.rs:60:5 | 60 | / pub fn new<S>( 61 | | can_rx: Pin<PA23, AlternateI>, 62 | | can_tx: Pin<PA22, AlternateI>, 63 | | pclk_can: Pclk<Can0, Gclk0Id>, ... | 68 | | loopback: bool, 69 | | ) -> (Self, S::Inc) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments = note: `#[warn(clippy::too_many_arguments)]` on by default
where
S: Source<Id = Gclk0Id> + Increment,
{
Expand Down Expand Up @@ -108,7 +108,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo1,
filter: ecan::StandardId::new(messages::sender::Sender::CommunicationBoard.into())
filter: ecan::StandardId::new(messages::node::Node::CommunicationBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand Down
6 changes: 3 additions & 3 deletions boards/power/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use messages::sender::{Sender, Sender::PowerBoard};
use messages::node::{Node, Node::PowerBoard};
// -------
// Sender ID
// Node ID
// -------
pub static _COM_ID: Sender = PowerBoard;
pub static _COM_ID: Node = PowerBoard;
4 changes: 2 additions & 2 deletions boards/recovery/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@
}

pub struct CanDevice0 {
pub can: Can<
'static,
Can0,
Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>,
Capacities,
>,

Check warning on line 57 in boards/recovery/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> boards/recovery/src/communication.rs:52:14 | 52 | pub can: Can< | ______________^ 53 | | 'static, 54 | | Can0, 55 | | Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>, 56 | | Capacities, 57 | | >, | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
line_interrupts: OwnedInterruptSet<Can0, EnabledLine0>,
}

impl CanDevice0 {
pub fn new<S>(
can_rx: Pin<PA23, AlternateI>,
can_tx: Pin<PA22, AlternateI>,
pclk_can: Pclk<Can0, Gclk0Id>,
ahb_clock: AhbClk<Can0>,
peripheral: CAN0,
gclk0: S,
can_memory: &'static mut SharedMemory<Capacities>,
loopback: bool,
) -> (Self, S::Inc)

Check warning on line 71 in boards/recovery/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> boards/recovery/src/communication.rs:62:5 | 62 | / pub fn new<S>( 63 | | can_rx: Pin<PA23, AlternateI>, 64 | | can_tx: Pin<PA22, AlternateI>, 65 | | pclk_can: Pclk<Can0, Gclk0Id>, ... | 70 | | loopback: bool, 71 | | ) -> (Self, S::Inc) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments = note: `#[warn(clippy::too_many_arguments)]` on by default
where
S: Source<Id = Gclk0Id> + Increment,
{
Expand Down Expand Up @@ -111,7 +111,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::SensorBoard.into())
filter: ecan::StandardId::new(messages::node::Node::SensorBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand All @@ -121,7 +121,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo1,
filter: ecan::StandardId::new(messages::sender::Sender::CommunicationBoard.into())
filter: ecan::StandardId::new(messages::node::Node::CommunicationBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::state_machine::{RocketStates, State, StateMachineContext, TransitionI
use crate::types::COM_ID;
use defmt::{write, Format, Formatter};
use messages::command::{Command, PowerDown, RadioRate, RadioRateChange};
use messages::sender::Sender::SensorBoard;
use messages::node::Node::SensorBoard;
use messages::Message;
use rtic::mutex::Mutex;

Expand Down
8 changes: 4 additions & 4 deletions boards/recovery/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use messages::sender::Sender;
use messages::sender::Sender::RecoveryBoard;
use messages::node::Node;
use messages::node::Node::RecoveryBoard;

// -------
// Sender ID
// Node ID
// -------
pub static COM_ID: Sender = RecoveryBoard;
pub static COM_ID: Node = RecoveryBoard;
6 changes: 3 additions & 3 deletions boards/sensor/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,26 @@
}

pub struct CanDevice0 {
pub can: Can<
'static,
Can0,
Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>,
Capacities,
>,

Check warning on line 59 in boards/sensor/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> boards/sensor/src/communication.rs:54:14 | 54 | pub can: Can< | ______________^ 55 | | 'static, 56 | | Can0, 57 | | Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>, 58 | | Capacities, 59 | | >, | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
line_interrupts: OwnedInterruptSet<Can0, EnabledLine0>,
}

impl CanDevice0 {
pub fn new<S>(
can_rx: Pin<PA23, AlternateI>,
can_tx: Pin<PA22, AlternateI>,
pclk_can: Pclk<Can0, Gclk0Id>,
ahb_clock: AhbClk<Can0>,
peripheral: CAN0,
gclk0: S,
can_memory: &'static mut SharedMemory<Capacities>,
loopback: bool,
) -> (Self, S::Inc)

Check warning on line 73 in boards/sensor/src/communication.rs

View workflow job for this annotation

GitHub Actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> boards/sensor/src/communication.rs:64:5 | 64 | / pub fn new<S>( 65 | | can_rx: Pin<PA23, AlternateI>, 66 | | can_tx: Pin<PA22, AlternateI>, 67 | | pclk_can: Pclk<Can0, Gclk0Id>, ... | 72 | | loopback: bool, 73 | | ) -> (Self, S::Inc) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments = note: `#[warn(clippy::too_many_arguments)]` on by default
where
S: Source<Id = Gclk0Id> + Increment,
{
Expand Down Expand Up @@ -112,7 +112,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::CommunicationBoard.into())
filter: ecan::StandardId::new(messages::node::Node::CommunicationBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand All @@ -121,7 +121,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo0,
filter: ecan::StandardId::new(messages::sender::Sender::RecoveryBoard.into())
filter: ecan::StandardId::new(messages::node::Node::RecoveryBoard.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand All @@ -130,7 +130,7 @@
can.filters_standard()
.push(Filter::Classic {
action: Action::StoreFifo1,
filter: ecan::StandardId::new(messages::sender::Sender::GroundStation.into())
filter: ecan::StandardId::new(messages::node::Node::GroundStation.into())
.unwrap(),
mask: ecan::StandardId::ZERO,
})
Expand Down
8 changes: 4 additions & 4 deletions boards/sensor/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use hal::dmac::BufferPair;
use hal::sercom::IoSet2;

use hal::sercom::Sercom4;
use messages::sender::Sender;
use messages::sender::Sender::SensorBoard;
use messages::node::Node;
use messages::node::Node::SensorBoard;
use sbg_rs::sbg::SBG_BUFFER_SIZE;

// -------
// Sender ID
// Node ID
// -------
pub static COM_ID: Sender = SensorBoard;
pub static COM_ID: Node = SensorBoard;

// -------
// SBG
Expand Down
4 changes: 2 additions & 2 deletions libraries/messages/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::sender::Sender;
use crate::node::Node;
use derive_more::From;
use messages_proc_macros_lib::common_derives;

Expand Down Expand Up @@ -32,7 +32,7 @@ pub struct DeployMain {
#[common_derives]
#[derive(From)]
pub struct PowerDown {
pub board: Sender, // This isn't proper naming !! This is the board to be powered down. Changes name of sender.rs to board.rs.
pub board: Node,
}

#[common_derives]
Expand Down
8 changes: 4 additions & 4 deletions libraries/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use crate::command::Command;
use crate::health::Health;
use crate::sender::Sender;
use crate::node::Node;
use crate::sensor::Sensor;
use crate::state::State;
use derive_more::From;
Expand All @@ -19,7 +19,7 @@ use messages_proc_macros_lib::common_derives;
pub mod command;
pub mod health;
mod logging;
pub mod sender;
pub mod node;
pub mod sensor;
pub mod sensor_status;
pub mod state;
Expand All @@ -37,7 +37,7 @@ pub struct Message {
pub timestamp: u64,

/// The original sender of this message.
pub sender: Sender,
pub sender: Node,

/// The data contained in this message.
pub data: Data,
Expand All @@ -57,7 +57,7 @@ pub enum Data {
impl Message {
pub fn new<const NOM: u32, const DENOM: u32>(
timestamp: &Instant<u64, NOM, DENOM>,
sender: Sender,
sender: Node,
data: impl Into<Data>,
) -> Self {
Message {
Expand Down
27 changes: 27 additions & 0 deletions libraries/messages/src/node.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use messages_proc_macros_lib::common_derives;

#[common_derives]
#[derive(Copy)]
pub enum Node {
GroundStation,
SensorBoard,
RecoveryBoard,
CommunicationBoard,
PowerBoard,
CameraBoard,
BeaconBoard,
}

impl From<Node> for u16 {
fn from(node: Node) -> Self {
match node {
Node::GroundStation => 0,
Node::SensorBoard => 1,
Node::RecoveryBoard => 2,
Node::CommunicationBoard => 3,
Node::PowerBoard => 4,
Node::CameraBoard => 5,
Node::BeaconBoard => 6,
}
}
}
28 changes: 0 additions & 28 deletions libraries/messages/src/sender.rs

This file was deleted.

Loading