main/brewboard.c

changeset 54
7b134c27fadb
parent 53
cf91a3a20d0d
child 87
47253f294a9f
equal deleted inserted replaced
53:cf91a3a20d0d 54:7b134c27fadb
41 sprintf(temp, "BrewBoard %s", app_desc->version); 41 sprintf(temp, "BrewBoard %s", app_desc->version);
42 TFT_print(temp, CENTER, 4); 42 TFT_print(temp, CENTER, 4);
43 43
44 TFT_setFont(DEJAVU18_FONT, NULL); 44 TFT_setFont(DEJAVU18_FONT, NULL);
45 _fg = TFT_CYAN; 45 _fg = TFT_CYAN;
46 TFT_print("Mount /spiffs ", 0, LASTY+tempy); 46 TFT_print((char *)"Mount /spiffs ", 0, LASTY+tempy);
47 ESP_LOGI(TAG, "Initializing SPIFFS"); 47 ESP_LOGI(TAG, "Initializing SPIFFS");
48 48
49 esp_vfs_spiffs_conf_t conf = { 49 esp_vfs_spiffs_conf_t conf = {
50 .base_path = "/spiffs", 50 .base_path = "/spiffs",
51 .partition_label = NULL, 51 .partition_label = NULL,
64 ESP_LOGE(TAG, "Failed to find SPIFFS partition"); 64 ESP_LOGE(TAG, "Failed to find SPIFFS partition");
65 } else { 65 } else {
66 ESP_LOGE(TAG, "Failed to initialize SPIFFS (%d)", ret); 66 ESP_LOGE(TAG, "Failed to initialize SPIFFS (%d)", ret);
67 } 67 }
68 _fg = TFT_RED; 68 _fg = TFT_RED;
69 TFT_print("error\r\n", LASTX, LASTY); 69 TFT_print((char *)"error\r\n", LASTX, LASTY);
70 return; // Stop application. 70 return; // Stop application.
71 } 71 }
72 72
73 size_t total = 0, used = 0; 73 size_t total = 0, used = 0;
74 ret = esp_spiffs_info(NULL, &total, &used); 74 ret = esp_spiffs_info(NULL, &total, &used);
75 if (ret != ESP_OK) { 75 if (ret != ESP_OK) {
76 ESP_LOGE(TAG, "Failed to get SPIFFS partition information"); 76 ESP_LOGE(TAG, "Failed to get SPIFFS partition information");
77 _fg = TFT_RED; 77 _fg = TFT_RED;
78 TFT_print("error\r\n", LASTX, LASTY); 78 TFT_print((char *)"error\r\n", LASTX, LASTY);
79 return; // Stop application. 79 return; // Stop application.
80 } else { 80 } else {
81 ESP_LOGI(TAG, "Partition size: %d, used: %d - %d%%", total, used, (used * 100) / total); 81 ESP_LOGI(TAG, "Partition size: %d, used: %d - %d%%", total, used, (used * 100) / total);
82 } 82 }
83 TFT_print("Ok\r\n", LASTX, LASTY); 83 TFT_print((char *)"Ok\r\n", LASTX, LASTY);
84 84
85 // Just to debug, list the /spiffs filesystem. 85 // Just to debug, list the /spiffs filesystem.
86 #if 1 86 #if 1
87 DIR *dir = opendir("/spiffs"); 87 DIR *dir = opendir("/spiffs");
88 struct dirent* de = readdir(dir); 88 struct dirent* de = readdir(dir);
100 #endif 100 #endif
101 101
102 /* 102 /*
103 * Read or create configuration 103 * Read or create configuration
104 */ 104 */
105 TFT_print("Ophalen configuratie ", LASTX, LASTY); 105 TFT_print((char *)"Ophalen configuratie ", LASTX, LASTY);
106 read_config(); 106 read_config();
107 read_equipment(config.EquipmentRec); 107 read_equipment(config.EquipmentRec);
108 read_runtime(); 108 read_runtime();
109 read_recipe(config.RecipeRec); 109 read_recipe(config.RecipeRec);
110 TFT_print("Ok\r\n", LASTX, LASTY); 110 TFT_print((char *)"Ok\r\n", LASTX, LASTY);
111 111
112 // Set the Touchscreen calibration/ 112 // Set the Touchscreen calibration/
113 TS_set_calibration(config.ts_xleft, config.ts_xright, config.ts_ytop, config.ts_ybottom); 113 TS_set_calibration(config.ts_xleft, config.ts_xright, config.ts_ytop, config.ts_ybottom);
114 114
115 /* 115 /*
120 tzset(); 120 tzset();
121 121
122 xSemaphoreDS18B20 = xSemaphoreCreateMutex(); 122 xSemaphoreDS18B20 = xSemaphoreCreateMutex();
123 xSemaphoreDriver = xSemaphoreCreateMutex(); 123 xSemaphoreDriver = xSemaphoreCreateMutex();
124 124
125 TFT_print("Starten taken ", LASTX, LASTY); 125 TFT_print((char *)"Starten taken ", LASTX, LASTY);
126 xTaskCreate(&task_tft, "task_tft", 6144, NULL, 4, &xTaskTFT); 126 xTaskCreate(&task_tft, "task_tft", 6144, NULL, 4, &xTaskTFT);
127 vTaskDelay(400 / portTICK_PERIOD_MS); 127 vTaskDelay(400 / portTICK_PERIOD_MS);
128 xTaskCreate(&task_ds18b20, "task_ds18b20", 2560, NULL, 8, &xTaskDS18B20); 128 xTaskCreate(&task_ds18b20, "task_ds18b20", 2560, NULL, 8, &xTaskDS18B20);
129 xTaskCreate(&task_driver, "task_driver", 2560, NULL, 8, &xTaskDriver); 129 xTaskCreate(&task_driver, "task_driver", 2560, NULL, 8, &xTaskDriver);
130 xTaskCreate(&task_sound, "task_sound", 2048, NULL,15, &xTaskSound); 130 xTaskCreate(&task_sound, "task_sound", 2048, NULL,15, &xTaskSound);
131 xTaskCreate(&task_sdcard, "task_sdcard", 8192, NULL,10, &xTaskSDcard); 131 xTaskCreate(&task_sdcard, "task_sdcard", 8192, NULL,10, &xTaskSDcard);
132 /* lower the wifi logging level */ 132 /* lower the wifi logging level */
133 esp_log_level_set("wifi", ESP_LOG_ERROR); 133 esp_log_level_set("wifi", ESP_LOG_ERROR);
134 xTaskCreate(&task_wifi, "task_wifi", 4096, NULL, 3, &xTaskWifi); 134 xTaskCreate(&task_wifi, "task_wifi", 4096, NULL, 3, &xTaskWifi);
135 TFT_print(" Ok\r\nConnecting ", LASTX, LASTY); 135 TFT_print((char *)" Ok\r\nConnecting ", LASTX, LASTY);
136 136
137 int wait = 20; 137 int wait = 20;
138 while (wait) { 138 while (wait) {
139 vTaskDelay(750 / portTICK_PERIOD_MS); 139 vTaskDelay(750 / portTICK_PERIOD_MS);
140 TFT_print(".", LASTX, LASTY); 140 TFT_print((char *)".", LASTX, LASTY);
141 if (xSemaphoreTake(xSemaphoreWiFi, 25) == pdTRUE) { 141 if (xSemaphoreTake(xSemaphoreWiFi, 25) == pdTRUE) {
142 if (wifi_state->STA_connected == true) 142 if (wifi_state->STA_connected == true)
143 wait = 0; 143 wait = 0;
144 else 144 else
145 wait--; 145 wait--;
146 xSemaphoreGive(xSemaphoreWiFi); 146 xSemaphoreGive(xSemaphoreWiFi);
147 } 147 }
148 } 148 }
149 TFT_print(" Ok\r\n", LASTX, LASTY); 149 TFT_print((char *)" Ok\r\n", LASTX, LASTY);
150 SoundPlay(SOUND_StartUp); 150 SoundPlay(SOUND_StartUp);
151 151
152 start_http_websocket(); 152 start_http_websocket();
153 vTaskDelay(1000 / portTICK_PERIOD_MS); 153 vTaskDelay(1000 / portTICK_PERIOD_MS);
154 Main_Screen = MAIN_MODE_FREE; 154 Main_Screen = MAIN_MODE_FREE;

mercurial