Skip to content

Commit

Permalink
Renamed sender to node in applicable settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyharani committed Mar 23, 2024
1 parent a13b069 commit 7b934af
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 68 deletions.
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 @@ -103,7 +103,7 @@ impl CanDevice0 {
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 @@ -120,7 +120,7 @@ impl CanDevice0 {
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 @@ impl CanDevice0 {
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 @@ impl CanDevice0 {
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
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 @@ -108,7 +108,7 @@ impl CanDevice0 {
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 @@ -111,7 +111,7 @@ impl CanDevice0 {
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 @@ impl CanDevice0 {
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 @@ -112,7 +112,7 @@ impl CanDevice0 {
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 @@ impl CanDevice0 {
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 @@ impl CanDevice0 {
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, // This isn't proper naming !! This is the board to be powered down. Changes name of sender.rs to board.rs.
}

#[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
28 changes: 28 additions & 0 deletions libraries/messages/src/node.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use messages_proc_macros_lib::common_derives;

// I don't agree with the naming, We can use these as Ids to sent commands to that specific board.
#[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.

0 comments on commit 7b934af

Please sign in to comment.