diff options
-rw-r--r-- | unologger/unologger.ino | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/unologger/unologger.ino b/unologger/unologger.ino index 9c03ac6..53a08cb 100644 --- a/unologger/unologger.ino +++ b/unologger/unologger.ino @@ -245,8 +245,8 @@ private: } #if ENABLE_DATA_LOG - // flush SD data every 1KB - if (dataSize - lastFileSize >= 1024) { + // flush SD data every 4KB + if (dataSize - lastFileSize >= 4096) { flushFile(); lastFileSize = dataSize; // display logged data size @@ -320,11 +320,16 @@ private: state &= ~(STATE_OBD_READY | STATE_ACC_READY); state |= STATE_SLEEPING; //digitalWrite(SD_CS_PIN, LOW); - for (uint16_t i = 0; !init(); i++) { + for (uint16_t i = 0; ; i++) { if (i == 5) { lcd.backlight(false); lcd.clear(); } + if (init()) { + int value; + if (read(PID_RPM, value) && value > 0) + break; + } } state &= ~STATE_SLEEPING; fileIndex++; |