Post by graaaeme10 on May 11, 2020 18:50:10 GMT -8
Hi there, I have converted some images using gd3asset.exe, added the .gd2 file to an sd card and included the .h in the sketch as per the instructions.
However when loading up the GD2 the screen shows Cannot open file: assets2.gd2
I have used the SD card to run the example sketches and run the selftest and all works fine. The .gd2 file is the only file on the SD and it has had a fresh format. Going back to the example files the card works again.
The same assets in flash memory work fine.
Here is the assets2.h:
And I include the assets and load them as below:
Any ideas?
Thanks
However when loading up the GD2 the screen shows Cannot open file: assets2.gd2
I have used the SD card to run the example sketches and run the selftest and all works fine. The .gd2 file is the only file on the SD and it has had a fresh format. Going back to the example files the card works again.
The same assets in flash memory work fine.
Here is the assets2.h:
// This file was generated with the command-line:
// F:\Graeme\Documents\Arduino\gd_tests\gd3asset.exe -3 -f assets2.gd2 -o assets2.h roundbginner.png roundbgouter.png roundgradient.png
#define ROUNDBGINNER_HANDLE 0
#define ROUNDBGINNER_WIDTH 140
#define ROUNDBGINNER_HEIGHT 140
#define ROUNDBGINNER_CELLS 1
#define ROUNDBGOUTER_HANDLE 1
#define ROUNDBGOUTER_WIDTH 140
#define ROUNDBGOUTER_HEIGHT 140
#define ROUNDBGOUTER_CELLS 1
#define ROUNDGRADIENT_HANDLE 2
#define ROUNDGRADIENT_WIDTH 140
#define ROUNDGRADIENT_HEIGHT 140
#define ROUNDGRADIENT_CELLS 1
#define ASSETS_END 117600UL
#define LOAD_ASSETS() (GD.safeload("assets2.gd2"), GD.loadptr = ASSETS_END)
static const shape_t ROUNDBGINNER_SHAPE = {0, 140, 140, 0};
static const shape_t ROUNDBGOUTER_SHAPE = {1, 140, 140, 0};
static const shape_t ROUNDGRADIENT_SHAPE = {2, 140, 140, 0};
struct {
Bitmap roundbginner;
Bitmap roundbgouter;
Bitmap roundgradient;
} bitmaps = {
/* roundbginner */ {{140, 140}, { 70, 70}, 0x0UL, 6, 0},
/* roundbgouter */ {{140, 140}, { 70, 70}, 0x9920UL, 6, 1},
/* roundgradient */ {{140, 140}, { 70, 70}, 0x13240UL, 6, 2}
};
And I include the assets and load them as below:
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>
#include "assets2.h"
void setup()
{
GD.begin(0);
LOAD_ASSETS();
}
Any ideas?
Thanks