main/iotbalkon.c

changeset 32
84e54b14e7db
parent 31
ec5c7794dcd6
child 33
5bd5f6668f71
--- a/main/iotbalkon.c	Mon Apr 17 14:54:35 2023 +0200
+++ b/main/iotbalkon.c	Mon Apr 17 16:20:58 2023 +0200
@@ -33,6 +33,8 @@
 static TaskHandle_t			xTaskBLE = NULL;
 #endif
 static TaskHandle_t			xTaskOUT = NULL;
+static TaskHandle_t			xTaskTEMP = NULL;
+
 
 #define	DS_TIME				60
 #define DS_CURRENT			6.6
@@ -59,6 +61,8 @@
 
 int					DisCounter = 0;
 
+extern TEMP_State			*temp_state;
+extern SemaphoreHandle_t		xSemaphoreTEMP;
 extern BMP280_State			*bmp280_state;			///< I2C state
 extern SemaphoreHandle_t		xSemaphoreBMP280;		///< I2C lock semaphore
 extern bmp280_params_t			bmp280_params;
@@ -399,7 +403,7 @@
     xSemaphoreBMP280 = xSemaphoreCreateMutex();
     xSemaphoreINA219 = xSemaphoreCreateMutex();
     xSemaphoreAPDS9930 = xSemaphoreCreateMutex();
-
+    xSemaphoreTEMP = xSemaphoreCreateMutex();
 
     xTaskCreate(&task_bmp280,   "task_bmp280",      2560, NULL, 8, &xTaskBMP280);
     xTaskCreate(&task_ina219,   "task_ina219",      2560, NULL, 8, &xTaskINA219);
@@ -410,6 +414,7 @@
 #ifdef CONFIG_ENABLE_BLE_GATT
     xTaskCreate(&task_ble,      "task_ble",         4096, NULL, 3, &xTaskBLE);
 #endif
+    xTaskCreate(&task_temp,     "task_temp",        2560, NULL, 9, &xTaskTEMP);
 
     vTaskDelay(10 / portTICK_PERIOD_MS);
 
@@ -421,7 +426,8 @@
     uint8_t	ds_time = DS_Time;
 
 
-    while (1) {
+    while (0) {
+	request_temp();
 //	request_bmp280();
 //	request_ina219();
 //	request_apds9930();
@@ -555,6 +561,7 @@
 #endif
       					}
 					getTempBaro();
+					request_temp();
 					vTaskDelay(2000 / portTICK_PERIOD_MS);
       					publish();
       					State = State_WorkDone;

mercurial