#include "esp32_ethernet.hpp"
#include "rest.hpp"
#include "mpod.hpp"
#include "pins.hpp"


unsigned long start;
extern bool eth_connected;
extern SNMP::Manager snmp;

void setup() {
    Serial.begin(115200);

    initializeMCP();
    initializeNetwork();
    initializeRoutes();
    initializeSNMP();

    start = millis();

    poll_port_expander();
}


enum {
    NONE,
    ON,
    OFF,
};

void serial_loop() {
    if (millis() - start  >= 1000) {
        start = millis();
        Serial.print(eth_connected ? "." : "-");
    }

}

void loop() {
    isr_check_loop();
    snmp.loop();
    restServer.handleClient();
    toggle_status_led();
    serial_loop();
}