|
Post by gamer on Jun 12, 2014 7:16:32 GMT -8
Hi,
I am not being able to run the kenney example. It runs only for 3 seconds for me. Is there something to be done with the asset converter?
|
|
|
Post by jamesbowman on Jun 12, 2014 8:20:03 GMT -8
It should run in a loop indefinitely.
Does the "selftest" pass?
|
|
|
Post by gamer on Jun 13, 2014 2:36:02 GMT -8
Yes. It runs in a loop indefinitely. The loop contents are for 2-3 seconds. Is that the expected result?
The selftest passes.
|
|
|
Post by jamesbowman on Jun 13, 2014 6:52:52 GMT -8
The kenney loop is 13s long... it should look like this. One quick thing to check is power. Does a different USB port/cable make a difference? It could be that voltage droop is causing the Arduino to reboot.
|
|
|
Post by gamer on Jun 13, 2014 8:29:39 GMT -8
I tried changing the cable. No change.
I tried debugging by commenting out some code.
static void draw(int t) { int y = 1648 - t; // GD.finish(); long t0 = micros();
// GD.ClearColorRGB(0xd0f4f7); GD.Clear(); GD.cmd_gradient(0, 0, 0xa0a4f7, 0, 272, 0xd0f4f7);
GD.RestoreContext(); GD.BlendFunc(ONE, ONE_MINUS_SRC_ALPHA); GD.Begin(BITMAPS); GD.BitmapHandle(TILES_HANDLE); const PROGMEM prog_uchar *src = layer1_map + (y >> 5) * 15; byte yo = y & 31; for (byte j = 0; j < 10; j++) for (byte i = 0; i < 15; i++) { byte t = pgm_read_byte_near(src++); if (t != 0) { GD.Cell(t - 1); GD.Vertex2f(16 * 32 * i, 16 * ((32 * j) - yo)); } }
GD.swap(); }
With this draw function, the code is in an infinite 2 second loop. That's exactly the background of the output I'm getting with the full code.
Anything to do with this piece of code?
|
|
|
Post by gamer on Jun 13, 2014 8:52:33 GMT -8
Aah..it's not that. In the website, it's void loop() { for (int t = 0; t < 720; t++) { draw(t); } }
In the downloaded code, it was t<100. Solved. Thanks.
|
|