Fix lock sync loss in unit zero set when the pressure sensor is not connected. Removed some log messages.

Sat, 13 Jun 2020 23:16:50 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 13 Jun 2020 23:16:50 +0200
changeset 56
8c88a3d8ecf2
parent 55
43362bb8f3c0
child 57
232f318a6b51

Fix lock sync loss in unit zero set when the pressure sensor is not connected. Removed some log messages.

CMakeLists.txt file | annotate | diff | comparison | revisions
main/task_user.c file | annotate | diff | comparison | revisions
main/u8g2_esp32_hal.c file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sat Jun 13 22:07:22 2020 +0200
+++ b/CMakeLists.txt	Sat Jun 13 23:16:50 2020 +0200
@@ -2,7 +2,7 @@
 # in this exact order for cmake to work correctly
 cmake_minimum_required(VERSION 3.5)
 
-set(PROJECT_VER "0.2.5")
+set(PROJECT_VER "0.2.6")
 set(PROJECT_NAME "co2meter")
 
 include($ENV{IDF_PATH}/tools/cmake/project.cmake)
--- 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;
--- a/main/u8g2_esp32_hal.c	Sat Jun 13 22:07:22 2020 +0200
+++ b/main/u8g2_esp32_hal.c	Sat Jun 13 23:16:50 2020 +0200
@@ -118,17 +118,12 @@
 
 		    i2c_config_t conf;
 		    conf.mode = I2C_MODE_MASTER;
-			ESP_LOGI(TAG, "sda_io_num %d", u8g2_esp32_hal.sda);
 		    conf.sda_io_num = u8g2_esp32_hal.sda;
 		    conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
-			ESP_LOGI(TAG, "scl_io_num %d", u8g2_esp32_hal.scl);
 		    conf.scl_io_num = u8g2_esp32_hal.scl;
 		    conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
-			ESP_LOGI(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ);
 		    conf.master.clk_speed = I2C_MASTER_FREQ_HZ;
-			ESP_LOGI(TAG, "i2c_param_config %d", conf.mode);
 		    ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf));
-			ESP_LOGI(TAG, "i2c_driver_install %d", I2C_MASTER_NUM);
 		    ESP_LOGI(TAG, "I2C gpio_sda: %d gpio_scl: %d clk_speed: %d master_num: %d",
 			u8g2_esp32_hal.sda, u8g2_esp32_hal.scl, I2C_MASTER_FREQ_HZ, I2C_MASTER_NUM);
 		    ESP_ERROR_CHECK(i2c_driver_install(I2C_MASTER_NUM, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0));

mercurial