diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2013-12-18 18:58:17 +1100 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2013-12-18 18:58:17 +1100 |
commit | 9549f854fe7b01615476a83201b472c2e862ec93 (patch) | |
tree | d9420cfae2ced789d3c76af0d11021b0797085bb /megalogger/megalogger.ino | |
parent | 2e009a031d1fe4aff95da3bc1b981d9ace697dd3 (diff) | |
download | 2021-arduino-obd-9549f854fe7b01615476a83201b472c2e862ec93.tar.gz 2021-arduino-obd-9549f854fe7b01615476a83201b472c2e862ec93.tar.bz2 2021-arduino-obd-9549f854fe7b01615476a83201b472c2e862ec93.zip |
Updated MEGA logger
Diffstat (limited to 'megalogger/megalogger.ino')
-rw-r--r-- | megalogger/megalogger.ino | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino index 15da969..cb32afb 100644 --- a/megalogger/megalogger.ino +++ b/megalogger/megalogger.ino @@ -20,10 +20,6 @@ #endif #include "datalogger.h" -#if !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega644P__) && !defined(__SAM3X8E__) -#error This sketch requires Arduino MEGA or DUE to work -#endif - // logger states #define STATE_SD_READY 0x1 #define STATE_OBD_READY 0x2 @@ -34,7 +30,7 @@ #ifdef USE_GPS // GPS logging can only be enabled when there is additional hardware serial UART -#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) +#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__SAM3X8E__) #define GPSUART Serial2 #elif defined(__AVR_ATmega644P__) #define GPSUART Serial1 @@ -53,11 +49,11 @@ TinyGPS gps; #endif // GPSUART #endif -static uint32_t lastFileSize = 0; +static uint8_t lastFileSize = 0; static uint32_t lastDataTime = 0; static uint32_t lastGPSDataTime = 0; static uint32_t lastACCDataTime = 0; -static uint16_t lastRefreshTime = 0; +static uint8_t lastRefreshTime = 0; static uint16_t lastSpeed = -1; static uint16_t startDistance = 0; static uint16_t fileIndex = 0; @@ -117,8 +113,10 @@ public: lcd.printInt(index); #endif +#ifndef MEMORY_SAVING showECUCap(); delay(1000); +#endif read(PID_DISTANCE, (int&)startDistance); @@ -432,7 +430,7 @@ private: #if ENABLE_DATA_LOG // flush SD data every 1KB - if (dataSize - lastFileSize >= 1024) { + if ((dataSize >> 10) != lastFileSize) { flushFile(); // display logged data size lcd.setFont(FONT_SIZE_MEDIUM); @@ -440,7 +438,7 @@ private: lcd.printInt((unsigned int)(dataSize >> 10)); lcd.setFont(FONT_SIZE_SMALL); lcd.print(" KB"); - lastFileSize = dataSize; + lastFileSize = dataSize >> 10; } #endif @@ -556,10 +554,12 @@ private: void initScreen() { lcd.clear(); +#ifndef MEMORY_SAVING lcd.draw2x(frame0[0], 0, 0, 78, 58); lcd.draw2x(frame0[0], 164, 0, 78, 58); lcd.draw2x(frame0[0], 0, 124, 78, 58); lcd.draw2x(frame0[0], 164, 124, 78, 58); +#endif //lcd.setColor(RGB16(0x7f, 0x7f, 0x7f)); lcd.setFont(FONT_SIZE_SMALL); |