View Single Post
Old 01-11-2011, 03:06 AM   #607 (permalink)
eimix
EcoModding Lurker
 
Join Date: Aug 2010
Location: Lithuania
Posts: 74
Thanks: 3
Thanked 21 Times in 15 Posts
there is error in Short/Long time fuel trim PIDs calculating:
Code:
  case STFT_BANK1:
  case LTFT_BANK1:
  case STFT_BANK2:
  case LTFT_BANK2:
    *ret=(buf[0]-128)*7812;  // not divided by 10000 for return value
    long_to_dec_str(*ret/100, decs, 2);
    sprintf_P(retbuf, PSTR("%s %%"), decs);
    break;
all results are shown in between +-3

Code:
    *ret=(buf[0]-128)*7812;  // not divided by 10000 for return value
has to be replaced with (tested)

Code:
    *ret=buf[0]; // Added to avoid 65536 limitation in next operation
    *ret=(*ret-128)*7812;  // not divided by 10000 for return value
or to leave only *ret=(*ret-128)*7812;
becouse *ret is already assigned *ret=buf[0]*256U+buf[1];
or any other solution that do not increases memory consumption
  Reply With Quote