diff --git a/src/reset.cpp b/src/reset.cpp index d8dcf153..56fbf98d 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -109,9 +109,6 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { sds011_sleep(); #endif - // halt interrupts accessing i2c bus - mask_user_IRQ(); - // wait a while (max 100 sec) to clear send queues ESP_LOGI(TAG, "Waiting until send queues are empty..."); for (i = 100; i > 0; i--) { @@ -159,6 +156,9 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { digitalWrite(EXT_POWER_SW, EXT_POWER_OFF); #endif + // halt interrupts accessing i2c bus + mask_user_IRQ(); + // shutdown i2c bus i2c_deinit();