working ntp without offset

This commit is contained in:
Siwat Sirichai 2024-05-21 23:50:21 +07:00
parent 64d6c4fab3
commit b30cfde0b0
4 changed files with 60 additions and 14 deletions

View file

@ -14,15 +14,16 @@
// #define FRAM_DEBUG
// #define MQTT_DEBUG
// #define RTC_DEBUG
#define WRITE_DEFAULT_NETCONF
#define CLIMATE_CARD_ENABLE
#define MQTT_CARD_REGISTER
#define DISPLAY_ENABLE
// #define DISPLAY_ENABLE
#define WEB_SERVER_ENABLE
#define LCD_OTA_ENABLE
// #define REMOTE_VARIABLE_ENABLE
// #define CT_ENABLE
#define SMART_VARIABLE_ENABLE
// #define SMART_VARIABLE_ENABLE
// Demo PLC firmware using the ESPMegaPRO OOP library
@ -162,6 +163,7 @@ void setup()
{
ESP_LOGI("Initializer", "Starting ESPMegaPRO OOP demo");
espmega.begin();
espmega.setUTCOffset(7);
ESP_LOGI("Initializer", "Enabling IOT module");
espmega.enableIotModule();
ESP_LOGI("Initializer", "Enabling Ethernet");
@ -326,4 +328,13 @@ void loop()
smartVar.setValue(last_smartvar_state ? "true" : "false");
}
#endif
#ifdef RTC_DEBUG
static uint32_t last_time_print = 0;
if (millis() - last_time_print >= 1000)
{
last_time_print = millis();
rtctime_t time = espmega.getTime();
Serial.printf("Time: %02d:%02d:%02d %02d/%02d/%04d\n", time.hours, time.minutes, time.seconds, time.day, time.month, time.year);
}
#endif
}