13 #include <TeensyThreads.h>
17 #define PDU_CMD_OFFSET 48
19 #define NUMBER_OF_SWITCHES 12
22 #define PDU_WARMUP_TIME 5 * SECONDS
24 #define PDU_RETRY_INTERVAL 1 * SECONDS
26 #define BURN_WIRE_ON_TIME 5 * SECONDS
28 #define DEPLOYMENT_DELAY 5 * SECONDS
35 #define DEPLOYMENT_LENGTH 60 * SECONDS
37 #define DEPLOYMENT_LOOP_INTERVAL 10 * SECONDS
39 #define HEATER_CHECK_INTERVAL 60 * SECONDS
41 #define PDU_COMMUNICATION_TIMEOUT 5 * SECONDS
53 CommandGetSwitchStatus,
85 {
"all", PDU_SW::All},
86 {
"3v3_1", PDU_SW::SW_3V3_1},
87 {
"3v3_2", PDU_SW::SW_3V3_2},
88 {
"5v_1", PDU_SW::SW_5V_1},
89 {
"5v_2", PDU_SW::SW_5V_2},
90 {
"5v_3", PDU_SW::SW_5V_3},
91 {
"5v_4", PDU_SW::SW_5V_4},
92 {
"12v", PDU_SW::SW_12V},
93 {
"vbatt", PDU_SW::VBATT},
94 {
"wdt", PDU_SW::WDT},
95 {
"hbridge1", PDU_SW::HBRIDGE1},
96 {
"hbridge2", PDU_SW::HBRIDGE2},
97 {
"burn", PDU_SW::BURN},
98 {
"burn1", PDU_SW::BURN1},
99 {
"burn2", PDU_SW::BURN2},
100 {
"rpi", PDU_SW::RPI},
107 uint8_t sw_state = 0;
111 PDU_Type type = PDU_Type::DataSwitchTelem;
115 PDU(HardwareSerial *hw_serial,
int baud_rate);
132 HardwareSerial *serial;
The PDU class.
Definition: pdu.h:46
PDU(HardwareSerial *hw_serial, int baud_rate)
Construct a new PDU object.
Definition: pdu.cpp:17
PDU_SW_State
Enumeration of PDU switch state.
Definition: pdu.h:79
std::map< std::string, PDU_SW > PDU_SW_Type
Mapping between PDU switches and their string names.
Definition: pdu.h:84
PDU_SW_State switch_states[NUMBER_OF_SWITCHES]
The status of each switch on the PDU.
Definition: pdu.h:128
bool set_burn_wire(PDU_SW_State state)
Wrapper function to set the burn wire switch.
Definition: pdu.cpp:202
PDU_Type
Enumeration of PDU packet types.
Definition: pdu.h:49
PDU_SW
Enumeration of PDU switches.
Definition: pdu.h:59
bool set_switch(PDU_SW sw, PDU_SW_State state)
Set a switch on the PDU.
Definition: pdu.cpp:149
bool refresh_switch_states()
Refresh the internal PDU class's switch states.
Definition: pdu.cpp:213
bool ping()
Ping the PDU.
Definition: pdu.cpp:119
bool set_heater(PDU_SW_State state)
Wrapper function to set the heater switch.
Definition: pdu.cpp:191
Headers and definitions common to all COSMOS Kernel.
The header file for helper functions.
PacketComm packet
The packet used throughout the channel.
Definition: pdu_channel.cpp:19
#define NUMBER_OF_SWITCHES
The number of switches on the PDU.
Definition: pdu.h:19
The PDU packet structure.
Definition: pdu.h:104
The PDU telemetry packet structure.
Definition: pdu.h:110