diff --git a/platformio.ini b/platformio.ini index 96c6eca..f3349d4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,7 @@ platform = espressif32 board = wt32-eth01 framework = arduino -lib_deps = siwats/ESPMegaPROR3@^1.2.1 +lib_deps = siwats/ESPMegaPROR3@^1.2.2 knolleary/PubSubClient@^2.8 ivanseidel/ArduinoThread@^2.1.1 arduino-libraries/Arduino_BuiltIn@^1.0.0 diff --git a/src/main.cpp b/src/main.cpp index 4ad0d14..7e9b33a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,8 @@ #include #include #include -#include "EasyNextionLibrary.h" +#include +#include #include // Network Connectivity @@ -29,6 +30,7 @@ char STATE_REQUEST_TOPIC[40]; const char MQTT_USERNAME[] = "username"; const char MQTT_PASSWORD[] = "password"; #endif +uint8_t utc_offset = 7; // Inputs #define VINT_COUNT 16 @@ -206,7 +208,6 @@ void setup() IrSender.begin(IR_SEND_PIN); lcd_send_command("boot_state.txt=\"Network Initializing . . .\""); network_begin(); - Serial.println("Initializing MQTT . . ."); lcd_send_command("boot_state.txt=\"IoT Core Initializing . . .\""); mqtt_connect(); lcd_send_command("boot_state.txt=\"Threads Initializing . . .\""); @@ -323,14 +324,20 @@ void network_begin() ETH.setHostname(HOSTNAME); ETH.config(IP, GATEWAY, SUBNET, DNS, DNS); delay(1000); + lcd_send_command("boot_state.txt=\"Ethernet Core Initializing \""); + delay(500); + lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . \""); + delay(500); + lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . . \""); + delay(500); lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . . .\""); delay(500); - lcd_send_command("boot_state.txt=\"MQTT Core Initializing . . .\""); - delay(1250); - lcd_send_command("boot_state.txt=\"FRAM Initializing . . .\""); - delay(325); - lcd_send_command("boot_state.txt=\"Software Initializing . . .\""); + lcd_send_command("boot_state.txt=\"NTP Core Initializing . . .\""); delay(500); + char ntp[19]; + MQTT_SERVER.toString().toCharArray(ntp,19); + ESPMega_configNTP(utc_offset*3600,0,ntp); + ESPMega_updateTimeFromNTP(); Serial.println(); } diff --git a/src/user_code.cpp b/src/user_code.hpp similarity index 54% rename from src/user_code.cpp rename to src/user_code.hpp index 0865274..a7056a7 100644 --- a/src/user_code.cpp +++ b/src/user_code.hpp @@ -1,13 +1,23 @@ +#ifndef USER_CODE +#define USER_CODE +#include +void user_pre_init() { + +} + void user_init() { } + void user_loop() { } void virtual_interrupt_user_callback(int pin, int state) { - //Automation: Light Switch + } void timer_tick_callback() { - //Automation: Night Light -} \ No newline at end of file + +} + +#endif \ No newline at end of file