View Single Post
Old 08-29-2008, 06:47 AM   #18 (permalink)
ecoxantia
EcoModding Apprentice
 
Join Date: Aug 2008
Location: UK
Posts: 104

Fizz - '06 Skoda Fabia Combi
TEAM VW AUDI Group
90 day: 56.62 mpg (US)
Thanks: 3
Thanked 9 Times in 7 Posts
So I've got the pressure input on pin2, and modified the code.

It doesn't work well! Instant mpg is zero, current is 999. What have I done wrong? CPU is at 500%...

This is part of the modified code, I've added 2 lines.
--------------------------------------------------------
#define looptime 1000000ul/loopsPerSecond //1/2 second
void loop (void){
if(newRun !=1)
initGuino();//go through the initialization screen
unsigned long lastActivity =microSeconds();
unsigned long tankHold; //state at point of last activity
while(true){
unsigned long loopStart=microSeconds();
int press = analogRead(2) + 1; //press is common rail pressure approx in bars
instant.reset(); //clear instant
cli();
instant.update(tmpTrip); //"copy" of tmpTrip in instant now
tmpTrip.reset(); //reset tmpTrip first so we don't lose too many interrupts
sei();

instant.injHius = press * instant.injHius; //correct injector for pressure variation
  Reply With Quote