Quellcode durchsuchen

update: 调整sntp间隔,并添加选项支持禁用自动sntp

Wendal Chen vor 2 Jahren
Ursprung
Commit
1ad9d9f60b

+ 8 - 1
cloudbuild/esp32c2-idf5.meta.json

@@ -124,9 +124,16 @@
                         "fsize":438832,
                         "dft":false
                      },
+                     {
+                        "name" : "LUAT_USE_SNTP_NOT_AUTO",
+                        "content":"禁用自动网络对时, 可自行定时调用SNTP",
+                        "rsize":0,
+                        "fsize":438832,
+                        "dft":false
+                     },
                      {
                         "name":"tls",
-                        "content":"启用TLS/SSL支持, 支持 https/mqtts/websockets/ftps",
+                        "content":"启用TLS/SSL支持, 支持 https/mqtts/websockets",
                         "rsize":20456,
                         "fsize":438832,
                         "dft":false

+ 8 - 1
cloudbuild/esp32c3-idf5.meta.json

@@ -124,9 +124,16 @@
                         "fsize":438832,
                         "dft":false
                      },
+                     {
+                        "name" : "LUAT_USE_SNTP_NOT_AUTO",
+                        "content":"禁用自动网络对时, 可自行定时调用SNTP",
+                        "rsize":0,
+                        "fsize":438832,
+                        "dft":false
+                     },
                      {
                         "name":"tls",
-                        "content":"启用TLS/SSL支持, 支持 https/mqtts/websockets/ftps",
+                        "content":"启用TLS/SSL支持, 支持 https/mqtts/websockets",
                         "rsize":20456,
                         "fsize":438832,
                         "dft":false

+ 7 - 0
cloudbuild/esp32s3-idf5.meta.json

@@ -124,6 +124,13 @@
                         "fsize":438832,
                         "dft":false
                      },
+                     {
+                        "name" : "LUAT_USE_SNTP_NOT_AUTO",
+                        "content":"禁用自动网络对时, 可自行定时调用SNTP",
+                        "rsize":0,
+                        "fsize":438832,
+                        "dft":false
+                     },
                      {
                         "name":"tls",
                         "content":"启用TLS/SSL支持, 支持 https/mqtts/websockets/ftps",

+ 1 - 1
luatos/components/luat/port/luat_sntp_idf5.c

@@ -56,7 +56,7 @@ void luat_ntp_autosync(void) {
 #ifdef CONFIG_SNTP_TIME_SYNC_METHOD_SMOOTH
     sntp_set_sync_mode(SNTP_SYNC_MODE_SMOOTH);
 #endif
-    sntp_set_sync_interval(60*1000); // every 60s
+    sntp_set_sync_interval(900*1000); // every 60s
     sntp_set_time_sync_notification_cb(my_ntp_cb);
     sntp_init();
 }

+ 3 - 1
luatos/components/luat/port/luat_wlan_idf5.c

@@ -273,8 +273,10 @@ int luat_wlan_init(luat_wlan_config_t *conf) {
     
     wlan_inited = 1;
 
-    // 自动开启ntp
+    // 是否自动开启ntp
+#ifndef LUAT_USE_SNTP_NOT_AUTO
     luat_ntp_autosync();
+#endif
 
     return 0;
 }

+ 2 - 0
luatos/include/luat_conf_bsp.h

@@ -32,6 +32,8 @@
 #define LUAT_USE_DNS
 #define LUAT_USE_TLS
 #define LUAT_USE_SNTP
+// 禁用自动调用网络对时
+// #define LUAT_USE_SNTP_NOT_AUTO
 // FTP暂不可用
 // #define LUAT_XXX_USE_FTP