forked from j3d1/fiatlux
		
	Compare commits
	
		
			1 commit
		
	
	
		
			stable
			...
			jedi/dev/n
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e7e7163b81 | 
					 2 changed files with 33 additions and 8 deletions
				
			
		|  | @ -57,7 +57,6 @@ steps: | |||
|     base_url: https://git.neulandlabor.de/ | ||||
|     files:  | ||||
|       - firmware/firmware/fiatlux.bin | ||||
|       - firmware/otaflash.py | ||||
|       - pcb/pcb.zip | ||||
|     checksum: | ||||
|       - sha512 | ||||
|  |  | |||
|  | @ -1,18 +1,43 @@ | |||
| #include <FreeRTOS.h> | ||||
| #include <task.h> | ||||
| #include <sntp.h> | ||||
| #include <time.h> | ||||
| #include <esp/uart.h> | ||||
| #include <espressif/esp_common.h> | ||||
| 
 | ||||
| #include "system.h" | ||||
| #include "wifi.h" | ||||
| #include "web.h" | ||||
| #include "mqtt.h" | ||||
| #include "lux.h" | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <FreeRTOS.h> | ||||
| #include <task.h> | ||||
| #define SNTP_SERVERS     "0.pool.ntp.org", "1.pool.ntp.org", \ | ||||
|                         "2.pool.ntp.org", "3.pool.ntp.org" | ||||
| 
 | ||||
| #include <espressif/esp_common.h> | ||||
| #include <esp/uart.h> | ||||
| #define vTaskDelayMs(ms)    vTaskDelay((ms)/portTICK_PERIOD_MS) | ||||
| 
 | ||||
| void user_init(void) | ||||
| { | ||||
| _Noreturn void sntp_task(void *pvParameters) { | ||||
|     (void) pvParameters; | ||||
|     const char *servers[] = {SNTP_SERVERS}; | ||||
| 
 | ||||
|     while (sdk_wifi_station_get_connect_status() != STATION_GOT_IP) { | ||||
|         vTaskDelayMs(1000); | ||||
|     } | ||||
| 
 | ||||
|     sntp_set_update_delay(5 * 60000); | ||||
|     const struct timezone tz = {1 * 60, 1}; | ||||
|     sntp_initialize(&tz); | ||||
|     sntp_set_servers(servers, sizeof(servers) / sizeof(char *)); | ||||
| 
 | ||||
|     while (1) { | ||||
|         vTaskDelayMs(5000); | ||||
|         time_t ts = time(NULL); | ||||
|         long long t = ts; | ||||
|         printf("TIME: %lld %s", t, ctime(&ts)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void user_init(void) { | ||||
|     uart_set_baud(0, 115200); | ||||
|     printf("SDK version: %s\n", sdk_system_get_sdk_version()); | ||||
| 
 | ||||
|  | @ -27,4 +52,5 @@ void user_init(void) | |||
|     xTaskCreate(&httpd_task, "httpd_task", 1024, NULL, 2, NULL); | ||||
| 
 | ||||
|     xTaskCreate(&lux_task, "lux_task", 512, NULL, 1, NULL); | ||||
|     xTaskCreate(&sntp_task, "SNTP", 512, NULL, 2, NULL); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue