#include "esp32_ethernet.hpp" #include "mpod.hpp" #include "pins.hpp" #include "rest.hpp" unsigned long start; extern bool eth_connected; extern SNMP::Manager snmp; void setup() { Serial.begin(115200); initializeMCP(); initializeNetwork(); initializeRoutes(); initializeSNMP(); // Poll port expander to initialize the PINS struct. poll_port_expander(); PINS.last_triggered = millis(); PINS.stage = ""; PINS.ramping = false; start = millis(); } enum { NONE, ON, OFF, }; void serialLoop() { if (millis() - start >= 1000) { start = millis(); Serial.print(eth_connected ? "." : "-"); } } void loop() { isr_check_loop(); snmp.loop(); restServer.handleClient(); toggle_status_led(); serialLoop(); if (eth_connected) { // We may be triggered, but disconnected from the network. powerOffCheckLoop(); } }