]> Devi Nivas Git - smartwatch.git/commitdiff
Merge branch 'app_settings'
authorAdvaith Menon <noreply-git@bp4k.net>
Tue, 25 Nov 2025 15:23:13 +0000 (10:23 -0500)
committerAdvaith Menon <noreply-git@bp4k.net>
Tue, 25 Nov 2025 15:23:13 +0000 (10:23 -0500)
1  2 
main/CMakeLists.txt
main/hello_world_main.c
main/task_lcd.c

index 0dbaf7c8e84f1c53becd436375a63ef3b476923b,f2faec2fe436365774e75e4630ad1f576a60540f..ef3317f7726ca16cc82c7c6f009b62782e817479
@@@ -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
index 31720e87fad6f88cbcff3a20e0aa605e5dc1c317,d1f93f01e5e22c638298588f47b331c14d91016f..c45ce5f7657815a63727250fa2d4bb5e0c5ad45f
  #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));
      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 9ac5b643db986332bea17b870c7545ff08298de7,ce0e7c87046907fe886217b11b3f8e1de9321eae..2ab3138da8ee16dcefd1442091e64b6f16d4193c
@@@ -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);