STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
main.cpp File Reference
#include "main.h"
#include <Arduino.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <daq-protocol.h>
#include <esp_mac.h>
#include <cstring>
#include <vector>
#include "STAR_ADS126X.h"
#include "sense_board_pins.h"
#include "connector_adc_map.h"
#include "adc_mappings.h"
#include "SensorHotfireCore.h"
#include "SensorSelfTest.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Macros

#define PINS_ACTIVE_LAYOUT   sense_board_pins::TC_Board
 TC (Thermocouple) Hotfire state machine — ESP32 PCB.
#define FILTER   ADS126X_FIR
#define DATA_RATE   ADS126X_RATE_20
#define TEST_PIN   1
#define NUM_CHANNELS   10

Functions

 ADS126X_ASSERT_FILTER_RATE (FILTER, DATA_RATE)
SPIClass ADC_SPI (HSPI)
static void flush_cycles (int cycles)
static void collect_chunk_impl ()
static void send_chunks_to_impl (IPAddress dest_ip, int dest_port, bool also_to_abort_controller, IPAddress abort_controller_ip, int abort_controller_port)
static void init_adc_cb (void *)
static void on_reference_voltage_cb (void *, uint8_t reference_voltage)
static void collect_chunk_cb (void *)
static void send_chunks_to_cb (void *, IPAddress dest_ip, int dest_port, bool also_to_abort_controller, IPAddress abort_controller_ip, int abort_controller_port)
static void run_self_test_cb (void *, const SensorHotfire::StoredSensorConfig &cfg, std::vector< daq::SelfTestResult > &results_out)
void setup ()
void loop ()

Variables

static ADS126X ads126x
std::vector< daq::SensorDataChunkCollection > dataChunks
static SensorHotfire::CoreState coreState
static SensorHotfire::Config coreConfig
static unsigned long g_last_sensor_packet_log_ms = 0
bool g_verbose = true

Macro Definition Documentation

◆ DATA_RATE

#define DATA_RATE   ADS126X_RATE_20

Definition at line 44 of file main.cpp.

◆ FILTER

#define FILTER   ADS126X_FIR

Definition at line 43 of file main.cpp.

◆ NUM_CHANNELS

#define NUM_CHANNELS   10

Definition at line 47 of file main.cpp.

◆ PINS_ACTIVE_LAYOUT

#define PINS_ACTIVE_LAYOUT   sense_board_pins::TC_Board

TC (Thermocouple) Hotfire state machine — ESP32 PCB.

Same state machine as PT Hotfire: Waiting for Server → Active → Standalone Abort (and back to Active on clear). Sends heartbeats, streams thermocouple/sensor data to server or to actuator controller in abort. Uses TC_Board pin layout and BoardType::THERMOCOUPLE. Uses shared SensorHotfireCore; board-specific: ADC init, collect_chunk, send_chunks_to.

Definition at line 27 of file main.cpp.

◆ TEST_PIN

#define TEST_PIN   1

Definition at line 46 of file main.cpp.

Function Documentation

◆ ADC_SPI()

SPIClass ADC_SPI ( HSPI )

References HSPI.

◆ ADS126X_ASSERT_FILTER_RATE()

ADS126X_ASSERT_FILTER_RATE ( FILTER ,
DATA_RATE  )

References DATA_RATE, and FILTER.

◆ collect_chunk_cb()

void collect_chunk_cb ( void * )
static

Definition at line 175 of file main.cpp.

References collect_chunk_impl().

◆ collect_chunk_impl()

◆ flush_cycles()

void flush_cycles ( int cycles)
static

Definition at line 61 of file main.cpp.

References ads126x, delayMicroseconds(), digitalRead(), LOW, and sense_board_pins::Pins.

◆ init_adc_cb()

◆ loop()

void loop ( )

Definition at line 231 of file main.cpp.

References coreConfig, coreState, and SensorHotfire::loop().

◆ on_reference_voltage_cb()

void on_reference_voltage_cb ( void * ,
uint8_t reference_voltage )
static

Definition at line 169 of file main.cpp.

References ads126x, ADS126X_REF_NEG_VSS, ADS126X_REF_POS_INT, and ADS126X_REF_POS_VDD.

◆ run_self_test_cb()

◆ send_chunks_to_cb()

void send_chunks_to_cb ( void * ,
IPAddress dest_ip,
int dest_port,
bool also_to_abort_controller,
IPAddress abort_controller_ip,
int abort_controller_port )
static

Definition at line 179 of file main.cpp.

References dataChunks, and send_chunks_to_impl().

◆ send_chunks_to_impl()

void send_chunks_to_impl ( IPAddress dest_ip,
int dest_port,
bool also_to_abort_controller,
IPAddress abort_controller_ip,
int abort_controller_port )
static

◆ setup()

Variable Documentation

◆ ads126x

ADS126X ads126x
static

Definition at line 49 of file main.cpp.

◆ coreConfig

SensorHotfire::Config coreConfig
static

Definition at line 54 of file main.cpp.

◆ coreState

SensorHotfire::CoreState coreState
static

Definition at line 53 of file main.cpp.

◆ dataChunks

std::vector<daq::SensorDataChunkCollection> dataChunks

Definition at line 51 of file main.cpp.

◆ g_last_sensor_packet_log_ms

unsigned long g_last_sensor_packet_log_ms = 0
static

Definition at line 56 of file main.cpp.

◆ g_verbose

bool g_verbose = true

Definition at line 59 of file main.cpp.