main/task_user.c

changeset 56
8c88a3d8ecf2
parent 55
43362bb8f3c0
child 57
232f318a6b51
--- a/main/task_user.c	Sat Jun 13 22:07:22 2020 +0200
+++ b/main/task_user.c	Sat Jun 13 23:16:50 2020 +0200
@@ -1083,15 +1083,14 @@
 	case ML2_ZERO_UNIT3:
 		idx = Main_Loop2 - ML2_ZERO_UNIT1;
 		if (SubMenu == 0) {
-		    if (xSemaphoreTake(xSemaphoreUnits, 25) == pdTRUE &&
-			xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE &&
-			adc_state->Pressure[idx].voltage > 165 &&
-			adc_state->Pressure[idx].voltage < 660) {
-			units[idx].pressure_zero = adc_state->Pressure[idx].voltage / (adc_state->Batt_voltage / 1000);
-			write_units();
+		    if (xSemaphoreTake(xSemaphoreUnits, 25) == pdTRUE && xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE) {
+			if (adc_state->Pressure[idx].voltage > 165 && adc_state->Pressure[idx].voltage < 660) {
+			    units[idx].pressure_zero = adc_state->Pressure[idx].voltage / (adc_state->Batt_voltage / 1000);
+			    write_units();
+			    ESP_LOGI(TAG, "Zero set unit %d, %d mV set %d", idx, adc_state->Pressure[idx].voltage, units[idx].pressure_zero);
+		    	}
 			xSemaphoreGive(xSemaphoreADC);
 			xSemaphoreGive(xSemaphoreUnits);
-			ESP_LOGI(TAG, "Zero set unit %d, %d mV set %d", idx, adc_state->Pressure[idx].voltage, units[idx].pressure_zero);
 			screen_unit_zero(idx, SubMenu);
 			if (Main_Loop1 == ML1_DONE)
 			    Main_Loop1 = ML1_INIT;

mercurial