diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2013-06-27 14:42:45 +0800 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2013-06-27 14:42:45 +0800 |
commit | 17abc0d3cf9b226b06e5d62790a8d5e576846571 (patch) | |
tree | fd7eed9168345015b03db5b62cbb8119766a5452 /megalogger | |
parent | b74448509a44bc2be9a006827ede79be883efbd4 (diff) | |
download | 2021-arduino-obd-17abc0d3cf9b226b06e5d62790a8d5e576846571.tar.gz 2021-arduino-obd-17abc0d3cf9b226b06e5d62790a8d5e576846571.tar.bz2 2021-arduino-obd-17abc0d3cf9b226b06e5d62790a8d5e576846571.zip |
update library API
Diffstat (limited to 'megalogger')
-rw-r--r-- | megalogger/megalogger.ino | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino index ffcb41d..6620f7d 100644 --- a/megalogger/megalogger.ino +++ b/megalogger/megalogger.ino @@ -121,7 +121,7 @@ public: do { ShowStates(); - } while (!Init()); + } while (!init()); state |= STATE_OBD_READY; @@ -134,7 +134,7 @@ public: ShowECUCap(); delay(3000); - ReadSensor(PID_DISTANCE, startDistance); + readSensor(PID_DISTANCE, startDistance); // open file for logging if (!(state & STATE_SD_READY)) { @@ -285,7 +285,7 @@ public: return true; } private: - void InitIdleLoop() + void initIdleLoop() { // called while initializing char buf[10]; @@ -319,7 +319,7 @@ private: #endif } #ifdef GPSUART - void DataIdleLoop() + void dataIdleLoop() { if (lastDataTime && GPSUART.available()) ProcessGPS(); @@ -423,11 +423,11 @@ private: uint32_t start = millis(); // send a query to OBD adapter for specified OBD-II pid - Query(pid); + sendQuery(pid); // wait for reponse bool hasData; do { - DataIdleLoop(); + dataIdleLoop(); } while (!(hasData = available()) && millis() - start < OBD_TIMEOUT_SHORT); // no need to continue if no data available if (!hasData) { @@ -440,7 +440,7 @@ private: // get response from OBD adapter pid = 0; - char* data = GetResponse(pid, buffer); + char* data = getResponse(pid, buffer); if (!data) { // try recover next time write('\r'); @@ -450,7 +450,7 @@ private: uint32_t dataTime = millis(); // convert raw data to normal value - value = GetConvertedValue(pid, data); + value = normalizeData(pid, data); lastPID = pid; lastData = value; @@ -479,7 +479,7 @@ private: // if OBD response is very fast, go on processing other data for a while #ifdef OBD_MIN_INTERVAL while (millis() - start < OBD_MIN_INTERVAL) { - DataIdleLoop(); + dataIdleLoop(); } #endif } @@ -492,7 +492,7 @@ private: for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) { lcd.setCursor(160, i * 2 + 4); lcd.print(namelist[i]); - lcd.draw(IsValidPID(PID_RPM) ? tick : cross, 304, i * 16 + 32, 16, 16); + lcd.draw(isValidPID(PID_RPM) ? tick : cross, 304, i * 16 + 32, 16, 16); } } void Reconnect() @@ -502,7 +502,7 @@ private: lcd.print("Reconnecting..."); state &= ~(STATE_OBD_READY | STATE_ACC_READY | STATE_DATE_SAVED); //digitalWrite(SD_CS_PIN, LOW); - for (int i = 0; !Init(); i++) { + for (int i = 0; !init(); i++) { if (i == 10) lcd.clear(); } fileIndex++; @@ -636,8 +636,8 @@ void setup() #ifdef CONSOLE CONSOLE.begin(115200); #endif - // start serial communication at the adapter defined baudrate - OBDUART.begin(OBD_SERIAL_BAUDRATE); + + logger.begin(); #ifdef GPSUART #ifdef GPS_OPEN_BAUDRATE GPSUART.begin(GPS_OPEN_BAUDRATE); |