#include "U8glib.h"
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);
//IKONY*********************************************
// 'dino_splash', 128x64px
const unsigned char dino_splash [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00,
0x08, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x60, 0x00, 0x00, 0x00,
0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00,
0x3f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00,
0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00,
0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xff, 0xff, 0xfe, 0x00,
0x20, 0xfe, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xff, 0xff, 0xfe, 0x00,
0x21, 0x83, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xc1, 0x00, 0x06, 0x00,
0x23, 0x01, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0xc0, 0x80, 0x07, 0x00,
0x22, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0xc0, 0x7c, 0x07, 0x80,
0x23, 0x8c, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0f, 0xff, 0xcf, 0xff, 0xe0,
0x23, 0xac, 0x88, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x08, 0x0f, 0xff, 0xe7, 0xff, 0xe0,
0x22, 0x01, 0x88, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x08, 0x03, 0xe0, 0x7c, 0x0f, 0x80,
0x23, 0x07, 0x88, 0x00, 0x1e, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x08, 0x01, 0xc0, 0x10, 0x07, 0x00,
0x21, 0x57, 0x08, 0x00, 0x1e, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x08, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x21, 0xfe, 0x08, 0x00, 0x1f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x20, 0x00, 0x08, 0x00, 0x1f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x20, 0x00, 0x08, 0x00, 0x1f, 0xff, 0xf8, 0x30, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x20, 0x00, 0x08, 0x00, 0x1f, 0xff, 0xf8, 0x78, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x3f, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xf8, 0x30, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xf0, 0x48, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x48, 0x00, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x84, 0x00, 0x00, 0x13, 0x80, 0xc0, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x84, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x84, 0x00, 0x00, 0x1d, 0x70, 0xc0, 0x00, 0x06, 0x00,
0x00, 0x04, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x84, 0x00, 0x00, 0x19, 0x30, 0xdf, 0xff, 0xf6, 0x00,
0x00, 0x04, 0x00, 0x00, 0xff, 0x80, 0x00, 0x84, 0x00, 0x00, 0x31, 0x18, 0xc4, 0x38, 0x46, 0xf8,
0x00, 0x06, 0x00, 0x03, 0xff, 0x80, 0x00, 0x84, 0x70, 0x00, 0x3e, 0xf8, 0xce, 0x28, 0xe6, 0x88,
0x00, 0x06, 0x00, 0x0f, 0xff, 0x80, 0x00, 0x84, 0x20, 0x00, 0x31, 0x18, 0xc0, 0x38, 0x06, 0x88,
0x00, 0x07, 0x80, 0x3f, 0xff, 0xf0, 0x00, 0x84, 0x70, 0x00, 0x19, 0x30, 0xc0, 0x10, 0x06, 0x88,
0x00, 0x07, 0x80, 0x7f, 0xff, 0xf8, 0x00, 0x84, 0x78, 0x00, 0x1d, 0x71, 0xff, 0xff, 0xff, 0x88,
0x00, 0x07, 0xe0, 0xff, 0xff, 0x98, 0x00, 0x87, 0xfa, 0xaa, 0xaf, 0xe1, 0xff, 0xff, 0xff, 0xf8,
0x00, 0x07, 0xe1, 0xff, 0xff, 0x98, 0x00, 0x78, 0x70, 0x00, 0x03, 0x81, 0xc0, 0x00, 0x07, 0x00,
0x00, 0x07, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
0x00, 0x07, 0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
0x00, 0x03, 0xff, 0xff, 0xff, 0x00, 0x01, 0xc0, 0x38, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x03, 0xc0,
0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x01, 0x80, 0x18, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0xc0,
0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x7f, 0xff, 0xfe, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x7f, 0xff, 0xfc, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x1f, 0xff, 0xf8, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x1f, 0xff, 0xf8, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0xf9, 0xe0, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0xf9, 0xe0, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0xe0, 0x60, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0xe0, 0x60, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0x80, 0x60, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0x80, 0x60, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x01, 0xf8, 0x78, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x00, 0xf8, 0x38, 0x00, 0x01, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'dino_c', 14x3px
const unsigned char epd_bitmap_dino_c [] PROGMEM = {
0xfc, 0x30, 0x7c, 0x30, 0x00, 0x3c
};
// 'dino_a', 14x3px
const unsigned char epd_bitmap_dino_a [] PROGMEM = {
0xc0, 0x3c, 0xc0, 0x1c, 0xfc, 0x00
};
// 'dino_b', 14x3px
const unsigned char epd_bitmap_dino_b [] PROGMEM = {
0xc0, 0x30, 0xfc, 0x3c, 0x7c, 0x1c
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 96)
const int epd_bitmap_allArray_LEN = 3;
const unsigned char* epd_bitmap_allArray[3] = {
epd_bitmap_dino_a,
epd_bitmap_dino_b,
epd_bitmap_dino_c
};
// 'icon_dashboard', 16x16px
const unsigned char icon_dashboard [] PROGMEM = {
0x07, 0xe0, 0x18, 0x18, 0x21, 0x24, 0x50, 0x02, 0x48, 0x0a, 0x84, 0x01, 0x83, 0x81, 0xa2, 0x45,
0x82, 0x41, 0x81, 0x81, 0xa0, 0x05, 0x40, 0x02, 0x4b, 0xd2, 0x23, 0xc4, 0x18, 0x18, 0x07, 0xe0
};
// 'paska', 16x16px
const unsigned char icon_paska [] PROGMEM = {
0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0xff, 0xff, 0x80, 0x01, 0x40, 0x02, 0x20, 0x04,
0x20, 0x04, 0x40, 0x02, 0x80, 0x01, 0xff, 0xff, 0x00, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0
};
// 'teplomer', 16x16px
const unsigned char icon_teplomer [] PROGMEM = {
0x00, 0x0e, 0x00, 0x11, 0x00, 0x21, 0x00, 0x51, 0x00, 0x82, 0x01, 0x44, 0x02, 0x08, 0x05, 0x10,
0x08, 0x20, 0x14, 0x40, 0x10, 0x80, 0x19, 0x00, 0x3e, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x00
};
// 'zamek', 16x16px
const unsigned char icon_zamek [] PROGMEM = {
0x00, 0x00, 0x07, 0xe0, 0x0c, 0x30, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10, 0x3f, 0xfc, 0x7f, 0xfe,
0x7e, 0x7e, 0x7c, 0x3e, 0x7c, 0x3e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7f, 0xfe, 0x3f, 0xfc
};
// 'zamek_unl', 16x16px
const unsigned char icon_zamek_unl [] PROGMEM = {
0x07, 0xe0, 0x0c, 0x30, 0x08, 0x10, 0x08, 0x10, 0x08, 0x00, 0x08, 0x00, 0x3f, 0xfc, 0x7f, 0xfe,
0x7e, 0x7e, 0x7c, 0x3e, 0x7c, 0x3e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7f, 0xfe, 0x3f, 0xfc
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 192)
const unsigned char* bitmap_icons[5] = {
icon_dashboard,
icon_paska,
icon_teplomer,
icon_zamek,
icon_zamek_unl
};
//END_IKONY*********************************************
//SEZNAM CHYB*********************************************
const int size_pole_chyb = 10;
char kody_chyb_text [size_pole_chyb][20] = {
{"Moc pomala rotace"},
{"Moc rychla rotace"},
{"Moc vysoka teplota"},
{"Moc nizka teplota"},
{"Nemozna sirka pasku"}
};
int kody_chyb [8];
//END_SEZNAM CHYB*********************************************
int numbero = 88;
int numbero2 = 69;
int teplota = 240;
int teplota2 = 240;
bool error_flag = false;
void draw_intro() {
u8g.drawBitmapP( 0, 0, 128/8, 64, dino_splash);
}
void draw_main_screen() {
int a = 0;
int b = 0;
if (teplota < 10){a = 14;}else if (teplota < 100){a = 7;} else{a = 0;}
if (teplota2 < 10){b = 14;}else if (teplota2 < 100){b = 7;} else{b = 0;}
u8g.setFont(u8g_font_9x18Br);
u8g.drawStr(20, 10, "Filamentor");
u8g.drawHLine(0, 11, 128);
u8g.drawHLine(0, 55, 128);
u8g.setFont(u8g_font_7x14r);
u8g.setPrintPos(20+a,27);
u8g.print(teplota);
u8g.drawStr(42, 27, "'C");
u8g.setPrintPos((20+60+b),27);
u8g.print(teplota2);
u8g.drawStr(42+60, 27, "'C");
u8g.setPrintPos(20,(27+23));
u8g.print(numbero);
u8g.drawStr(35, 27+23, "rpm");
u8g.setPrintPos((20+60),(27+23));
u8g.print(numbero2);
u8g.drawStr(35+60, 27+23, "mm");
u8g.drawBitmapP( 0, 14, 16/8, 16, bitmap_icons[2]);
u8g.drawBitmapP( 0, 37, 16/8, 16, bitmap_icons[0]);
u8g.drawBitmapP( 60, 14, 16/8, 16, bitmap_icons[2]);
u8g.drawBitmapP( 60, 37, 16/8, 16, bitmap_icons[1]);
}
void draw_error(void){
u8g.setFont(u8g_font_9x18Br);
u8g.drawStr(20, 10, "ERROR List");
u8g.drawFrame(0,11,126,53);
u8g.drawBitmapP( 2, 12, 16/8, 16, bitmap_icons[2]);
}
void setup(void) {
u8g.setColorIndex(1); // set the color to white
u8g.firstPage();
do {
u8g.drawBitmapP( 0, 0, 128/8, 64, dino_splash);
} while( u8g.nextPage() );
delay(500);
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
if (!error_flag){draw_main_screen();}
else{draw_error();}
} while( u8g.nextPage() );
teplota = random(200);
teplota2 = random(200);
// rebuild the picture after some delay
delay(300);
}