Please see below piece of code.
It prints the value of a variable in x.y format on a line, clears that line 2 seconds later, then writes the variable in x.y format again to the same place on the screen.
First two actions work, the third (most likely) not, because nothing is printed on the screen anymore.
Any ideas what I am doing wrong here, please ?
#include "Ucglib.h"
#define __DC 15
#define __CS 17
#define __RST 14
#define traceDisplay(format, ...)
#define traceError(format, ...)
#include "CacheDisplay.h"
Display ucg(__DC,__CS,__RST);
#define fontTiny ucg_font_9x15_mr
#define fontSmaller ucg_font_10x20_mr
#define fontSmall ucg_font_profont17_mr
#define fontSmall4 ucg_font_courB14_mr
#define fontSmall5 ucg_font_courR10_mr
#define fontMedium ucg_font_inb16_mr
#define fontLarge ucg_font_inb24_mr
#define fontLarger ucg_font_inr33_mr
#define fontHuge ucg_font_inb33_mr
void printmenuid(int menuid)
{
ucg.setFont(fontSmaller); ucg.setColor(0, 255, 255, 0); ucg.setColor(1, 0, 0, 0);
ucg.setPrintPos(3,132);
static const char separator[] = {'.', ' '};
uint8_t ids[] = {(uint8_t)(menuid >> 4), (uint8_t)(menuid & 0xF)};
for(int i = 0; i < 2; i++){
uint8_t id = ids[i];
if(id >= 10){
id -= 10;
ucg.print('1');
}
ucg.print(char('0' + id));
ucg.print(separator[i]);
}
}
void printBlanks(int x, int y)
{
ucg.drawString(x,y,0," ");
}
void clearArea()
{
printBlanks(3,132);
}
void setup()
{
ucg.begin(UCG_FONT_MODE_SOLID);
ucg.clearScreen();
ucg.setRotate90();
int menuid = 0x11;
printmenuid(menuid);
delay(2000);
clearArea();
delay(2000);
printmenuid(menuid);
}
void loop()
{
}