r00li / CarCluster

Control car instrument clusters from your computer for gaming or other purposes using ESP32
GNU General Public License v3.0
39 stars 12 forks source link

MPH Speed Drop fix (ESP24) #1

Closed kysxe closed 6 months ago

kysxe commented 7 months ago

This is to fix the speed drop issue on MPH clusters. The code should also work on km/h clusters but I'm unable to test that. I'm also welcome to any feedback or suggestions anyone may have.

This change converts the vehicle speed to MPH for the purpose of calculating the distance traveled. It then calculates the distance traveled in a 50ms interval and adds it to the accumulated distance. If the distance goes too high then it also trips the TCS-Off light which is interesting, so it resets after 30k units. After that, the speed/distance data is then sent to the cluster.

It should be noted that SimHub's message rate should be changed to 20hz using this code as any other frequency will reintroduce the speed drop issue.

kysxe commented 7 months ago

I try it with my Seat Ateca 1.6 Tdi Diesel DashBoard Speedometer in Kilometers Tire size 215/55/R17 , I have to change speedCorrectionFactor to 0.97; It works without any speed drops. Thanks.

Thank you, I'm happy to hear that it works okay.

Upon further testing of my code however it turns out that on my cluster (Golf R 2016) the TCS-Off light still comes on despite the distance resetting every 30k units. I'm gonna play around with it for a little while and see what happens.

Edit: I've made a classic mistake of using the wrong code, lol. Turns out the distance reset thing actually works fine.

r00li commented 6 months ago

Sorry it took me so long to get to this. But... tested with my Golf 7 EU spec cluster and everything works fine as well. I'll merge it as is. I might do some small style tweaks later on, but nothing to change the functionality. Thanks for the contribution.