[solved] TilemapRamino example

Understanding the language, error messages, etc.

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 10:00 pm

So it should be:
20, 15, 16, 16,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 10:02 pm

That should work
Edit: Did it work?
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 10:05 pm

Yes I meant uint16_t and not uint1_t lol
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 10:16 pm

Does it work with 20x15 tile maps??
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby Duhjoker » Sat May 27, 2017 10:54 pm

Sorry i could have swore the post said any thing related to 320 and 240 must be int1_t. Ive been looking at code for days!!!!

Yep thats how i have it

Still cuts off the last five vertical rows.

Im starting to think its something more. If i try to print a full resolution 320x420 bitmap, arduino gives me errors asking for a smaller image but still gives me erreor messages from the size.

Sorry had to step away for a second. I missed a couple things re-trying and sending pic plus sketch in next post.

Please give me a minute i messed some thing up some how and i cant upload. Working as fast as i can to correct the mistake
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 10:58 pm

Ok no problem
Edit: a 320x420 bitmap is way too large for a 320x240 screen
Edit: I'm pretty much certain there is some problem within the drawTilemap() function
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 11:04 pm

Will printing just one bitmap in the empty five columns work?
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 11:33 pm

So how is it going?
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby Duhjoker » Sun May 28, 2017 1:20 am

Ok I got in a hurry and forgot some things and had to step away again. I brought the library back up and double tested every thing you wanted me try but I still get the same problem.

If I draw just a single bitmap image to the right it does show up.

I've been on the pjrc forum for a while and have been told that the code is complicated. Today KurtE said to look at the math. Specifically the beginning and end of where ddx and ddy and all that.

Remember it specifically written for a Nokia 5110. So it might only be showing as much as it was written draw. May need to add some extra + and - to those parts
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: TilemapRamino example

Postby Duhjoker » Sun May 28, 2017 1:23 am

Quoted from KurtE AT PJRC teensy......

But if it were me, I would start looking at some of the simple math... What I mean is, when you see lines in the code like:
writePixel(x+i, y, pgm_read_word(&bitmap[j * w + i]));

What are the values/ranges of the variables: J, w, i that you are using?
Could it be when you are using your larger images, that maybe the system is using 16 bit math and when J is large enough j*w > 65535? And so it wraps around?

What happens if you change these variables from int16 to int32? Or maybe do a cast to uint32_t in the math cases like this?

Sometimes you run into issues if you have math like z = (x*y*z)/t if the code first does the x*y*z and it overflows, to where you need to rework the equation...

I am suspecting you are running into those types of issues.

Edit: suppose that display is 320x240 (ili9341) = 76800 which is > 65536

How many lines or rows fit in 16 bits?
65536/320 = 204+ so about 35+ rows will wrap...
65536/240 = 273+ so about 46+ will rap.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

PreviousNext

Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 15 guests

cron