MRAS
Multi Rocket Avionics System
Loading...
Searching...
No Matches
TelemetrySystem Class Referenceabstract

A subsystem for sending and receiving telemetry data using the LoRa radio. More...

#include <TelemetrySystem.h>

Inheritance diagram for TelemetrySystem:
Inheritance graph
Collaboration diagram for TelemetrySystem:
Collaboration graph

Public Member Functions

 TelemetrySystem (uint8_t id)
 
int16_t get_radio_state () const
 
- Public Member Functions inherited from Subsystem
virtual const char * get_name ()=0
 
virtual int8_t setup ()=0
 
virtual int8_t loop ()=0
 
uint8_t get_id () const
 
int8_t get_status () const
 
int8_t self_test () const
 
bool add_subscriber (Subsystem *subscriber)
 
 Subsystem (uint8_t id)
 

Protected Types

enum  TelemetrySystemState { IDLE , TX , RX }
 

Protected Member Functions

int8_t setup () override
 
virtual TelemetryMessageQueueMsgget_default_message ()=0
 
void transmit_next_message ()
 
void start_receiving_next_message (uint32_t timeout=0xFFFFFF)
 
bool read_new_message_from_buffer (TelemetryMessageReceivedMsg *output, bool receive_again=true)
 
- Protected Member Functions inherited from Subsystem
void log (const char fmt[],...)
 
virtual void on_message (SystemMessage *msg)=0
 
void publish (SystemMessage *msg)
 

Protected Attributes

SX1262 radio
 
enum TelemetrySystem::TelemetrySystemState telemetry_system_state = IDLE
 
int16_t radio_state = 0
 
- Protected Attributes inherited from Subsystem
int8_t status = 0
 
int8_t self_test_result = -1
 

Additional Inherited Members

- Static Protected Member Functions inherited from Subsystem
static void buzzer (uint16_t frequency, uint32_t duration, bool block=false)
 

Detailed Description

A subsystem for sending and receiving telemetry data using the LoRa radio.

This subsystem is responsible for sending and receiving telemetry data from the rocket.

This subsystem uses the RadioLib library to communicate with the radio chip.

Member Function Documentation

◆ read_new_message_from_buffer()

bool TelemetrySystem::read_new_message_from_buffer ( TelemetryMessageReceivedMsg output,
bool  receive_again = true 
)
protected

After the radio is done receiving a new message, read this message from the radio buffer and output the result into the provided ReceivedTelemetryMessageMsg.

Parameters
outputA reference to a ReceivedTelemetryMessageMsg where the output message is stored
receive_againWhether to immediately start receiving data with the radio after reading from the radio buffer.
Returns
True if the operation was a success, otherwise false (such as in the case of a CRC error)

◆ setup()

int8_t TelemetrySystem::setup ( )
overrideprotectedvirtual

Implements Subsystem.

◆ start_receiving_next_message()

void TelemetrySystem::start_receiving_next_message ( uint32_t  timeout = 0xFFFFFF)
protected

Start receiving a new message from the radio.

Parameters
timeoutThe timeout for the radio to wait for a message before giving up

Member Data Documentation

◆ radio

SX1262 TelemetrySystem::radio
protected
Initial value:
= new Module(RADIO_CHIP_SELECT_PIN,
RADIO_DIO1_PIN,
RADIO_RESET_PIN,
RADIO_BUSY_PIN,
RADIO_SPI_BUS)

The documentation for this class was generated from the following files: