#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);
/*
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);