ASCEND Flight Software
Loading...
Searching...
No Matches
Functions | Variables
main.cpp File Reference

Main functions for Core 0, responsible for reading data from sensor peripherals. More...

#include <Arduino.h>
#include "ErrorDisplay.h"
#include "Logger.h"
#include "PayloadConfig.h"
#include "CommandMessage.h"
#include "Sensor.h"
#include "AS7331Sensor.h"
#include "BMP390Sensor.h"
#include "ENS160Sensor.h"
#include "ICM20948Sensor.h"
#include "INA260Sensor.h"
#include "MTK3339Sensor.h"
#include "OzoneSensor.h"
#include "PCF8523Sensor.h"
#include "SHTC3Sensor.h"
#include "TMP11xSensor.h"
#include "TempSensor.h"
Include dependency graph for main.cpp:

Functions

int verifySensors ()
 
void handleCommand ()
 Handle commands read from serial input.
 
int verifySensorRecovery ()
 Uses Device abstraction to verify sensors Incompatible with initial header generation.
 
String readSensorData ()
 Read data from each verified Sensor.
 
uint16_t readSensorDataPacket (uint8_t *packet)
 Reads sensor data into a packet byte array.
 
String decodePacket (uint8_t *packet)
 Decodes the packet to a CSV row.
 
void handleDataInterface ()
 
void setup ()
 Setup for core 0.
 
void loop ()
 Loop for core 0, handling sensor reads.
 
void real_setup1 ()
 Setup for core 1.
 
void real_loop1 ()
 Loop for core 1.
 
void setup1 ()
 
void loop1 ()
 

Variables

INA260Sensor ina260_sensor (1000)
 
TempSensor temp_sensor (1000)
 
MTK3339Sensor gps_sensor (2000)
 
ICM20948Sensor icm_sensor (0)
 
PCF8523Sensor rtc_sensor (1000)
 
TMP11xSensor tmp_sensor (500, &STRATOCORE_I2c)
 
AS7331Sensor uv_sensor_out (500, UV_I2C_ADDR)
 
ENS160Sensor ens160_sensor_out (500, &STRATOSENSE_I2C)
 
BMP390Sensor bmp_sensor_out (500, &STRATOSENSE_I2C)
 
TMP11xSensor tmp_sensor_out (500, &STRATOSENSE_I2C)
 
SHTC3Sensor shtc3_sensor_out (500, &STRATOSENSE_I2C)
 
OzoneSensor ozone_sensor_out (500)
 
Sensorsensors []
 
const int sensors_len = sizeof(sensors) / sizeof(sensors[0])
 
String header_condensed = ""
 
queue_t qt
 
uint32_t time_paused
 
uint32_t max_pause_duration = 60'000 * 2
 
bool was_dumping = false
 
unsigned int it = 0
 

Detailed Description

Main functions for Core 0, responsible for reading data from sensor peripherals.

Function Documentation

◆ decodePacket()

String decodePacket ( uint8_t *  packet)

Decodes the packet to a CSV row.

Parameters
packetPointer to the packet array
Returns
String The resulting CSV row
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCommand()

void handleCommand ( )

Handle commands read from serial input.

Pause data collection and storage for a specified duration to execute a command, including STATUS, DOWNLOAD, DELETE, etc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDataInterface()

void handleDataInterface ( )

◆ loop()

void loop ( )

Loop for core 0, handling sensor reads.

Here is the call graph for this function:

◆ loop1()

void loop1 ( )
Here is the call graph for this function:

◆ readSensorData()

String readSensorData ( )

Read data from each verified Sensor.

Returns
String Complete CSV row for iteration
Here is the call graph for this function:

◆ readSensorDataPacket()

uint16_t readSensorDataPacket ( uint8_t *  packet)

Reads sensor data into a packet byte array.

Parameters
packetPointer to the packet array
Here is the call graph for this function:
Here is the caller graph for this function:

◆ real_loop1()

void real_loop1 ( )

Loop for core 1.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ real_setup1()

void real_setup1 ( )

Setup for core 1.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup()

void setup ( )

Setup for core 0.

Here is the call graph for this function:

◆ setup1()

void setup1 ( )
Here is the call graph for this function:

◆ verifySensorRecovery()

int verifySensorRecovery ( )

Uses Device abstraction to verify sensors Incompatible with initial header generation.

Returns
int Number of sensors verified
Here is the caller graph for this function:

◆ verifySensors()

int verifySensors ( )

Variable Documentation

◆ bmp_sensor_out

BMP390Sensor bmp_sensor_out(500, &STRATOSENSE_I2C) ( 500  ,
STRATOSENSE_I2C 
)

◆ ens160_sensor_out

ENS160Sensor ens160_sensor_out(500, &STRATOSENSE_I2C) ( 500  ,
STRATOSENSE_I2C 
)

◆ gps_sensor

MTK3339Sensor gps_sensor(2000) ( 2000  )

◆ header_condensed

String header_condensed = ""

◆ icm_sensor

ICM20948Sensor icm_sensor(0) ( )

◆ ina260_sensor

INA260Sensor ina260_sensor(1000) ( 1000  )

◆ it

unsigned int it = 0

◆ max_pause_duration

uint32_t max_pause_duration = 60'000 * 2

◆ ozone_sensor_out

OzoneSensor ozone_sensor_out(500) ( 500  )

◆ qt

queue_t qt

◆ rtc_sensor

PCF8523Sensor rtc_sensor(1000) ( 1000  )

◆ sensors

Sensor* sensors[]
Initial value:
TMP11xSensor tmp_sensor_out(500, &STRATOSENSE_I2C)
TempSensor temp_sensor(1000)
ENS160Sensor ens160_sensor_out(500, &STRATOSENSE_I2C)
AS7331Sensor uv_sensor_out(500, UV_I2C_ADDR)
INA260Sensor ina260_sensor(1000)
BMP390Sensor bmp_sensor_out(500, &STRATOSENSE_I2C)
MTK3339Sensor gps_sensor(2000)
SHTC3Sensor shtc3_sensor_out(500, &STRATOSENSE_I2C)
TMP11xSensor tmp_sensor(500, &STRATOCORE_I2c)
PCF8523Sensor rtc_sensor(1000)
OzoneSensor ozone_sensor_out(500)
ICM20948Sensor icm_sensor(0)

◆ sensors_len

const int sensors_len = sizeof(sensors) / sizeof(sensors[0])

◆ shtc3_sensor_out

SHTC3Sensor shtc3_sensor_out(500, &STRATOSENSE_I2C) ( 500  ,
STRATOSENSE_I2C 
)

◆ temp_sensor

TempSensor temp_sensor(1000) ( 1000  )

◆ time_paused

uint32_t time_paused

◆ tmp_sensor

TMP11xSensor tmp_sensor(500, &STRATOCORE_I2c) ( 500  ,
STRATOCORE_I2c 
)

◆ tmp_sensor_out

TMP11xSensor tmp_sensor_out(500, &STRATOSENSE_I2C) ( 500  ,
STRATOSENSE_I2C 
)

◆ uv_sensor_out

AS7331Sensor uv_sensor_out(500, UV_I2C_ADDR) ( 500  ,
UV_I2C_ADDR   
)

◆ was_dumping

bool was_dumping = false