cant read bmx wheel .dat files
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

cant read bmx wheel .dat files

by cdfps on Sat Jul 19, 2008 3:47 pm

I just assembled three spokPOV's and a usb programmer and they work fine.

Work fine = I can read images out of the memory and put images into memory using the drawing tool in spokPOV.exe and by loading images.
I ran each spokePOV on a bike wheel and they showed correctly.

My problem.

I cannot open .dat files I created. I just get an error about a 30 linear file and spokePOV program set to 22. My spokePOV program (v1.4) is set to usb / BMX wheel / 4" hub / 500 delay.

I import an image, write it to the spokePOV, verify it, then save it. All seems to go well. I do this for all four banks on the first spokePOV.

I disconnect, and connect to the second spokePOV. I select bank 1, then try and open the file I just created for that image and I get the error.

I checked the files with a hex editor and the following information.

256 pixles per revolution, 22 or 30 lines on the spokePOV.

There should be 7680 for a 30 LED spokePOV, and for the file I got 7696 for the biohazard .dat file included with the sample images. There appears to be a header which accounts for the 16 difference in size.

There should then be 5632 + 16 (5648) for a 22 LED spokePOV file, which the hex editor confirmed that there was in the files I created.

If I can't get this running, the only work around I can think of is trying to line things up by eye which I cannot imagine will work very well.
Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

by kayrock66 on Sun Jul 20, 2008 3:19 am

I had a similar problem on some short sticks I built up for a wheel with a large hub motor. I ended up just telling the software that they were full size wheels and importing the BMP files keeping in mind that the inner 8 pixels would cropped off. The SpokePOV units themselves have no way of knowing that they're short. Adjust the hub size in the software to minimize the distortion. Or create your own 30 led .dat files outside of the PC client software and import them for upload to the wheels.

Probably the reason this bug persists is that the few people with short units eventually figure out to just tell the software that they're long.
Last edited by kayrock66 on Mon Jul 21, 2008 10:06 am, edited 1 time in total.
Posts: 150
Joined: Tue Oct 09, 2007 1:06 am

more on the .dat file saga

by cdfps on Sun Jul 20, 2008 2:21 pm

It seems that at least one thing that is happening is that the data file doesn't get written properly for the BMX / 22 led dat file.

I looked at the source for the error and found that it is generated in line 156 of wheelpanel.cpp which looks like this. (a few extra lines for context)

int leds = dis->Read8(); // basically the size
155 if (leds != num_leds) {
156 wxMessageBox(wxString::Format("This file has %d linear pixels (LEDs), while this SpokePOV only supports %d leds", leds, num_leds), "File mismatch", wxICON_HAND|wxOK );
157 return false;
158 }

So I read through what spokePOV was reading in from the .dat file and found that it was looking for a 22 or 30 of hex address 10 in the dat file.

I found a 30 there in a file I created with the spokePOV software set to bmx / 22.


So I changed the value to hex 16 which should be a decimal value of 22.

It sort of worked,but only showed the first 14 "rows" of the wheel, clipping off the rest of the image. The 14 rows that were shown were in the right location.

Back tothe code.
Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

more clues

by cdfps on Sun Jul 20, 2008 3:07 pm

First clue.

Here is a line from wheelpanel.cpp that looks to be the culprit for the 30 rather than 22 in the .dat file

217 dos->Write8(30); // basically the size

I think the 30 should be the num_leds variable maybe.

The second clue is more interesting but I am still working on it. The bmx / 22 .dat files have 2048 (8 rows of 256) at the beginning which is obviously the 8 rows difference between the 22 and 30 settings.

I mentioned that it was only showing the first 14 rows of the file. After looking at the bmx / 22 dat files, it is clear why,..the file ends there.

I am not sure what this means, but it sounds like a loop issue in the write.

Back to Mr. code and Ms. hexeditor
Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

something else (a clue)

by cdfps on Sun Jul 20, 2008 4:03 pm

When drawing on the wheel representation for each of the banks with the spokePOV set to bmx / 22 the mouse doesn't track properly.

As a matter of fact it can only draw the first 14 rows of leds from the center. Just like the 14 rows that it is saving>

Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

Hmmmm II

by cdfps on Sun Jul 20, 2008 4:16 pm

I don't think the model array is the issue.

The part about the drawing tool only writing to the first 14 rows when in BMX / 22 setting is probably directly related to those being the only rows that get written to the file.

Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

Here's what I know.

by cdfps on Sun Jul 20, 2008 4:52 pm

The size of the wheel is not getting written properly to the saved .dat file when spokePOV is in BMX / 22 setting.

The save loop on line 207 in WheelPanel::SaveModel...

220 for (int led = 0; led < num_leds; led++) {
221 for (int row = 0; row < ROWS_PER_WHEEL; row++) {
222 //wxLogDebug("%d %d", led, row);
223 if (model[row][led])
224 dos->Write8(0xff);
225 else
226 dos->Write8(0);
227 }

looks to be fine.

The fact that when in BMX / 22 setting the mouse selects a point exactly
8 in from the location of the pointer leads me to believe that the problem is in the WheelPanel::Draw method.

Time for a run, I'll try again tomorrow.
Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

just downloaded wx-dev-c++ for windows

by cdfps on Sun Jul 27, 2008 11:29 pm

I might as well have at the source I suppose.

I just added the source to a project and found that there were instances of usleep, so I am guessing that the code was compiled on linux/unix/bsd.

I'll add wxwidgets to ubuntu tomorrow.
Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

that was a lot of hard work!

by cdfps on Mon Aug 11, 2008 10:42 pm


I can't believe I have been working on this (on and off) for such a long time.

I FINALLY got a BMXified version of spoke POV.

Turns out the linux route was a bust, I finally got it writing and saving bmx files in the windows environment.

Time flies when you are hypnotized by flashing LED's .
Posts: 10
Joined: Sat Jul 19, 2008 3:27 pm

Please be positive and constructive with your questions and comments.