|
@@ -12,7 +12,7 @@
|
|
|
|
|
|
#include "tm1637.h"
|
|
#include "tm1637.h"
|
|
#include "ds3231.h"
|
|
#include "ds3231.h"
|
|
-#include "configuration.h"
|
|
|
|
|
|
+#include "time_conversion.h"
|
|
|
|
|
|
static void update_display(uint8_t hour, uint8_t minute) {
|
|
static void update_display(uint8_t hour, uint8_t minute) {
|
|
if (hour < 10) {
|
|
if (hour < 10) {
|
|
@@ -32,15 +32,6 @@ static void update_display(uint8_t hour, uint8_t minute) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static struct tm *convert_to_local(struct tm *timeinfo) {
|
|
|
|
- setenv("TZ", "GMT+0GMT+0", 1);
|
|
|
|
- tzset();
|
|
|
|
- time_t epoch_time = mktime(timeinfo);
|
|
|
|
- setenv("TZ", LOCAL_TIMEZONE, 1);
|
|
|
|
- tzset();
|
|
|
|
- return localtime(&epoch_time);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static uint8_t max(uint8_t a, uint8_t b) {
|
|
static uint8_t max(uint8_t a, uint8_t b) {
|
|
return (a > b) ? a : b;
|
|
return (a > b) ? a : b;
|
|
}
|
|
}
|
|
@@ -57,8 +48,6 @@ void display_update_task(void *pvParameters) {
|
|
while(1) {
|
|
while(1) {
|
|
ds3231_read_date_time(¤t_time);
|
|
ds3231_read_date_time(¤t_time);
|
|
struct tm *local_time = convert_to_local(¤t_time);
|
|
struct tm *local_time = convert_to_local(¤t_time);
|
|
- setenv("TZ", "GMT+0GMT+0", 1);
|
|
|
|
- tzset();
|
|
|
|
update_display(local_time->tm_hour, local_time->tm_min);
|
|
update_display(local_time->tm_hour, local_time->tm_min);
|
|
vTaskDelay(determine_sleep_time(local_time) / portTICK_PERIOD_MS);
|
|
vTaskDelay(determine_sleep_time(local_time) / portTICK_PERIOD_MS);
|
|
}
|
|
}
|