|
|
@ -69,7 +69,7 @@ void co2_restart(bool restore_calib) { |
|
|
|
ESP_LOGI(TAG, "Restarting CO2 sensor"); |
|
|
|
ESP_LOGI(TAG, "Restarting CO2 sensor"); |
|
|
|
|
|
|
|
|
|
|
|
gpio_set_level(CONFIG_PIN_CO2_EN, 0); |
|
|
|
gpio_set_level(CONFIG_PIN_CO2_EN, 0); |
|
|
|
vTaskDelay(pdMS_TO_TICKS(100)); |
|
|
|
vTaskDelay(pdMS_TO_TICKS(250)); |
|
|
|
gpio_set_level(CONFIG_PIN_CO2_EN, 1); |
|
|
|
gpio_set_level(CONFIG_PIN_CO2_EN, 1); |
|
|
|
vTaskDelay(pdMS_TO_TICKS(50)); |
|
|
|
vTaskDelay(pdMS_TO_TICKS(50)); |
|
|
|
|
|
|
|
|
|
|
@ -97,7 +97,7 @@ void co2_read_task(void *param) { |
|
|
|
|
|
|
|
|
|
|
|
write_saved_calib_to_sensor(); |
|
|
|
write_saved_calib_to_sensor(); |
|
|
|
|
|
|
|
|
|
|
|
const uint32_t read_cycle_time_ticks = 10 * 1000; |
|
|
|
const uint32_t read_cycle_time_ticks = 1000; //10 * 1000;
|
|
|
|
const uint32_t calib_persist_time_ticks = 12 * 3600 * 1000; |
|
|
|
const uint32_t calib_persist_time_ticks = 12 * 3600 * 1000; |
|
|
|
_Static_assert(configTICK_RATE_HZ == 1000, "1kHz tick"); |
|
|
|
_Static_assert(configTICK_RATE_HZ == 1000, "1kHz tick"); |
|
|
|
|
|
|
|
|
|
|
@ -111,7 +111,7 @@ void co2_read_task(void *param) { |
|
|
|
ppm = 0; |
|
|
|
ppm = 0; |
|
|
|
vTaskDelay(read_cycle_time_ticks); |
|
|
|
vTaskDelay(read_cycle_time_ticks); |
|
|
|
|
|
|
|
|
|
|
|
if (num_fails > 10) { |
|
|
|
if (num_fails > 5) { |
|
|
|
ESP_LOGW(TAG, "Too many CO2 fails, restarting sensor"); |
|
|
|
ESP_LOGW(TAG, "Too many CO2 fails, restarting sensor"); |
|
|
|
co2_restart(true); |
|
|
|
co2_restart(true); |
|
|
|
num_fails = 0; |
|
|
|
num_fails = 0; |
|
|
|