stanleyhuangyc / ArduinoOBD

OBD-II library and sketches for Arduino
http://freematics.com
973 stars 518 forks source link

megalogger compile errors 9/9/2013 (SHA=91146cb4bce6482676e7e784c8756ec243168ba6) #2

Closed krausmt closed 10 years ago

krausmt commented 10 years ago

I noticed the addition of getState() and OBD_CONNECTED in the 9/9/2013 push called "sync with library update."

This causes the following compile errors:

megalogger.ino: In member function 'virtual void COBDLogger::dataIdleLoop()':
megalogger.ino:295: error: 'getState' was not declared in this scope
megalogger.ino:295: error: 'OBD_CONNECTED' was not declared in this scope

Looks like there might be some other OBD_ #defines missing (like OBD_CONNECTING) in other places in the code.

Is everything pushed to github? I'm guessing that something's not quite updated...I cloned a fresh copy and get the same results as above.

stanleyhuangyc commented 10 years ago

Please put the updated OBD library into your Arduino's "libraries" directory. Obviously the library there is out-dated.

krausmt commented 10 years ago

Hmm....I'm using your CodeBlocks distribution, not the Arduino IDE. I didn't add any of your OBD stuff to Arduino's "libraries" directory before and it worked fine. The problem is with the getState() function not being defined.

Where in your (ArduinoOBD)https://github.com/stanleyhuangyc/ArduinoOBD github source is getState() defined? You call this from COBDLogger::dataIdleLoop() but I can't find the implementation of getState().

Right now, according to the online github repository, getState() is not defined in any of:

  1. libraries/OBD/OBD.cpp
  2. libraries/OBD/OBD.h
  3. megalogger/datalogger.h
  4. megalogger/megalogger.ino

Are you sure you don't mean something like this:

if (state | OBD_CONNECTED)

instead of

if (getState() == OBD_CONNECTED)

And if so, where is OBD_CONNECTED defined?

I am running the megalogger/megalogger.cbp CodeBlocks project file. Thanks.

krausmt commented 10 years ago

Just do a search for 'getState' on your ArduinoOBD github site and you'll see what I mean:

https://github.com/stanleyhuangyc/ArduinoOBD/search?q=getState&ref=cmdform&type=Code

krausmt commented 10 years ago

And while we're at it, where is the declaration for 'm_state'? Here's a search:

https://github.com/stanleyhuangyc/ArduinoOBD/search?q=m_state&type=Code

As you can see, it's used twice in libraries/OBD/OBD.cpp (lines 255 and 292), but never declared.

Obviously you need to declare m_state before it can be used.

stanleyhuangyc commented 10 years ago

Just comitted. Please check out latest OBD.h.

krausmt commented 10 years ago

That fixed it. I knew it was something simple. Thanks!