Version 1.0.3
Updated error messages.
This commit is contained in:
		| @@ -76,10 +76,8 @@ extern "C" | |||||||
|      * @return |      * @return | ||||||
|      *              - ESP_OK if read was success |      *              - ESP_OK if read was success | ||||||
|      *              - ESP_ERR_INVALID_ARG if parameter error |      *              - ESP_ERR_INVALID_ARG if parameter error | ||||||
|      *              - ESP_ERR_NOT_FOUND if BH1750 is not initialized |      *              - ESP_ERR_NOT_FOUND if sensor is not initialized | ||||||
|      *              - ESP_FAIL if sending command error or slave has not ACK the transfer |      *              - ESP_ERR_INVALID_RESPONSE if I2C driver error | ||||||
|      *              - ESP_ERR_INVALID_STATE if I2C driver not installed or not in master mode |  | ||||||
|      *              - ESP_ERR_TIMEOUT if operation timeout because the bus is busy |  | ||||||
|      */ |      */ | ||||||
|     esp_err_t zh_bh1750_read(float *data); |     esp_err_t zh_bh1750_read(float *data); | ||||||
|  |  | ||||||
| @@ -95,10 +93,8 @@ extern "C" | |||||||
|      * @return |      * @return | ||||||
|      *              - ESP_OK if adjust was success |      *              - ESP_OK if adjust was success | ||||||
|      *              - ESP_ERR_INVALID_ARG if parameter error |      *              - ESP_ERR_INVALID_ARG if parameter error | ||||||
|      *              - ESP_ERR_NOT_FOUND if BH1750 is not initialized or auto adjust is enabled |      *              - ESP_ERR_NOT_FOUND if sensor is not initialized or auto adjust is enabled | ||||||
|      *              - ESP_FAIL if sending command error or slave has not ACK the transfer |      *              - ESP_ERR_INVALID_RESPONSE if I2C driver error | ||||||
|      *              - ESP_ERR_INVALID_STATE if I2C driver not installed or not in master mode |  | ||||||
|      *              - ESP_ERR_TIMEOUT if operation timeout because the bus is busy |  | ||||||
|      */ |      */ | ||||||
|     esp_err_t zh_bh1750_adjust(const uint8_t value); |     esp_err_t zh_bh1750_adjust(const uint8_t value); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 1.0.2 | 1.0.3 | ||||||
							
								
								
									
										16
									
								
								zh_bh1750.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								zh_bh1750.c
									
									
									
									
									
								
							| @@ -113,8 +113,8 @@ REPEATE:; | |||||||
| #endif | #endif | ||||||
|     if (esp_err != ESP_OK) |     if (esp_err != ESP_OK) | ||||||
|     { |     { | ||||||
|         ESP_LOGE(TAG, "BH1750 read fail. I2C driver error."); |         ESP_LOGE(TAG, "BH1750 read fail. I2C driver error at line %d.", __LINE__); | ||||||
|         return esp_err; |         return ESP_ERR_INVALID_RESPONSE; | ||||||
|     } |     } | ||||||
|     vTaskDelay(_time / portTICK_PERIOD_MS); |     vTaskDelay(_time / portTICK_PERIOD_MS); | ||||||
| READ: | READ: | ||||||
| @@ -132,8 +132,8 @@ READ: | |||||||
| #endif | #endif | ||||||
|     if (esp_err != ESP_OK) |     if (esp_err != ESP_OK) | ||||||
|     { |     { | ||||||
|         ESP_LOGE(TAG, "BH1750 read fail. I2C driver error."); |         ESP_LOGE(TAG, "BH1750 read fail. I2C driver error at line %d.", __LINE__); | ||||||
|         return esp_err; |         return ESP_ERR_INVALID_RESPONSE; | ||||||
|     } |     } | ||||||
|     uint32_t raw_data = sensor_data[0] << 8 | sensor_data[1]; |     uint32_t raw_data = sensor_data[0] << 8 | sensor_data[1]; | ||||||
|     if (raw_data == 65535 || raw_data == 0) |     if (raw_data == 65535 || raw_data == 0) | ||||||
| @@ -204,8 +204,8 @@ esp_err_t _adjust(const uint8_t value) | |||||||
|     i2c_cmd_link_delete(i2c_cmd_handle); |     i2c_cmd_link_delete(i2c_cmd_handle); | ||||||
|     if (esp_err != ESP_OK) |     if (esp_err != ESP_OK) | ||||||
|     { |     { | ||||||
|         ESP_LOGE(TAG, "BH1750 adjust fail. I2C driver error."); |         ESP_LOGE(TAG, "BH1750 adjust fail. I2C driver error at line %d.", __LINE__); | ||||||
|         return esp_err; |         return ESP_ERR_INVALID_RESPONSE; | ||||||
|     } |     } | ||||||
|     i2c_cmd_handle = i2c_cmd_link_create(); |     i2c_cmd_handle = i2c_cmd_link_create(); | ||||||
|     i2c_master_start(i2c_cmd_handle); |     i2c_master_start(i2c_cmd_handle); | ||||||
| @@ -220,8 +220,8 @@ esp_err_t _adjust(const uint8_t value) | |||||||
| #endif | #endif | ||||||
|     if (esp_err != ESP_OK) |     if (esp_err != ESP_OK) | ||||||
|     { |     { | ||||||
|         ESP_LOGE(TAG, "BH1750 adjust fail. I2C driver error."); |         ESP_LOGE(TAG, "BH1750 adjust fail. I2C driver error at line %d.", __LINE__); | ||||||
|         return esp_err; |         return ESP_ERR_INVALID_RESPONSE; | ||||||
|     } |     } | ||||||
|     if (_init_config.work_mode == CONTINUOUSLY) |     if (_init_config.work_mode == CONTINUOUSLY) | ||||||
|     { |     { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user