As mentioned in one of earlier logs, I have implemented OLED drawing capability as a simple interpreter for graphics string commands sent over serial link.
There are now seven commands available:
- STOP - stop processing, string terminator
- STRING, x, y, <string terminated with '\'> - draw string at specified postion
- BOX, x, y, width, height - draw filed rectangle
- FRAME, x, y, width, height - draw rectangular frame
- PIXEL, x, y - draw single pixel
- HLINE, x, y, width - draw horizontal line
- VLINE, x, y, height - draw vertical line
- LINE, x1, y1, x2, y2 - draw line from (x1,y1) to (x2,y2)
Whole graphics string must implement whole scene. The screen is refreshed only when new graphics string is received.
Here is an example of such string:
FRAME 0 0 10 16 FRAME 10 0 10 24 FRAME 0 16 127 16 PIXEL 23 23 STRING 0 32 Line1\
I had just enough memory left to have this implemented with some additional serial debug commands.
Only then I learned about font variants in u8glib and I changed:
u8g.setFont(u8g_font_unifontr);The 'r' version has only glyphs for codes 0x20-0x7f, but that's exactly what I need.
There is again enough of flash memory left to implement a test mode - to have some blinking lights without Python kRPC interface attached.