main/task_ds18b20.c

changeset 3
cd760fd45271
parent 2
c0184362d48c
child 5
4b1c65e4d863
--- a/main/task_ds18b20.c	Tue Oct 08 15:47:34 2019 +0200
+++ b/main/task_ds18b20.c	Tue Oct 08 16:51:30 2019 +0200
@@ -14,13 +14,11 @@
 
 
 #define GPIO_DS18B20_BUS	(CONFIG_ONE_WIRE_BUS)
-#define MAX_DEVICES		(8)
 #define DS18B20_RESOLUTION	(DS18B20_RESOLUTION_12_BIT)
-#define SAMPLE_PERIOD		(2000)   // milliseconds
 
 
 static const char		*TAG = "task_ds18b20";
-static const char		*dsErrors[] = { "Ok", "No sensor", "Too many sensors", "CRC error", "Read error" };
+static const char		*dsErrors[] = { "Ok", "CRC error", "Read error" };
 
 SemaphoreHandle_t		xSemaphoreDS18B20 = NULL;	///< Semaphire DS18B20 task
 EventGroupHandle_t		xEventGroupDS18B20;		///< Events DS18B20 task
@@ -126,10 +124,8 @@
 	    	    } else {
 		    	if (errors == DS18B20_ERROR_CRC)
 		    	    ds18b20_state->sensor[0].error = DS18B20_ERR_CRC;
-		    	if (errors == DS18B20_ERROR_OWB)
-		    	    ds18b20_state->sensor[0].error = DS18B20_ERR_READ;
-		    	if (errors == DS18B20_ERROR_DEVICE)
-		    	    ds18b20_state->sensor[0].error = DS18B20_ERR_READ;
+			else
+		    	    ds18b20_state->sensor[0].error = DS18B20_ERR_READ; // All other errors
 		    	ds18b20_state->valid = false;
 		    	ds18b20_state->sensor[0].temperature = 0.0;
 	    	    }

mercurial