Fix ESP8266 build (fix #826) and move vectorFonts array out of RAM too

This commit is contained in:
Gordon Williams 2016-03-30 16:37:32 +01:00
parent b57bb7a18e
commit c7dd07e780
3 changed files with 8 additions and 6 deletions

View File

@ -26,7 +26,7 @@
// 48
#define LCD_FONT_4X6_CHARS 95
unsigned short LCD_FONT_4X6[] IN_FLASH_MEMORY = { // from 33 up to 127
const unsigned short LCD_FONT_4X6[] IN_FLASH_MEMORY = { // from 33 up to 127
PACK_5_TO_16( _X_ , X_X , X_X , _X_ , X_X ),
PACK_5_TO_16( _X_ , X_X , XXX , XXX , __X ),
PACK_5_TO_16( _X_ , ___ , X_X , XX_ , _X_ ),

View File

@ -326,8 +326,10 @@ unsigned int graphicsFillVectorChar(JsGraphics *gfx, short x1, short y1, short s
* a 200 byte array) */
int fontOffset = ch-vectorFontOffset;
for (i=0;i<fontOffset;i++)
vertOffset += vectorFonts[i].vertCount;
VectorFontChar vector = vectorFonts[fontOffset];
vertOffset += READ_FLASH_UINT8(&vectorFonts[i].vertCount);
VectorFontChar vector;
vector.vertCount = READ_FLASH_UINT8(&vectorFonts[fontOffset].vertCount);
vector.width = READ_FLASH_UINT8(&vectorFonts[fontOffset].width);
short verts[VECTOR_FONT_MAX_POLY_SIZE*2];
int idx=0;
for (i=0;i<vector.vertCount;i+=2) {
@ -349,8 +351,8 @@ unsigned int graphicsVectorCharWidth(JsGraphics *gfx, short size, char ch) {
NOT_USED(gfx);
if (size<0) return 0;
if (ch<vectorFontOffset || ch-vectorFontOffset>=vectorFontCount) return 0;
VectorFontChar vector = vectorFonts[ch-vectorFontOffset];
return (vector.width * (unsigned int)size)/(VECTOR_FONT_POLY_SIZE*2);
unsigned char width = READ_FLASH_UINT8(&vectorFonts[ch-vectorFontOffset].width);
return (width * (unsigned int)size)/(VECTOR_FONT_POLY_SIZE*2);
}
#endif

View File

@ -2693,7 +2693,7 @@ typedef struct VectorFontChar {
} VectorFontChar;
static const int vectorFontOffset = 32;
static const int vectorFontCount = 95;
static const VectorFontChar vectorFonts[] = {
static const VectorFontChar vectorFonts[] IN_FLASH_MEMORY = {
{69, 0}, // char 32
{63, 18}, // char 33
{87, 16}, // char 34