Need help for rfactor plugin to send data on serial port (COM12)

aceruber

I want to make a plugin for rfactor that sends data telemetry from game to serial port COM12 to a microchip mcu wich displays the data , took all the 3 plugins for rfactor dev corner but have a probleme replaced the file output of data with data sending on serial port (i used Visual Studio 2008 C++) while what i tried is working makes the game run so badly it almost freezs the game i think its becouse of the sending data at 9600 bitrate at each frame (used the windows api to comunicate with serial)
If anyone can help please do!

I tried rf2python but don;t know how to install that program (placed all the files in rfactor and install the python 2.7.2 program but when i start rfactor i get error msg The program can;t start becaouse python27.dll is missing ...)

I attached here my experiments with pluginv3 and pluginv1
Pluginv3 didn't even wrote to file so i did not finished that one
http://dl.dropbox.com/u/26321851/Example(for%20plugin%20v1).cpp
http://dl.dropbox.com/u/26321851/Example(for%20plugin%20v3).cpp
 
First, i have no idea about serial ports.

But, looking at your code, your V1 has the port stuff sitting in Startup() only, so it'll only run once per rFactor boot, while in V3 you're opening the serial port every single frame (90Hz) by doing it in UpdateTelemetry() - can you not either send data every 0.x seconds (you can use something like the example's mET to track the elapsed time, since you might not get a solid 90Hz) or leave the port open instead of opening and closing every time?

And if you're having trouble getting V3 working, you might have forgot to enable the Telemetry via the appropriate line in Example.hpp, so take a look at that. (V1 has it enabled by default, V3 it's disabled)

*Edit: I wonder if this might help - first thing I found with a quick google: http://www.robbayer.com/files/serial-win.pdf
 
Last edited:
Nevermind got it working had to not send data each frame , i put a caunter for each 20 frames to send data to serial port COM12 and that seems to make the game a lot smother , heres the file http://dl.dropbox.com/u/26321851/Example.cpp
Anyway thank you lazza for ur help , appriciate it and i made it for V3 plugin now enabled the telemetry as you pointed out there.

Edit : Just hope the rev meter will go smooth when its value will be displayed on my lcd and 10 bar graph led(just for this im trying to get a good balance betwen smooth display of revs and how fast the data is beeing send so it dosen't affect the game performance by to much)

Long live rFactor 1 :D hura hura hura
 

Back
Top