econpy / torque

A set of tools used with the Torque app for Android to store OBD2 data in MySQL, view GPS data from Torque on a map in real time using the Google Maps JavaScript API, plot OBD2 data in time series charts, and export the data to CSV or JSON.
MIT License
285 stars 120 forks source link

Data Units conversion in userDefault #15

Open esticle opened 10 years ago

esticle commented 10 years ago

I see within plot.php that there is a mention for userDefault fields in the TODO list, so just to add my +1 to that!

Currently temperature is plotted in F (converted from Celsius) whilst I would like it in C - just like I'm sure that some folk would like KMH and not MPH, etc.

As mentioned in the file, best is probably to have a profile for each username but that looks like quite a bit of work vs some settings.php effort to do it across all users at first?

Cheers, E

econpy commented 10 years ago

This is actually pretty straight forward to do, I just haven't gotten around to it. When a new session is started, the first 2 POST requests have this information. So technically, a settings file won't be needed and all this can be handled without any required user input.

So it's on my list -- I'll get to it shortly.

esticle commented 10 years ago

Even better - thanks as always!

econpy commented 10 years ago

I've finished modifying the database structure to log all the profile/userUnit/defaultUnit fields. Now I just need to tweak the front end to make use of the new tables and carry out the appropriate conversion (in the case of userUnit/defaultUnit values) as well as do the grouping of sessions based on profiles. Hopefully can knock it out tonight yet, otherwise tomorrow.

econpy commented 10 years ago

Ok, I just pushed a lot of changes into a new branch beta. Since the DB structure has changed, you won't be able to use old data. I will address this the best I can shortly, but for now it would be great if you could test out the new dynamic unit conversions. From my tests, it seems to be working great.

As an FYI: Before building a new database using the new create_torque_log_table.sql script, you should back up your old/current raw_logs table as the script will drop that table and create an empty one.

For now I only did conversions for speed (mph/kph) and temperature (celsius/fahrenheit). If this method works properly for everyone, then I will add all the other conversions.

To recap, using the beta branch the web viewer should convert temps and speed to the appropriate unit used in your Torque settings.

Let me know!