[2.0.x] Fix problems compiling with Arduino IDE (#10441)

* Fix problems compiling u8glib utf8 support on Arduino
* Change header in auto-generated font data
* Change include in font gen scripts
This commit is contained in:
Chris Pepper 2018-04-17 23:28:55 +01:00 committed by Scott Lahteine
parent 20772492aa
commit 744bcaee61
34 changed files with 52 additions and 52 deletions

View File

@ -20,7 +20,7 @@
*
*/
#include <clib/u8g.h>
#include <U8glib.h>
#if defined(__AVR__) && ENABLED(NOT_EXTENDED_ISO10646_1_5X7)
// reduced font (only sysmbols 1 - 127) - saves about 1278 bytes of FLASH

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_8_144_149[96] U8G_FONT_SECTION("fontpage_8_144_149") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x90,0x95,0x00,0x07,0xff,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_2_140_141[49] U8G_FONT_SECTION("fontpage_2_140_141") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x8c,0x8d,0x00,0x0b,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_7_136_136[31] U8G_FONT_SECTION("fontpage_7_136_136") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x08,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_7_136_136[31] U8G_FONT_SECTION("fontpage_7_136_136") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x08,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_2_135_135[32] U8G_FONT_SECTION("fontpage_2_135_135") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x87,0x87,0x00,0x09,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_97_161_164[61] U8G_FONT_SECTION("fontpage_97_161_164") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa1,0xa4,0x00,0x06,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_2_133_133[31] U8G_FONT_SECTION("fontpage_2_133_133") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x85,0x85,0x00,0x06,0xfe,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data}
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_8_144_152[135] U8G_FONT_SECTION("fontpage_8_144_152") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x90,0x98,0x00,0x07,0xff,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_2_140_143[80] U8G_FONT_SECTION("fontpage_2_140_143") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x8c,0x8f,0x00,0x0b,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_8_128_255[1255] U8G_FONT_SECTION("fontpage_8_128_255") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x00,0x08,0xff,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_2_159_159[34] U8G_FONT_SECTION("fontpage_2_159_159") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x9f,0x9f,0x00,0x09,0xfe,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_8_134_134[30] U8G_FONT_SECTION("fontpage_8_134_134") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x86,0x86,0x00,0x07,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_69_191_191[41] U8G_FONT_SECTION("fontpage_69_191_191") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x0a,0x00,0x00,

View File

