# HG changeset patch # User Michiel Broek # Date 1570654297 -7200 # Node ID 6eafc4c2bf3d0b69702ba77a8932ee899024812e # Parent 06a5028dbcdfcf01bb901df8b4b827e591df50fe Sleep time is now 55 seconds. Code cleanup. Decrease MQTT library logging to Error. diff -r 06a5028dbcdf -r 6eafc4c2bf3d main/co2meter.c --- a/main/co2meter.c Wed Oct 09 21:00:27 2019 +0200 +++ b/main/co2meter.c Wed Oct 09 22:51:37 2019 +0200 @@ -72,7 +72,7 @@ ESP_LOGI(TAG, "Starting from hard reset"); } - const int wakeup_time_sec = 20; + const int wakeup_time_sec = 55; ESP_LOGI(TAG, "Enabling timer wakeup, %ds", wakeup_time_sec); esp_sleep_enable_timer_wakeup(wakeup_time_sec * 1000000); @@ -109,11 +109,7 @@ u8g2_esp32_hal_init(u8g2_esp32_hal); u8g2_t u8g2; // a structure which will contain all the data for one display - u8g2_Setup_sh1106_i2c_128x64_noname_f( - &u8g2, - U8G2_R0, - u8g2_esp32_i2c_byte_cb, - u8g2_esp32_gpio_and_delay_cb); // init u8g2 structure + u8g2_Setup_sh1106_i2c_128x64_noname_f(&u8g2, U8G2_R0, u8g2_esp32_i2c_byte_cb, u8g2_esp32_gpio_and_delay_cb); // init u8g2 structure u8x8_SetI2CAddress(&u8g2.u8x8, 0x78); ESP_LOGI(TAG, "u8g2_InitDisplay"); u8g2_InitDisplay(&u8g2); // send init sequence to the display, display is in sleep mode after this, @@ -203,23 +199,26 @@ esp_log_level_set("wifi", ESP_LOG_ERROR); xTaskCreate(&task_wifi, "task_wifi", 4096, NULL, 3, &xTaskWifi); vTaskDelay(10 / portTICK_PERIOD_MS); + esp_log_level_set("MQTT_CLIENT", ESP_LOG_ERROR); xTaskCreate(&task_mqtt, "task_mqtt", 4096, NULL, 5, &xTaskMQTT); - // esp32-rotary-encoder requires that the GPIO ISR service is installed before calling rotary_encoder_register() -// ESP_ERROR_CHECK(gpio_install_isr_service(0)); - - // Initialise the rotary encoder device with the GPIOs for A and B signals -// rotary_encoder_info_t info = { 0 }; -// ESP_ERROR_CHECK(rotary_encoder_init(&info, ROT_ENC_A_GPIO, ROT_ENC_B_GPIO)); -// ESP_ERROR_CHECK(rotary_encoder_enable_half_steps(&info, ENABLE_HALF_STEPS)); + /* + * Setup the Rotary Encoder. + * esp32-rotary-encoder requires that the GPIO ISR service is + * installed before calling rotary_encoder_register() + */ + ESP_ERROR_CHECK(gpio_install_isr_service(0)); + rotary_encoder_info_t rinfo = { 0 }; + ESP_ERROR_CHECK(rotary_encoder_init(&rinfo, ROT_ENC_A_GPIO, ROT_ENC_B_GPIO)); +// ESP_ERROR_CHECK(rotary_encoder_enable_half_steps(&rinfo, ENABLE_HALF_STEPS)); #ifdef FLIP_DIRECTION -// ESP_ERROR_CHECK(rotary_encoder_flip_direction(&info)); +// ESP_ERROR_CHECK(rotary_encoder_flip_direction(&rinfo)); #endif // Create a queue for events from the rotary encoder driver. // Tasks can read from this queue to receive up to date position information. // QueueHandle_t event_queue = rotary_encoder_create_queue(); -// ESP_ERROR_CHECK(rotary_encoder_set_queue(&info, event_queue)); +// ESP_ERROR_CHECK(rotary_encoder_set_queue(&rinfo, event_queue)); /* diff -r 06a5028dbcdf -r 6eafc4c2bf3d main/config.c --- a/main/config.c Wed Oct 09 21:00:27 2019 +0200 +++ b/main/config.c Wed Oct 09 22:51:37 2019 +0200 @@ -98,7 +98,6 @@ size_t bytes = fread(dst, 1, sizeof(units), f); fclose(f); ESP_LOGI(TAG, "/spiffs/etc/units.conf read %d bytes", bytes); - ESP_LOGI(TAG, "%s %s", units[0].uuid, units[0].alias); } } diff -r 06a5028dbcdf -r 6eafc4c2bf3d sdkconfig --- a/sdkconfig Wed Oct 09 21:00:27 2019 +0200 +++ b/sdkconfig Wed Oct 09 22:51:37 2019 +0200 @@ -16,11 +16,11 @@ # CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 +CONFIG_BOOTLOADER_LOG_LEVEL=2 # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set @@ -561,11 +561,11 @@ CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 +CONFIG_LOG_BOOTLOADER_LEVEL=2 # CONFIG_APP_ROLLBACK_ENABLE is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set # CONFIG_FLASHMODE_QIO is not set