loading date/time via SNTP
Signed-off-by: Peter Siegmund <peter@rdkr.com>
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#include "splash_screen.h"
|
||||
#include <esp_task_wdt.h>
|
||||
#include <stdio.h>
|
||||
#include "connectivity.h"
|
||||
#include "epd_driver.h"
|
||||
#include "fonts/opensans16.h"
|
||||
#include "ntp.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
@@ -17,14 +19,15 @@ void nvs_init(void) {
|
||||
}
|
||||
|
||||
void wifi_init(void) {
|
||||
epd_poweron();
|
||||
epd_clear();
|
||||
|
||||
int32_t x = 100;
|
||||
int32_t y = 100;
|
||||
const int16_t bufferSize = 200;
|
||||
char buffer[bufferSize];
|
||||
snprintf(buffer, bufferSize, "Connecting to SSDI: %s", CONFIG_WIFI_SSID);
|
||||
writeln(&OpenSans16, buffer, &x, &y, NULL);
|
||||
|
||||
esp_err_t ret = init_wifi();
|
||||
if (ret != ESP_OK) {
|
||||
epd_clear();
|
||||
@@ -35,14 +38,44 @@ void wifi_init(void) {
|
||||
writeln(&OpenSans16, buffer, &x, &y, NULL);
|
||||
epd_poweroff();
|
||||
while (1) {
|
||||
///
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void time_init(void) {
|
||||
epd_clear();
|
||||
|
||||
int32_t x = 100;
|
||||
int32_t y = 100;
|
||||
const int16_t bufferSize = 200;
|
||||
char buffer[bufferSize];
|
||||
snprintf(buffer, bufferSize, "Loading NTP Data...");
|
||||
writeln(&OpenSans16, buffer, &x, &y, NULL);
|
||||
|
||||
esp_err_t ret = init_ntp();
|
||||
if (ret != ESP_OK) {
|
||||
epd_clear();
|
||||
x = 100;
|
||||
y = 100;
|
||||
snprintf(buffer, bufferSize, "Failed to get NTP data and timezone: %s",
|
||||
esp_err_to_name(ret));
|
||||
writeln(&OpenSans16, buffer, &x, &y, NULL);
|
||||
epd_poweroff();
|
||||
while (1) {
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
};
|
||||
}
|
||||
epd_poweroff();
|
||||
}
|
||||
|
||||
void splash_screen(void) {
|
||||
epd_init();
|
||||
nvs_init();
|
||||
|
||||
epd_poweron();
|
||||
|
||||
wifi_init();
|
||||
time_init();
|
||||
|
||||
epd_poweroff();
|
||||
}
|
||||
|
Reference in New Issue
Block a user