-
• #3
Since it's JS, you can also fake it:
var Graphics = { createArrayBuffer : function(x,y,bpp,flags) { return { buffer : new ArrayBuffer(x*y*bpp >> 3); } }};
... or something like that. Obviously you don't get any graphics functions but if you're happy poking bits and just want to use the existing drivers, that could be an option.
-
• #4
That is alright for a start.
So, if I want to print "X" on my OLED for example. How do I continue with your code?
Will it stay on screen, or do I have to print it over and over?Is this "problem" also for "ILI9163 LCD CONTROLLER" and others?
-
• #5
You would have to set the correct bits up in the arraybuffer
g.buffer
. Maybe:var Graphics = { createArrayBuffer : function(x,y,bpp,flags) { return { buffer : new ArrayBuffer(x*y*bpp >> 3); } }}; var g = require(lcd).connect...; var a = new Uint8Array(g.buffer); a[0] = 0b01000010; a[1] = 0b00100100; a[2] = 0b00011000; a[3] = 0b00100100; a[4] = 0b01000010; g.flip();
There is no way to 'just' draw text at the moment on ESP8266.
If you used a proper Espruino board you wouldn't have that problem as there's a Graphics class with lines, text, etc built-in.
But until someone manages to compile that into ESP8266 you're out of luck.
I'm assuming that the Graphics library isn't included in the build for ESP8266 both from this post by @MaBe and my own testing with an ESP-12 and it returning "Uncaught ReferenceError: "Graphics" is not defined". Perhaps this should be documented on the Espruino on ESP8266 docs page.
If anyone does get a build working with graphics I'd love to know. I'm trying to fit a power supply, ESP8266 and SSD1306 (or some other display) into a light switch in a wall for monitoring server temps and usage, I'm not sure if I can fit one of my original Espruinos in there too.