main/co2meter.c

changeset 2
c0184362d48c
parent 0
88d965579617
child 4
2a57c466bf45
--- a/main/co2meter.c	Tue Oct 08 12:55:23 2019 +0200
+++ b/main/co2meter.c	Tue Oct 08 15:47:34 2019 +0200
@@ -282,9 +282,11 @@
 			/* Get global temperature, use for all units. */
 			uint32_t temp = 0;
 			int state = 0;
+			char rom_code[17];
 			if (xSemaphoreTake(xSemaphoreDS18B20, 10) == pdTRUE) {
-			    temp = (ds18b20_state->bottle_temperature * 1000);
-			    state = (ds18b20_state->bottle_error == 0) ? 0:1;
+			    temp = (ds18b20_state->sensor[0].temperature * 1000);
+			    state = (ds18b20_state->sensor[0].error == 0) ? 0:1;
+			    strncpy(rom_code, ds18b20_state->sensor[0].rom_code, strlen(ds18b20_state->sensor[0].rom_code));
         		    xSemaphoreGive(xSemaphoreDS18B20);
     			}
 
@@ -292,6 +294,7 @@
 			for (int i = 0; i < 3; i++) {
 			    units[i].temperature = temp;
 			    units[i].temperature_state = state;
+			    strncpy(units[i].temperature_rom_code, rom_code, strlen(rom_code));
 			    if (xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE) {
 				units[i].pressure_state = adc_state->Pressure[i].error;
 				units[i].pressure_channel = adc_state->Pressure[i].channel;

mercurial