Go Down

Topic: Lots of scope errors. (Read 657 times) previous topic - next topic

bobski

Hey everyone.
I've been working on a trip computer MPG calculator kind of thing inspired by the opengauge/MPGuino. The leader of that project moved away from the Arduino environment (and yet keeps the *uino name? :p ), so I decided to create my own version from scratch. It was working great up until an hour or so ago when I was tinkering with the code, adding comments, renaming variables and such... cleaning up before pushing forward.
I tried compiling the code (via the verify button) to figure out where I had missed a variable replacement or ten (the Arduino app REALLY needs a find/replace function... hint hint), but the compiler started throwing all kinds of scope errors, some of them completely ridiculous:
Code: [Select]
MPGshield:138: error: 'digitalRead' was not declared in this scope
MPGshield:138: error: 'LOW' was not declared in this scope
MPGshield:140: error: 'micros' was not declared in this scope

umm... 'lil help?  :~

davekw7x

#1
May 11, 2011, 06:26 am Last Edit: May 11, 2011, 06:58 am by davekw7x Reason: 1

Hey everyone.
Everyone says hey!

Quote from: bobski

...I was...adding comments...the compiler started throwing all kinds ...

The major head-scratcher is the fact that the multi-line comment starting after the #define directive on line 26 is too long.  (Yes, believe it or not, sometimes comments can kill you!  Really.)

To fix it you can just put the #define on a separate line like this:
Code: [Select]

/*
 how many microseconds of discontinuity between the injector electrical signal and actual fuel flow time.
 this number gets subtracted from the measured length of each injector firing event. if your injector closes
 faster than it opens, the fuel flow time will be shorter than the electrical pulse, and injectorFiringDelay
 should be positive. if the injector opens faster than it opens, this value should be negative.
*/
#define injectorFiringDelay 0                  


Or...

Just change the original lines 26-29 to something like
Code: [Select]

#define injectorFiringDelay 0      //how many microseconds of discontinuity between the injector electrical signal and actual fuel flow time.
                                  //  this number gets subtracted from the measured length of each injector firing event. if your injector closes
                                  //  faster than it opens, the fuel flow time will be shorter than the electrical pulse, and injectorFiringDelay
                                  //  should be positive. if the injector opens faster than it opens, this value should be negative.


Then you will get a few actually meaningful error messages that you can, undoubtedly, get to the bottom of so that it will be ready for testing/debugging.


Regards,

Dave

Footnote:
Whew!

liudr

Ctrl+F gets you find and replace.

bobski

The major head-scratcher is the fact that the multi-line comment starting after the #define directive on line 26 is too long.  (Yes, believe it or not, sometimes comments can kill you!  Really.)
Huh... That's bizarre. Thanks though - that knocked me down to one replacement I had missed.

Ctrl+F gets you find and replace.
So it does! It's even in the menus... I must be blind. >_<

Go Up