forked from j3d1/fiatlux
Compare commits
1 commit
jedi/dev/n
...
stable
Author | SHA1 | Date | |
---|---|---|---|
5fa1ec14e2 |
2 changed files with 8 additions and 33 deletions
|
@ -57,6 +57,7 @@ steps:
|
|||
base_url: https://git.neulandlabor.de/
|
||||
files:
|
||||
- firmware/firmware/fiatlux.bin
|
||||
- firmware/otaflash.py
|
||||
- pcb/pcb.zip
|
||||
checksum:
|
||||
- sha512
|
||||
|
|
|
@ -1,43 +1,18 @@
|
|||
#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"
|
||||
|
||||
#define SNTP_SERVERS "0.pool.ntp.org", "1.pool.ntp.org", \
|
||||
"2.pool.ntp.org", "3.pool.ntp.org"
|
||||
#include <stdio.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
|
||||
#define vTaskDelayMs(ms) vTaskDelay((ms)/portTICK_PERIOD_MS)
|
||||
#include <espressif/esp_common.h>
|
||||
#include <esp/uart.h>
|
||||
|
||||
_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) {
|
||||
void user_init(void)
|
||||
{
|
||||
uart_set_baud(0, 115200);
|
||||
printf("SDK version: %s\n", sdk_system_get_sdk_version());
|
||||
|
||||
|
@ -52,5 +27,4 @@ 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…
Reference in a new issue