I just try to save a font on SD and read it back.
First I created an array like
font = new Uint8Array(2404); //found this here http://mbed.org/users/dreschpe/code/TFT_fonts/file/76774250fcec/Arial12x12.h
Next assigned Fontdata to this font.
BTW, also tried to write this font as a variable and ran into out of memory.
Saved this to SD by
fs.writefile("font12.txt",font);
fs.writefile("font12.json",JSON.stringify(font));
I can read this by:
t = fs.readFile(filename);
But from this moment on I cannot create a new Uint8Array from the string.
Tried this with both files.
t = JSON.parse(fs.readFile(filename));
t = fs.readFile(filename); f2 = eval(t);
tried to create a new string to be prepared to eval
tried to split the string
and a lot of other combinations
I ran into different problems like
nothing happened
out of memory
total crash, where I had to reset
What I would like to do is:
Read the file, store it to flash and use it from there.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I just try to save a font on SD and read it back.
First I created an array like
font = new Uint8Array(2404); //found this here http://mbed.org/users/dreschpe/code/TFT_fonts/file/76774250fcec/Arial12x12.h
Next assigned Fontdata to this font.
BTW, also tried to write this font as a variable and ran into out of memory.
Saved this to SD by
I can read this by:
t = fs.readFile(filename);
But from this moment on I cannot create a new Uint8Array from the string.
Tried this with both files.
I ran into different problems like
What I would like to do is:
Read the file, store it to flash and use it from there.
Any idea how to do better ?