diff --git a/src/main.cpp b/src/main.cpp index 950dbd3..a6e3777 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,7 +52,9 @@ void setup() // Initialize both displayports INTERNAL_DISPLAY_UART.begin(INTERNAL_DISPLAY_BAUDRATE); DISPLAY_UART.begin(DISPLAY_COMMUNICATION_BAUDRATE, SERIAL_8N1, DISPLAY_RX, DISPLAY_TX); + ESP_LOGI("CUD IoT OS", "Starting Initialization"); // Reset both display + ESP_LOGV("CUD IoT OS", "Resetting both displays"); send_stop_bytes(INTERNAL_DISPLAY_UART); INTERNAL_DISPLAY_UART.print("rest"); send_stop_bytes(INTERNAL_DISPLAY_UART); @@ -62,39 +64,53 @@ void setup() // Wait for the display to reset vTaskDelay(1000 / portTICK_PERIOD_MS); // Initialize the ESPMegaPRO + ESP_LOGV("CUD IoT OS", "Initializing ESPMegaPRO"); espmega.begin(); // Initialize IoT Modules + ESP_LOGV("CUD IoT OS", "Initializing IoT Modules"); espmega.enableIotModule(); // Setup Ethernet + ESP_LOGV("CUD IoT OS", "Initializing Ethernet"); ETH.begin(); + ESP_LOGD("CUD IoT OS", "Binding Ethernet Interface"); espmega.iot->bindEthernetInterface(Ð); // Connect to Network + ESP_LOGV("CUD IoT OS", "Connecting to Network"); espmega.iot->loadNetworkConfig(); espmega.iot->connectNetwork(); // Connect to the MQTT Broker + ESP_LOGV("CUD IoT OS", "Connecting to MQTT Broker"); espmega.iot->loadMqttConfig(); espmega.iot->connectToMqtt(); // Enable Web Server + ESP_LOGV("CUD IoT OS", "Enabling Web Server"); espmega.enableWebServer(80); // Initialize Internal Display + ESP_LOGV("CUD IoT OS", "Initializing Internal Display"); espmega.enableInternalDisplay(&INTERNAL_DISPLAY_UART); // Initialize Air Conditioner + ESP_LOGV("CUD IoT OS", "Initializing Air Conditioner"); espmega.installCard(2, &ac); ac.bindFRAM(&espmega.fram, AC_FRAM_ADDR); espmega.display->bindClimateCard(&ac); // Show our climate card on the display // Register all cards with iot + ESP_LOGV("CUD IoT OS", "Registering Cards with IoT"); espmega.iot->registerCard(0); espmega.iot->registerCard(1); espmega.iot->registerCard(2); // Initialize Remote Variables + ESP_LOGV("CUD IoT OS", "Initializing Remote Variables"); aqi.begin(10, AQI_STATE_TOPIC, espmega.iot, true, AQI_REQUEST_TOPIC); // Input callbacks // This pre-load the input buffers // We need to do this to prevent switches that are left on the "on" position from triggering the callback + ESP_LOGV("CUD IoT OS", "Pre-loading input buffers"); espmega.inputs.loop(); espmega.inputs.registerCallback(handle_input_change); // Start the display routine + ESP_LOGV("CUD IoT OS", "Starting CUDDisplay"); cudDisplay.begin(); + ESP_LOGI("CUD IoT OS", "Initialization Complete"); } void loop()