#include <Arduino.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <STAR_EthernetOTA.h>
#include <daq-protocol.h>
#include <esp_mac.h>
#include <cstring>
#include "firmware_hash.h"
#include "hotfire_config.h"
#include "stacklight_pins.h"
Go to the source code of this file.
|
| static uint8_t | board_id = BOARD_ID |
| static byte | mac [6] |
| static IPAddress | staticIP (192, 168, 2, BOARD_ID) |
| static IPAddress | gateway (0, 0, 0, 0) |
| static IPAddress | subnet (255, 255, 255, 0) |
| static IPAddress | dns (192, 168, 2, 1) |
| static IPAddress | serverIP (192, 168, 2, HOTFIRE_SERVER_IP_OCTET_4) |
| static EthernetUDP | udp |
| static StarOTA::Server | otaServer (HOTFIRE_OTA_PORT) |
| static unsigned long | lastHeartbeatMillis = 0 |
| static unsigned long | last_server_heartbeat_ms = 0 |
| static daq::EngineState | last_engine_state = daq::EngineState::SAFE |
◆ MAX_PACKET_SIZE
| #define MAX_PACKET_SIZE 512 |
◆ SENSOR_UDP_LISTEN_PORT
| #define SENSOR_UDP_LISTEN_PORT 5005 |
◆ applyStacklightOutputs()
| void applyStacklightOutputs |
( |
uint8_t | red, |
|
|
uint8_t | yellow, |
|
|
uint8_t | green, |
|
|
uint8_t | buzzer ) |
|
static |
◆ initOutputs()
Definition at line 52 of file main.cpp.
References digitalWrite(), HIGH, OUTPUT, stacklight_pins::PIN_BUZZ, stacklight_pins::PIN_EX1, stacklight_pins::PIN_EX2, stacklight_pins::PIN_EX3, stacklight_pins::PIN_GREEN, stacklight_pins::PIN_RED, stacklight_pins::PIN_YELLOW, and pinMode().
Referenced by setup().
◆ loop()
Definition at line 119 of file main.cpp.
References applyStacklightOutputs(), BOARD_HEARTBEAT_INTERVAL_MS, delay(), last_engine_state, last_server_heartbeat_ms, lastHeartbeatMillis, LOOP_DELAY_MS, MAX_PACKET_SIZE, millis(), otaServer, packetBuffer, daq::parse_server_heartbeat_packet(), daq::parse_stacklight_command_packet(), StarOTA::printTestMessage(), sendBoardHeartbeat(), daq::SERVER_HEARTBEAT, daq::STACKLIGHT_COMMAND, and udp.
◆ sendBoardHeartbeat()
| void sendBoardHeartbeat |
( |
| ) |
|
|
static |
Definition at line 69 of file main.cpp.
References daq::ACTIVE, board_id, daq::create_board_heartbeat_packet(), FirmwareHash::get(), HOTFIRE_SERVER_PORT, last_engine_state, MAX_PACKET_SIZE, millis(), packetBuffer, serverIP, and udp.
Referenced by loop().
◆ setup()
Definition at line 87 of file main.cpp.
References BOARD_ID, board_id, delay(), dns, ETH_CS, ETH_MISO, ETH_MOSI, ETH_SCLK, Ethernet, ETHERNET_BEGIN_DELAY_MS, ETHERNET_INIT_DELAY_MS, ETHERNET_SPI_DELAY_MS, gateway, HOTFIRE_OTA_PORT, initOutputs(), IPAddress, mac, otaServer, FirmwareHash::print(), SENSOR_UDP_LISTEN_PORT, Serial, staticIP, subnet, and udp.
◆ board_id
◆ dns
| IPAddress dns(192, 168, 2, 1) |
( |
192 | , |
|
|
168 | , |
|
|
2 | , |
|
|
1 | ) |
|
static |
◆ gateway
| IPAddress gateway(0, 0, 0, 0) |
( |
0 | , |
|
|
0 | , |
|
|
0 | , |
|
|
0 | ) |
|
static |
◆ last_engine_state
◆ last_server_heartbeat_ms
| unsigned long last_server_heartbeat_ms = 0 |
|
static |
◆ lastHeartbeatMillis
| unsigned long lastHeartbeatMillis = 0 |
|
static |
◆ mac
◆ otaServer
◆ serverIP
◆ staticIP
◆ subnet
| IPAddress subnet(255, 255, 255, 0) |
( |
255 | , |
|
|
255 | , |
|
|
255 | , |
|
|
0 | ) |
|
static |
◆ udp