PowerBroker2 / ELMduino

Arduino OBD-II Bluetooth Scanner Interface Library for Car Hacking Projects
MIT License
587 stars 117 forks source link

Fix for issue myELM327.supportedPIDs_1_20() not working as expected … #205

Closed jimwhitelaw closed 6 months ago

jimwhitelaw commented 6 months ago

Fixed the issue with incorrect values being returned from findResponse() even though the received bytes were correct. The bug was caused by bit shifting the uint8_t value returned by ctoi() by more than 8 bits (undefined behaviour). Fix is to cast the result of ctoi() to uint64_t before doing the left shift.

Also note in the issue #157, the sample code has a bug were the pids var is a signed int, which will cause an error; it should be unsigned. See example program _Check_PIDs_120.ino for a working version.

PowerBroker2 commented 6 months ago

Awesome. Also, thank you so much for helping me fix up the loose ends of this library!