Page 1 of 1

MegaJolt linux tuner program anyone?

Posted: Wed Apr 18, 2018 7:50 pm
by tomicdesu
i'm a happy owner of an early MJLJ v4, installed in my rambler roadster. solved all problems and opened up the engine. i recommend MJ to everyone.

my one sore point is that there is only a Windows version of the tuner program. i've begun coding a tuner in Processing so i can use my little linux laptop. (Processing is a programming environment similar to Arduino. it's bulky, slow and sort of annoying but it's nicely open, cross-platform and my tuner will be a script you can modify).

has anyone done this yet? i've looked hard and long, and can find nothing.

i'm not waiting however. i'll test code by this weekend. i'm only coding the 10 x 10 matrix of advance numbers, and the global stuff. it wll auto-discover the USB device and identify it as MJ (i've long had code for this). what i won't do is anything particularly graphical, that's not my skill set. (embedded code and electronics is...)

Posted: Thu Apr 19, 2018 11:20 pm
by tomicdesu
i have it working on the bench, with a really crappy MJLJ simulator. easier than sitting in the car working on display crap.

i know fairly well how the MJLJ works, but i have some questions:

**** expected serial communication behavior: what should i expect/test for regarding response times, delays, etc. my general approach is to flush my input buffer, send the command, delay 50 mS, slurp up all bytes (not characters) into a buffer until 100 mS timeout, count them, and see if it's the correct number. i'm not super happy with this method... i have a lot of experience with error-tolerant asynchronous serial I/O handling so i'm not scared.


***** regarding some values returned by the C command, GET IGNITION CONFIGURATION.

Advance Correction Bins (bytes 129..138)

and

Advance Correction Values (bytes 139..148)

do i need to worry about these values so far as display goes? i realize the MJ calcs advance as described in the manual, but do i need to reflect any of that calc on the screen? or can they just be editable bins (10 each)?




here's a screen shot. its not pretty, but the window is resizeable. uses Processing 3.x. i made an excreble MJ simulator from an Uno that just responds to commands with fixed byte responses. i'm only using it to shake out the interface and rough flow, then i'll sit in my car with the real box and make it work. i intend to make it save and load files compatible with the Windows tuner program. i'm lazy; i'd otherwise like to only include feetch that *I* need, just the basics, no shift light, aux inputs, etc.

it should work as-is on windows, macintosh, and debian linux. it auto-discovers serial devices, then opens them one by one and issues a VERSION command, to see if it gets the right response.

the GREEN cursor is the live cursor, eg. current rpm/load bin. the black rectangle is the edit bin, it moves via arrow keys. hitting ENTER on a bin highlights it RED, for editing. backspace, digits, up-arrow (increment) down-arrow (decrement) work. ENTER again ends edit. that's all working. everything is dynamic, realtime data driven, no blocking, etc.

i added some COPY COLUMN (left, right) commands. and increment/decrement all cells.

i'll put the adv correct bins in a row below the matrix.

Image

[/img]

Posted: Fri Apr 20, 2018 12:01 am
by tomicdesu
oh and what are the version command return values? I assume v4 returns "4" as major. but how do i use it to indicate compatibility? will the new /E return major=4? is there a map of features vs. versions somewhere?

OK! silence! lol

Posted: Mon Apr 23, 2018 9:37 pm
by tomicdesu
so i have it substantially working: discovers serial device, reliably fetches MJ data conservatively, via a state machine. gets advance bins, bin labels, etc from MJ. saves to file, loads from file, and it loads the distribution Windows tuner files fine. real-time display of runtime data (RPM, load "cursor") as well as edit-cell.

what's missing at the moment is write config to MJ, write flash, etc. i'll poke around the read-only stuff to make sure all's well and then add write-config etc.

being lazy, i'm only going to implement my needs, which is basically the advance bin stuff needed for spark timing tuning. global stuff, cylinder count, MAP/TPS mode, revLimit etc, i have no plans to add, but it would not be hard. however those datums are loaded/saved in files and fetched from MJ (and will be written to) so even now, changing them with a text editor works.

i will eventually (...) put this up on github, but in the mean time if anyone wants it, message or email me.

Image

Posted: Mon Apr 23, 2018 10:24 pm
by brentp
Hi, sorry I missed this earlier, was down with the flu.

Looks like a great start! If you want to provide it as open source, we can host it on our github and make you an admin of the repository.

The current Megajolt app is written in wxWidgets, and should cross-compile to Linux as well as OS X. We migrated to Kivy for future app work (RaceCapture) as Python was much easier to work with than C++.