|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
#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 "actuator_board_pins.h"Go to the source code of this file.
Functions | |
| static const char * | packetTypeName (uint8_t t) |
| void | printReceivedPacket (const uint8_t *buf, size_t len, IPAddress fromIP, uint16_t fromPort) |
| void | sendSensorPacket () |
| void | setup () |
| void | loop () |
Variables | |
| byte | mac [6] |
| Multi-Board Comms Testing - PRIMARY. | |
| IPAddress | staticIP (192, 168, 2, 100) |
| IPAddress | gateway (192, 168, 2, 1) |
| IPAddress | subnet (255, 255, 255, 0) |
| IPAddress | dns (192, 168, 2, 1) |
| IPAddress | secondaryIP (192, 168, 2, 101) |
| const int | secondaryPort = 5006 |
| const int | localPort = 5005 |
| EthernetUDP | udp |
| uint8_t | packetBuffer [MAX_PACKET_SIZE] |
| const uint8_t | NUM_SENSORS = 2 |
| const unsigned long | SEND_INTERVAL_MS = 1000 |
| unsigned long | lastSendMs = 0 |
| void loop | ( | ) |
Definition at line 183 of file main.cpp.
References delay(), lastSendMs, millis(), packetBuffer, printReceivedPacket(), SEND_INTERVAL_MS, sendSensorPacket(), and udp.
|
static |
Definition at line 52 of file main.cpp.
References daq::ABORT, daq::ABORT_DONE, daq::ACTUATOR_COMMAND, daq::ACTUATOR_CONFIG, daq::BOARD_HEARTBEAT, daq::CLEAR_ABORT, daq::SENSOR_CONFIG, daq::SENSOR_DATA, and daq::SERVER_HEARTBEAT.
Referenced by printReceivedPacket().
| void printReceivedPacket | ( | const uint8_t * | buf, |
| size_t | len, | ||
| IPAddress | fromIP, | ||
| uint16_t | fromPort ) |
Definition at line 77 of file main.cpp.
References packetTypeName(), and Serial.
Referenced by loop().
| void sendSensorPacket | ( | ) |
Definition at line 109 of file main.cpp.
References chunk, chunks, daq::create_sensor_data_packet(), millis(), NUM_SENSORS, packetBuffer, secondaryIP, secondaryPort, Serial, and udp.
Referenced by loop().
| void setup | ( | void | ) |
| IPAddress dns(192, 168, 2, 1) | ( | 192 | , |
| 168 | , | ||
| 2 | , | ||
| 1 | ) |
| IPAddress gateway(192, 168, 2, 1) | ( | 192 | , |
| 168 | , | ||
| 2 | , | ||
| 1 | ) |
| byte mac[6] |
Multi-Board Comms Testing - PRIMARY.
Sends SENSOR_DATA packets to the secondary board (192.168.2.101:5006), receives reply SENSOR_DATA packets on port 5005, and prints both sent and received packets to Serial.
Uses: Arduino Ethernet, EthernetUDP, DAQv2-Comms (sensor packet format).
| uint8_t packetBuffer[MAX_PACKET_SIZE] |
| IPAddress secondaryIP(192, 168, 2, 101) | ( | 192 | , |
| 168 | , | ||
| 2 | , | ||
| 101 | ) |
Referenced by sendSensorPacket().
| const int secondaryPort = 5006 |
Definition at line 36 of file main.cpp.
Referenced by sendSensorPacket().
| const unsigned long SEND_INTERVAL_MS = 1000 |
| IPAddress staticIP(192, 168, 2, 100) | ( | 192 | , |
| 168 | , | ||
| 2 | , | ||
| 100 | ) |
| IPAddress subnet(255, 255, 255, 0) | ( | 255 | , |
| 255 | , | ||
| 255 | , | ||
| 0 | ) |