2024-10-08 08:27:01 +00:00
|
|
|
#include <main.hpp>
|
|
|
|
|
|
|
|
ESPMegaPRO espmega = ESPMegaPRO();
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
// Initialize the ESPMegaPRO
|
|
|
|
ESP_LOGV("OS", "Initializing ESPMegaPRO");
|
|
|
|
espmega.begin();
|
|
|
|
espmega.inputs.preloadInputBuffer();
|
|
|
|
// Initialize IoT Modules
|
|
|
|
ESP_LOGV("OS", "Initializing IoT Modules");
|
|
|
|
espmega.setTimezone("ICT-7");
|
|
|
|
espmega.enableIotModule();
|
|
|
|
// Setup Ethernet
|
|
|
|
ESP_LOGV("OS", "Initializing Ethernet");
|
|
|
|
ETH.begin();
|
|
|
|
ESP_LOGD("OS", "Binding Ethernet Interface");
|
|
|
|
espmega.iot->bindEthernetInterface(Ð);
|
|
|
|
// Connect to Network
|
|
|
|
ESP_LOGV("OS", "Connecting to Network");
|
|
|
|
espmega.iot->loadNetworkConfig();
|
|
|
|
espmega.iot->connectNetwork();
|
|
|
|
// Connect to the MQTT Broker
|
|
|
|
ESP_LOGV("OS", "Connecting to MQTT Broker");
|
|
|
|
espmega.iot->loadMqttConfig();
|
|
|
|
vTaskDelay(3000 / portTICK_PERIOD_MS); // Wait for the network to stabilize
|
|
|
|
espmega.iot->connectToMqtt();
|
|
|
|
// Enable Web Server
|
|
|
|
ESP_LOGV("OS", "Enabling Web Server");
|
|
|
|
espmega.enableWebServer(80);
|
|
|
|
|
|
|
|
ESP_LOGV("OS", "Initializing Internal Display");
|
|
|
|
espmega.enableInternalDisplay(&INTERNAL_DISPLAY_UART);
|
|
|
|
// Register all cards with iot
|
|
|
|
ESP_LOGV("OS", "Registering Cards with IoT");
|
|
|
|
espmega.iot->registerCard(0);
|
|
|
|
espmega.iot->registerCard(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
espmega.loop();
|
|
|
|
}
|
2024-10-08 16:24:02 +00:00
|
|
|
|
|
|
|
void input_callback(uint8_t pin, uint8_t state)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|