diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-04-21 20:31:31 +0800 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-04-21 20:31:31 +0800 |
commit | d031b581a0ccc8d36ca49c473dae1a9312f55b95 (patch) | |
tree | 929d8ed08ec625861ff3bfea098a84534d3eb8da /unologger | |
parent | ba0cca67d971dea09d59ea9cb7decfa2ad00ce2e (diff) | |
download | 2021-arduino-obd-d031b581a0ccc8d36ca49c473dae1a9312f55b95.tar.gz 2021-arduino-obd-d031b581a0ccc8d36ca49c473dae1a9312f55b95.tar.bz2 2021-arduino-obd-d031b581a0ccc8d36ca49c473dae1a9312f55b95.zip |
Fix blocking issue when no SD card is present
Diffstat (limited to 'unologger')
-rw-r--r-- | unologger/datalogger.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/unologger/datalogger.h b/unologger/datalogger.h index 850900f..8009a80 100644 --- a/unologger/datalogger.h +++ b/unologger/datalogger.h @@ -175,6 +175,7 @@ public: #endif #endif #if ENABLE_DATA_LOG + if (!sdfile) return; #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 12); dataSize += 12; @@ -207,6 +208,7 @@ public: #endif #endif #if ENABLE_DATA_LOG + if (!sdfile) return; #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 12); dataSize += 12; @@ -241,6 +243,7 @@ public: #endif #endif #if ENABLE_DATA_LOG + if (!sdfile) return; #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 16); dataSize += 16; @@ -277,6 +280,7 @@ public: #endif #endif #if ENABLE_DATA_LOG + if (!sdfile) return; #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 16); dataSize += 16; @@ -315,6 +319,7 @@ public: #endif #endif #if ENABLE_DATA_LOG + if (!sdfile) return; #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 20); dataSize += 20; @@ -375,7 +380,7 @@ public: } void flushFile() { - sdfile.flush(); + if (sdfile) sdfile.flush(); } #endif uint32_t dataTime; |