Magister54 / opengauge

Automatically exported from code.google.com/p/opengauge
129 stars 70 forks source link

fix MIL polling #18

Closed adrien-lessard closed 6 years ago

adrien-lessard commented 6 years ago

obduino.pde, line 1397:

for(i=0;i<nb/3;i++) // each received packet contain 3 codes

If nb is 1 or 2, nb/3 will be evaluated to 0 and the code will not read the error codes.

Quick fix is to change the line for:

for(i=0;i<(nb+2)/3;i++) // each received packet contain 3 codes

to receive the right number of error codes

The fix has been tested on a STM32 discovery board and an Toyota Echo 2005. You saved me the trouble of going to the garage, thanks!

Magister54 commented 6 years ago

It was fixed with for (j = 0; j < (nb-1)/3 + 1; j++) in the 32K version