diff options
-rw-r--r-- | megalogger/datalogger.h | 7 | ||||
-rw-r--r-- | nanologger/datalogger.h | 7 | ||||
-rw-r--r-- | unologger/datalogger.h | 7 |
3 files changed, 18 insertions, 3 deletions
diff --git a/megalogger/datalogger.h b/megalogger/datalogger.h index 850900f..8009a80 100644 --- a/megalogger/datalogger.h +++ b/megalogger/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; diff --git a/nanologger/datalogger.h b/nanologger/datalogger.h index 850900f..8009a80 100644 --- a/nanologger/datalogger.h +++ b/nanologger/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; 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; |