flush to sd card before sleep

This commit is contained in:
cyberman54 committed 2022-01-29 13:47:59 +01:00
1 parent db60afe05d
commit 51c6a41180
4 files changed
+15 -2

No files matched your search

+5
View File
@@ -126,6 +126,11 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) {
sds011_sleep();
#endif
// flush & close sd card, if we have
#if (HAS_SDCARD)
sdcard_close();
#endif
// 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--) {
+7 -1
View File
@@ -13,7 +13,13 @@ static void createFile(void);
File fileSDCard;
bool sdcard_init() {
bool sdcard_close(void) {
ESP_LOGD(TAG, "unmounting SD-card");
fileSDCard.flush();
fileSDCard.end();
}
bool sdcard_init(bool create) {
ESP_LOGI(TAG, "looking for SD-card...");
// for usage of SD drivers on ESP32 platform see