Help with binary data

Developer topics relating to software that provides a tuning UI to alter ECU code and data

Moderator: Freon

Help with binary data

Postby qoncept » Sat Oct 29, 2005 4:45 pm

Grr.. So my Java skills are a little rusty (and I've never read binary data before). Right now I'm just trying to read all the relevent data in an ECU image, and then I'll worry about making it useful. I started by trying to pull the RPM for the timing table, and of course, I'm stuck right there. Random (or seemingly) values are coming out negative and I can't figure out why.

//populate rpm values
System.out.println("RPM Values");
for (int i = 0; i < 30; i = i + 2) {
rpmValues[i / 2] = ecuImage[i + Integer.parseInt(new String("293AA"),16)];
System.out.print(rpmValues[i / 2] * 50 + " ");
}

This segment of the code returns this:
RPM Values
800 1200 1600 2000 2400 2800 3200 3600 4000 4400 4800 5200 5600 6000 -6400

If anyone can tell me what I'm doing wrong I'd appreciate it. Thanks!
qoncept
 
Posts: 249
Joined: Tue Oct 04, 2005 6:43 pm
Location: Montgomery, AL

Postby cdvma » Sun Oct 30, 2005 6:53 am

why not just do

ecuImage[i+0x293AA]

?

Dunno why it would come out negative like that, there is no math to support it unless the data in the ROM is being interpreted as negatively signed. Which ROM are you using?
cdvma
 
Posts: 86
Joined: Tue Jan 04, 2005 9:18 pm
Location: Roch. Inst. of Tech.

Postby qoncept » Sun Oct 30, 2005 7:18 am

cdvma wrote:why not just do

ecuImage[i+0x293AA]

?

Dunno why it would come out negative like that, there is no math to support it unless the data in the ROM is being interpreted as negatively signed. Which ROM are you using?

Wow.. wish I'd known that. You'd think I'd have come across it when I was googling for the methods..

I'm using the ecu dumped from my car, and a copy of it that's been edited. Both do the same thing. I'll try downloading a couple and see what they do.

Edit: I just tried a few more and they're all turning up negatives (in the same places). I'm using Math.abs but I'd really like to not have to. I don't understand how random bytes like that are being interpreted as negatively signed, especially since the absolute values I'm getting are correct. :\
qoncept
 
Posts: 249
Joined: Tue Oct 04, 2005 6:43 pm
Location: Montgomery, AL

Postby cdvma » Sun Oct 30, 2005 1:50 pm

Can you post the data here? The ROM I've got doesn't appear to use the same offsets.
cdvma
 
Posts: 86
Joined: Tue Jan 04, 2005 9:18 pm
Location: Roch. Inst. of Tech.

Postby qoncept » Sun Oct 30, 2005 5:33 pm

Here's what I've got. It's kind of messy and I think I'm going to pretty much start from scratch before I start the gui, but you can see the negative value problem. Not sure what the deal is..

Also, if anyone is bored and wants to take a look and tell me a way to add 2 bytes together that isn't goofy like the way I did it, I'd appreciate it. :)
Attachments
enginuity dev.rar
(101.44 KiB) Downloaded 430 times
qoncept
 
Posts: 249
Joined: Tue Oct 04, 2005 6:43 pm
Location: Montgomery, AL

Postby qoncept » Mon Nov 07, 2005 12:28 pm

Alright, things are coming along pretty well. Just a couple more questions for now. I've got the boost table loaded and I can't figure out the calculations for boost or throttle. Any clues?

Here's what I've got done so far. You can open a file (path is hard coded as I haven't gotten to that yet), it loads fuel, timing and boost tables and displays them, and you can modify the data. I haven't gotten to writing to file yet.

Edit: I also can't figure out the EGT formula. I'd really like to get rid of that stupid CEL.. :)
Attachments
enginuity071105.JPG
enginuity071105.JPG (110.94 KiB) Viewed 8382 times
enginuity dev.rar
(118.15 KiB) Downloaded 398 times
qoncept
 
Posts: 249
Joined: Tue Oct 04, 2005 6:43 pm
Location: Montgomery, AL

Postby cdvma » Tue Nov 08, 2005 1:57 pm

Lookin good! Two observations.

1) Usually the load goes horizontally and the RPM increases as you go down vertically. No biggie, mostly personal preference and how I've seen it.

2) Why does everyone and their brother use Java? Heheh not looking down on it (I still use it for some stuff) but I just realized every project on here thats been posted recently is Java :)

