flush to sd card before sleep
This commit is contained in:
parent
db60afe05d
commit
51c6a41180
@ -8,6 +8,7 @@
|
||||
#include "lorawan.h"
|
||||
#include "display.h"
|
||||
#include "power.h"
|
||||
#include "sdcard.h"
|
||||
|
||||
void reset_rtc_vars(void);
|
||||
void do_reset(bool warmstart);
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define SDCARD_FILE_HEADER_VOLTAGE ",voltage"
|
||||
#endif
|
||||
|
||||
bool sdcard_init(void);
|
||||
bool sdcard_init(bool create = true);
|
||||
bool sdcard_close(void);
|
||||
void sdcardWriteData(uint16_t, uint16_t, uint16_t = 0);
|
||||
|
||||
#endif // _SDCARD_H
|
||||
|
@ -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--) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user