#include "app_config.h" #include "TaskMgr.h" #include "Sensors.h" static const char *TAG = "sensors"; Sensors::Sensors() { } void Sensors::start() { m_bmp280 = new Bmp280(Wire); m_bme68x = new Bme68x(Wire); if(!m_bmp280->init()) ESP_LOGE(TAG, "bmp280 sensor error"); if(!m_bme68x->init()) ESP_LOGE(TAG, "bme68x sensor error"); assert(m_i2c1_task = TaskMgr::getInstance().createTask(std::bind(&Sensors::run_i2c_1, this), I2C1_TASK_NAME, I2C1_TASK_STACK_SIZE, I2C1_TASK_PRIORITY, I2C1_TASK_CORE)); assert(m_i2c2_task = TaskMgr::getInstance().createTask(std::bind(&Sensors::run_i2c_2, this), I2C2_TASK_NAME, I2C2_TASK_STACK_SIZE, I2C2_TASK_PRIORITY, I2C2_TASK_CORE)); } void Sensors::run_i2c_1() { while(true) { m_bmp280->read(); m_bme68x->read(); delay(10); } } void Sensors::run_i2c_2() { while(true) { delay(1000); } }