I also haven't got time to figure out why your code was doing the negative thing...I've been busy on other work.
cdvma
 
Posts: 86
Joined: Tue Jan 04, 2005 9:18 pm
Location: Roch. Inst. of Tech.

Postby ahains » Tue Nov 08, 2005 2:19 pm

cdvma wrote:Lookin good! Two observations.

1) Usually the load goes horizontally and the RPM increases as you go down vertically. No biggie, mostly personal preference and how I've seen it.

2) Why does everyone and their brother use Java? Heheh not looking down on it (I still use it for some stuff) but I just realized every project on here thats been posted recently is Java :)

I also haven't got time to figure out why your code was doing the negative thing...I've been busy on other work.


My best guess on item 2 is:
1)Platform independant (so our linux friends can join the party)
2)Decent free tools
3)Easier than native coding in c/c++

If I ever get time for some of this, I'll be using C# because it is what I'm familiar with and where I want to invest more experience time.
But I figure if I write any C# tools that someone has just gotta run on linux they can install Mono, or it should be pretty quick and easy to port to Java.

-a
ahains
 
Posts: 83
Joined: Mon Jun 06, 2005 12:59 pm
Location: Renton, WA

Postby qoncept » Tue Nov 08, 2005 2:20 pm

cdvma,
1) I haven't looked at any of the Subaru software, but everything else I've seen has had the RPMs on the x axis. Mike said the same thing, so I went ahead and changed it. No big deal either way. :) It would've been a lot less confusing doing it that way to begin with, I think, since that's how it's done in the image.

2) I personally use Java because it's what I know best. It's great for RAD (though it's quickly getting hard to organize). It's been a while since I've used it, though, so for the first week or so I spent more time getting back in to it and working pretty slowly.

I finally buckeled down and posted on Sun's Java forums. Someone told me to add "0xff" after bytes and that took care of the negative problem. I'm concerned now that when I try to write back to file it may cause some confusion but I'm keeping my fingers crossed.

For those interested, I've been working today more on usability and less on actual functionality. All the buttons now work. Next up actually writing files, then a dialog to open files. At some point I also need to add mouse dragging to select multiple fields. Eventually my goal is to be able to open a log file with AFR, load and RPM and automatically tune the fuel table. I've been working on it quite a bit and I imagine I'll probably start to slow down before too long, and then I'll probably keep the source on enginuity.org for other people to help with. I hope to have something pretty usable maybe in a week or two.
qoncept
 
Posts: 249
Joined: Tue Oct 04, 2005 6:43 pm
Location: Montgomery, AL

Postby qoncept » Wed Nov 09, 2005 7:25 pm

Just another little update. Pretty much everything present now is functional. You can open, close, save and so forth. I've got problems when you already have an image open and want to open another (it doesn't open multiple windows, what I want it to do is close the one currently open and replace it with another). No big deal, but I'm about ready for bed and I think I've made enough progress for today. Things are going pretty well and I think I may be able to release an alpha version this weekend if anyone wants to test it.

At what point should I start posting in the Users Tuning Software forum?

Just as a note, this is set up right now only for the offsets in the 2004 WRX forum. I'm guessing most ECU versions are the same for these few tables but I haven't looked as I haven't been concerned with that yet. I plan on using XML, or maybe just an INI or serialized object to store offsets for different ECU versions -- is the ECU version stored in the image at all? That would help a lot. Thanks!
Attachments
enginuity091105.JPG
enginuity091105.JPG (103.89 KiB) Viewed 8325 times
qoncept
 
Posts: 249
Joined: Tue Oct 04, 2005 6:43 pm
Location: Montgomery, AL

Postby cboles » Wed Nov 09, 2005 7:47 pm

The software looks great! I'm starting on a map editor too, but you are farther along than I am. I'm mostly working on all of the infrastructure, the UI isn't there yet.

The idea behind the "Users" forum section is that it was for people to talk about utilizing the software from an end-user perspective. Some examples would be:

* usage questions
* bug reports
* release announcements
* tips and techniques

The tech / dev forums should be used for things like

* getting help writing your software
* early beta testing / feedback
* sharing technical info that normal users wouldn't be interested in
* proposing ideas
cboles
Site Admin
 
Posts: 1233
Joined: Wed Dec 29, 2004 5:45 pm
Location: Seattle, WA


Return to Tuning Software

Who is online

Users browsing this forum: No registered users and 8 guests