@ -2,7 +2,7 @@
/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */
/* Please turn to the tools call this script to change the contents! */
#include <clib/u8g.h>
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_69_191_191[41] U8G_FONT_SECTION("fontpage_69_191_191") = {
0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x0a,0x00,0x00,

View File

@ -7,7 +7,6 @@
* @copyright GPL/BSD
*/
#include "../inc/MarlinConfigPre.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(ULTRA_LCD)

View File

@ -7,25 +7,27 @@
* @copyright GPL/BSD
*/
#include "../inc/MarlinConfig.h"
#if ENABLED(ULTRA_LCD)
#include <string.h>
#include "fontutils.h"
#include "u8g_fontutf8.h"
////////////////////////////////////////////////////////////
#define font_t void
typedef void font_t;
#ifndef PSTR
#define PSTR(a) a
void *
memcpy_from_rom(void *dest, const void * rom_src, size_t sz)
{
void* memcpy_from_rom(void *dest, const void * rom_src, size_t sz) {
uint8_t * p;
uint8_t * s;
FU_ASSERT(NULL != dest);
p = dest;
s = rom_src;
p = (uint8_t*)dest;
s = (uint8_t*)rom_src;
uint8_t c;
while ((p - (uint8_t *)dest) < sz) {
*p = pgm_read_byte(s);
@ -79,7 +81,7 @@ static int pf_bsearch_cb_comp_fntifo_pgm (void *userdata, size_t idx, void *data
uxg_fontinfo_t *fntinfo = (uxg_fontinfo_t*)userdata;
uxg_fontinfo_t localval;
memcpy_from_rom(&localval, fntinfo + idx, sizeof(localval));
return fontinfo_compare(&localval, data_pin);
return fontinfo_compare(&localval, (uxg_fontinfo_t*)data_pin);
}
typedef struct _font_group_t {
@ -95,7 +97,7 @@ static int fontgroup_init(font_group_t * root, const uxg_fontinfo_t * fntinfo, i
}
static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
uxg_fontinfo_t vcmp = {val / 128, val % 128 + 128, val % 128 + 128, 0, 0};
uxg_fontinfo_t vcmp = {(uint16_t)(val / 128), (uint8_t)(val % 128 + 128), (uint8_t)(val % 128 + 128), 0, 0};
size_t idx = 0;
if (val < 256) return NULL;
@ -178,11 +180,11 @@ struct _uxg_drawu8_data_t {
};
static int fontgroup_cb_draw_u8g (void *userdata, const font_t *fnt_current, const char *msg) {
struct _uxg_drawu8_data_t * pdata = userdata;
struct _uxg_drawu8_data_t * pdata = (_uxg_drawu8_data_t*)userdata;
FU_ASSERT(NULL != userdata);
if (pdata->fnt_prev != fnt_current) {
u8g_SetFont(pdata->pu8g, fnt_current);
u8g_SetFont(pdata->pu8g, (const u8g_fntpgm_uint8_t*)fnt_current);
//u8g_SetFontPosBottom(pdata->pu8g);
pdata->fnt_prev = fnt_current;
}
@ -225,7 +227,7 @@ unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t
data.max_width = max_width;
data.fnt_prev = NULL;
fontgroup_drawwchar(group, fnt_default, ch, (void*)&data, fontgroup_cb_draw_u8g);
u8g_SetFont(pu8g, fnt_default);
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
return data.adv;
}
@ -259,7 +261,7 @@ unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const
data.max_width = max_width;
data.fnt_prev = NULL;
fontgroup_drawstring(group, fnt_default, utf8_msg, strlen(utf8_msg), read_byte_ram, (void*)&data, fontgroup_cb_draw_u8g);
u8g_SetFont(pu8g, fnt_default);
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
return data.adv;
}
@ -296,18 +298,18 @@ unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, const
TRACE("call fontgroup_drawstring");
fontgroup_drawstring(group, fnt_default, utf8_msg, my_strlen_P(utf8_msg), read_byte_rom, (void*)&data, fontgroup_cb_draw_u8g);
TRACE("restore font");
u8g_SetFont(pu8g, fnt_default);
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
TRACE("return %d", data.adv);
return data.adv;
}
static int fontgroup_cb_draw_u8gstrlen(void *userdata, const font_t *fnt_current, const char *msg) {
struct _uxg_drawu8_data_t * pdata = userdata;
struct _uxg_drawu8_data_t * pdata = (_uxg_drawu8_data_t*)userdata;
FU_ASSERT(NULL != userdata);
if (pdata->fnt_prev != fnt_current) {
u8g_SetFont(pdata->pu8g, fnt_current);
u8g_SetFont(pdata->pu8g, (const u8g_fntpgm_uint8_t*)fnt_current);
u8g_SetFontPosBottom(pdata->pu8g);
pdata->fnt_prev = fnt_current;
}
@ -339,7 +341,7 @@ int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg) {
data.pu8g = pu8g;
data.adv = 0;
fontgroup_drawstring(group, fnt_default, utf8_msg, strlen(utf8_msg), read_byte_ram, (void*)&data, fontgroup_cb_draw_u8gstrlen);
u8g_SetFont(pu8g, fnt_default);
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
return data.adv;
}
@ -367,6 +369,8 @@ int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg) {
data.pu8g = pu8g;
data.adv = 0;
fontgroup_drawstring(group, fnt_default, utf8_msg, my_strlen_P(utf8_msg), read_byte_rom, (void*)&data, fontgroup_cb_draw_u8gstrlen);
u8g_SetFont(pu8g, fnt_default);
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
return data.adv;
}
#endif // ENABLED(ULTRA_LCD)

View File

@ -9,7 +9,7 @@
#ifndef _UXG_FONTUTF8_H
#define _UXG_FONTUTF8_H 1
#include <clib/u8g.h>
#include <U8glib.h>
#include "fontutils.h"
#ifdef __cplusplus

View File

@ -101,10 +101,7 @@ EOF
#endif
EOF
sed -e 's|#include "u8g.h"|#include <clib/u8g.h>|' -i tmp3.h
cd ..
mv ${DN_WORK}/tmp3.h src/lcd/dogm/dogm_font_data_ISO10646_1.h
fi

View File

@ -154,7 +154,7 @@ echo "/* Generated by $0 */" >> fontutf8-data.h
echo "/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */" >> fontutf8-data.h
echo "/* Please turn to the tools call this script to change the contents! */" >> fontutf8-data.h
echo "" >> fontutf8-data.h
echo "#include <u8g.h>" >> fontutf8-data.h
echo "#include <U8glib.h>" >> fontutf8-data.h
#echo "#include \"fontutf8u8g.h\"" >> fontutf8-data.h
echo "" >> fontutf8-data.h
cat tmpa >> fontutf8-data.h