From: Advaith Menon Date: Tue, 25 Nov 2025 15:23:13 +0000 (-0500) Subject: Merge branch 'app_settings' X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=6b1d09c3aba25d1eb04fddc646c646d86c0e6b59;p=smartwatch.git Merge branch 'app_settings' --- 6b1d09c3aba25d1eb04fddc646c646d86c0e6b59 diff --cc main/CMakeLists.txt index 0dbaf7c,f2faec2..ef3317f --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@@ -5,7 -5,7 +5,8 @@@ idf_component_register(SRCS "app_health "task_imu.c" "sdcardspi.c" "bmp_reader.c" + "task_wifi.c" + "app_health.c" INCLUDE_DIRS "." PRIV_REQUIRES esp_driver_gpio esp_driver_uart diff --cc main/hello_world_main.c index 31720e8,d1f93f0..c45ce5f --- a/main/hello_world_main.c +++ b/main/hello_world_main.c @@@ -10,16 -17,16 +10,20 @@@ #include "pins.h" #include "task_lcd.h" #include "task_button.h" +#include "task_wifi.h" #include "sdcardspi.h" + static const char *TAG = "hello_world_main"; + int gt_global_sdsupport; +static const char *TAG = "hello_world_main"; + void app_main(void) { + TaskHandle_t wifi_taskh; + TaskHandle_t imu_taskh; + printf("Hello world!\n"); ESP_ERROR_CHECK(gpio_reset_pin(PIN_BUTTON_WHITE)); @@@ -51,21 -58,13 +55,27 @@@ gt_btn_setup(); gt_global_sdsupport = task_sdcard(); + + /* register the wifi task */ + if (xTaskCreate( + task_wifi_time, + "wifi.ntime", + 4096, + NULL, + tskIDLE_PRIORITY, + &wifi_taskh) != pdPASS) { + ESP_LOGW(TAG, "failed to initialize wifi time update!"); + } + + + /* start the main gui thread which starts all else */ + + if (xTaskCreate(task_imu_all, + "task.imu", 4096, NULL, tskIDLE_PRIORITY, &imu_taskh) != pdPASS) { + ESP_LOGW(TAG, "failed to initialize imu"); + } + lcd_task(); //task_imu_all(NULL); /* diff --cc main/task_lcd.c index 9ac5b64,ce0e7c8..2ab3138 --- a/main/task_lcd.c +++ b/main/task_lcd.c @@@ -259,15 -274,14 +274,15 @@@ void lcd_clock_loop(gl_display_t *disp while (1) { struct gt_btn_msg_t *btnmsg; time_t tm = time(NULL); + struct tm *timest = localtime(&tm); char txt[12]; // snprintf(txt, 10, "%lld", (long long) tm); - snprintf(txt, 12, "%02lld:%02lld %s", - tm / (60 * 60) % 12, - tm / 60 % 60, - (tm / (60 * 60) % 24 > 12) ? "PM" : "AM"); + snprintf(txt, 12, "%02d:%02d %s", + timest->tm_hour % 12 == 0 ? 12 : timest->tm_hour % 12, + timest->tm_min, + (timest->tm_hour > 12) ? "PM" : "AM"); /*gl_txt_Italic(disp, 1);*/ - uint16_t chw = txt_strw(disp, txt); + uint16_t chw = gl_txt_strw(disp, txt); gl_gfx_MoveTo(disp, (LCD_WIDTH / 2) - (chw / 2), (LCD_HEIGHT / 2) + (CLOCKSCR_CIRCRAD / 2)); gl_putstr(disp, (unsigned char *) txt);