508 _NewMinute = false; |
508 _NewMinute = false; |
509 NewMinute = true; |
509 NewMinute = true; |
510 } |
510 } |
511 |
511 |
512 /* |
512 /* |
513 * Timekeeping. In the WiFi task sntp is started if there |
513 * Timekeeping. |
514 * is a valid internet connection. |
514 * In the WiFi task sntp is started and sets System_TimeOk if the |
|
515 * clock is synced once. |
515 */ |
516 */ |
516 time(&now); |
517 time(&now); |
517 localtime_r(&now, &timeinfo); |
518 localtime_r(&now, &timeinfo); |
518 // Is time set? If not, tm_year will be (1970 - 1900). |
|
519 if ((timeinfo.tm_year > (2016 - 1900)) && (! System_TimeOk)) { |
|
520 System_TimeOk = true; |
|
521 strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo); |
|
522 ESP_LOGI(TAG, "System time is set: %s", strftime_buf); |
|
523 } |
|
524 |
519 |
525 if (Old_Screen != Main_Screen) { |
520 if (Old_Screen != Main_Screen) { |
526 |
521 |
527 if ((Main_Screen == MAIN_MODE_FREE) && ((config.ts_xleft == 0) || (config.ts_ybottom == 0))) { |
522 if ((Main_Screen == MAIN_MODE_FREE) && ((config.ts_xleft == 0) || (config.ts_ybottom == 0))) { |
528 Main_Screen = MAIN_MODE_CALIBRATION; |
523 Main_Screen = MAIN_MODE_CALIBRATION; |