View Single Post
Old 02-17-2009, 09:53 PM   #316 (permalink)
electromike
EcoModding Lurker
 
Join Date: Oct 2008
Location: nova scotia
Posts: 35
Thanks: 2
Thanked 0 Times in 0 Posts
I just modified it to this, and now it saves the trips and will even resume reading the data once the car is turned on.

Code:
int iso_read_byte()
{
  int b;
  byte t=0;
  while(t!=250 && (b=serialRead())==-1) {
    delay(1);
    t++;
  }
  if (t>=250) {
    b = 0;
  }
  return b;
}
*Bug* This works great. The only problem is that once the car is turned off, throttle position is going to be reported as 0. this means that engine breaking will no long be accounted for. That should be taken into consideration else where in the code if you use this (i.e. reset the throttle position minimum value when ever the car is started up again.)

Last edited by electromike; 03-03-2009 at 08:07 AM.. Reason: found a bug
  Reply With Quote