#include #include #include #include #define bmp_width 128 #define bmp_height 64 static unsigned char bmp_about[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0x18, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0x18, 0xff, 0x7f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0x18, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x1f, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x1f, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0x07, 0x33, 0xfe, 0x01, 0x8f, 0xf8, 0xf0, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0x07, 0x30, 0xfc, 0x01, 0x0c, 0x70, 0xf0, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0x18, 0x03, 0x70, 0xf0, 0x00, 0x0c, 0x60, 0x70, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0x18, 0x63, 0xf0, 0xe0, 0x78, 0x0c, 0x60, 0x7c, 0x3c, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0x18, 0xe3, 0xf0, 0xc1, 0x78, 0x8c, 0x63, 0x78, 0x3c, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0xe3, 0xf1, 0xc7, 0x00, 0x8c, 0xe3, 0x70, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0xe3, 0xf1, 0xc7, 0x00, 0x8e, 0xe3, 0x61, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0xe3, 0xf1, 0xc7, 0xf0, 0x8f, 0xe3, 0x63, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0x03, 0x30, 0xc0, 0x00, 0x8c, 0x63, 0x60, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0x03, 0x30, 0xe0, 0x01, 0x8c, 0x63, 0xe0, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x18, 0x07, 0x32, 0xf0, 0x03, 0x8c, 0x63, 0xf0, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3c, 0xcc, 0x38, 0xe7, 0x8c, 0xa1, 0xeb, 0x8e, 0x71, 0xbe, 0x30, 0x83, 0xff, 0xff, 0xff, 0x7f, 0xbb, 0xb7, 0xd6, 0x5a, 0x6b, 0x3d, 0xe9, 0x6e, 0xad, 0xbd, 0xde, 0xee, 0xff, 0xff, 0xff, 0x7f, 0x38, 0x86, 0x18, 0x7a, 0x68, 0xb1, 0x1a, 0x8f, 0xb1, 0xbd, 0xd8, 0xef, 0xff, 0xff, 0xff, 0x7f, 0xbb, 0xb7, 0xd6, 0x5a, 0x6b, 0xbd, 0xbb, 0xef, 0xb5, 0xb5, 0xde, 0xee, 0xff, 0xff, 0xff, 0x7f, 0xbb, 0xb7, 0xd8, 0x66, 0x8b, 0xa1, 0xbb, 0xef, 0x6d, 0xce, 0x30, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xee, 0xd7, 0x7a, 0xcc, 0x76, 0x9c, 0xb3, 0x87, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xee, 0xd7, 0xfa, 0xb6, 0x74, 0x6b, 0xad, 0xf7, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xf1, 0xd7, 0xfa, 0x86, 0x72, 0x0c, 0xb5, 0xc7, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xfb, 0xd6, 0xfa, 0xb6, 0x76, 0x6b, 0xad, 0xf7, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xfb, 0x39, 0x43, 0xb4, 0x76, 0x6c, 0x25, 0x84, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x62, 0x77, 0x98, 0xb1, 0xcf, 0xf8, 0x9c, 0x33, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x5a, 0x77, 0x6f, 0xad, 0xb7, 0x76, 0x6b, 0xad, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x62, 0x75, 0x0c, 0xb1, 0x87, 0xf8, 0x6d, 0x37, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x6a, 0x72, 0x6f, 0xad, 0xb7, 0xf6, 0x6e, 0xfb, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x5a, 0x77, 0x6f, 0x31, 0xb4, 0x78, 0x98, 0x21, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static unsigned char bmp_big[] = { 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,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,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,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00, 0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, 0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c, 0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xe0,0x03,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x0f,0x00,0x00,0x00,0x00,0xf0,0x01,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x01,0x00,0x00,0x80,0x07,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x3e,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x0f, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0xc0, 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0f, 0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x3e,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xf8,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xe0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xe0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xf8,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x3e,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x80,0x0f,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0xc0,0x03,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x0f,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x3e,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x03, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x01,0x00,0x00,0x80, 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00, 0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0f,0x00, 0x00,0x00,0x00,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x03, 0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0, 0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,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,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,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x00, 0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x01, 0x00,0x00,0x80,0x40,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x01,0x00,0x00,0x80,0x40,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x21,0x71,0xde,0x39,0xde,0xe3,0x39,0x0e,0x1e,0xf1,0x00,0x00,0x00,0x00,0x00, 0x00,0x2f,0x81,0x22,0x46,0xa2,0x40,0x44,0x11,0x22,0x89,0x00,0x00,0x00,0x00, 0x00,0x00,0x21,0xf1,0x22,0x7e,0xa2,0x40,0x44,0x11,0x22,0x89,0x00,0x00,0x00, 0x00,0x00,0x00,0x21,0x89,0x22,0x06,0xa2,0x40,0x44,0x11,0x22,0x89,0x00,0x00, 0x00,0x00,0x00,0x00,0x21,0xf9,0x22,0x7a,0xa2,0xc3,0x39,0x0e,0x1e,0xf1,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x70,0x00,0x00,0x00 }; static unsigned char bmp_small[] = { 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,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,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,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00, 0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, 0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c, 0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xe0,0x03,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x0f,0x00,0x00,0x00,0x00,0xf0,0x01,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x01,0x00,0x00,0x80,0x07,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x3e,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x0f, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0xc0, 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0f, 0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x3e,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xf8,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xe0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xe0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xf8,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x3e,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x80,0x0f,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0xc0,0x03,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x0f,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x3e,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x03, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x01,0x00,0x00,0x80, 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00, 0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0f,0x00, 0x00,0x00,0x00,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x03, 0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0, 0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,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,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,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,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,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,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x78, 0x08,0x00,0x00,0x00,0x04,0x02,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00, 0x08,0x08,0x00,0x00,0x00,0x04,0x02,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00, 0x00,0x08,0x89,0xf3,0xce,0xf1,0x1e,0xcf,0x71,0xf0,0xbc,0x73,0x12,0x00,0x00, 0x00,0x00,0x78,0x09,0x14,0x31,0x12,0x05,0x22,0x8a,0x10,0x44,0x84,0x12,0x00, 0x00,0x00,0x00,0x08,0x89,0x17,0xf1,0x13,0x05,0x22,0x8a,0xe0,0x44,0xf4,0x12, 0x00,0x00,0x00,0x00,0x08,0x49,0x14,0x31,0x10,0x05,0x22,0x8a,0x80,0x44,0x8c, 0x12,0x00,0x00,0x00,0x00,0x08,0xc9,0x17,0xd1,0x13,0x1d,0xce,0x71,0xf0,0x44, 0xfc,0x12,0x00,0x00 }; U8G2_SH1106_128X64_NONAME_F_HW_I2C U8G2(U8G2_R0, 5, 4, U8X8_PIN_NONE); int values[84]; // array for sine values int buffer[84]; // buffer array used to shift sine values void initArrays(void){ // fill arrays for (int i = 0; i < 84; i++){ values[i] = 0; buffer[i] = 0; } } RotaryEncoder encoder(D9,D8); #define pinSW D7 int menu = 1; int pos = 0; int16_t value; int16_t sens1 = 0; int16_t sens2 = 0; int16_t sens3 = 0; int min_s1 = 400; int min_s2 = 400; int min_s3 = 410; int max_s1 = 432; int max_s2 = 434; int max_s3 = 447; bool leaving = false; void setup() { Wire.begin(); U8G2.begin(); initArrays(); pinMode (pinSW,INPUT); pinMode (D8,INPUT); pinMode (D9,INPUT); encoder.setPosition(1); Serial.begin (115200); U8G2.drawXBM(0, 0, bmp_width, bmp_height, bmp_about); U8G2.sendBuffer(); U8G2.clearBuffer(); delay(2000); updateMenu(); } void loop() { updateEncoder(); } void updateEncoder(){ encoder.tick(); menu = encoder.getPosition(); if(pos != menu){ pos = menu; updateMenu(); } if(!digitalRead(pinSW)){ executeAction(); delay(200); updateMenu(); } } int getValue(int sens){ byte a,b; Wire.requestFrom(sens, 2); a = Wire.read(); b = Wire.read(); value = a; value = value << 8 | b; return value; } void graph(){ leaving = false; U8G2.drawVLine(0, 0, 64); // draw Y-axis U8G2.drawHLine(0, 63, 128); // draw X-axis U8G2.drawCircle(108, 20, 19, U8G2_DRAW_ALL); if(!digitalRead(pinSW)){ leaving = true; menu = 0; updateMenu(); } sens1 = map(getValue(2),min_s1,max_s1,0,63); sens2 = map(getValue(3),min_s2,max_s2,0,63); sens3 = map(getValue(4),min_s3,max_s3,0,63); int average = (sens1 + sens2 + sens3) / 3; float r1 = getValue(2)/2; float r2 = getValue(3)/2; float r3 = getValue(4)/2; float rAvg = (r1+r2+r3) /3; float rErr1 = abs(r1-rAvg); float rErr2 = abs(r2-rAvg); float rErr3 = abs(r3-rAvg); float maxErr = max(rErr1, max(rErr2, rErr3)); float round = 100 - maxErr / rAvg * 100; int dia = map(average,0,63,150,200); char cstr[6]; itoa(dia,cstr,10); cstr[3] = cstr[2]; cstr[2] = cstr[1]; cstr[1] = ',' ; cstr[4] = 'm' ; cstr[5] = 'm' ; U8G2.setFont(u8g2_font_t0_11_tr); U8G2.setCursor(90, 60); U8G2.print(cstr); U8G2.setCursor(93,20); U8G2.print(round); U8G2.setFont(u8g2_font_t0_15_te); U8G2.setCursor(104,32); U8G2.print("%"); if(average < -10) { U8G2.clearBuffer(); U8G2.clearDisplay(); while(digitalRead(pinSW)) { U8G2.drawXBM(0, 0, bmp_width, bmp_height, bmp_small); U8G2.sendBuffer(); U8G2.clearBuffer(); } } if(average > 70) { U8G2.clearBuffer(); U8G2.clearDisplay(); while(digitalRead(pinSW)) { U8G2.drawXBM(0, 0, bmp_width, bmp_height, bmp_big); U8G2.sendBuffer(); U8G2.clearBuffer(); } } for (int j = 0 ; j < 84; j++){ values[j] = buffer[j]; // transfer values from buffer to output array U8G2.drawPixel(j+4, 63-values[j]); // draw the sine wave with values from the array shifted 4 pixels to the right } U8G2.sendBuffer(); U8G2.clearBuffer(); for (int x = 0 ; x < 84; x++){ // loop array via buffer if(x-1 < 0){ buffer[x] = average; } else { buffer[x] = values[x-1]; } } } void displaySensors() { if(!digitalRead(pinSW)){ menu = 0; updateMenu(); } U8G2.setFont(u8g2_font_t0_11_tr); U8G2.setCursor(0, 20); U8G2.print("Sensor 1: "); U8G2.setCursor(64, 20); U8G2.print(getValue(2)); U8G2.setCursor(0, 40); U8G2.print("Sensor 2: "); U8G2.setCursor(64, 40); U8G2.print(getValue(3)); U8G2.setCursor(0, 60); U8G2.print("Sensor 3: "); U8G2.setCursor(64, 60); U8G2.print(getValue(4)); U8G2.sendBuffer(); U8G2.clearBuffer(); } void calibrate() { leaving = false; if(!digitalRead(pinSW)){ leaving = true; menu = 0; updateMenu(); } do { U8G2.setFont(u8g2_font_t0_11_tr); U8G2.setFontPosCenter(); U8G2.setCursor(10, 10); U8G2.print("CALIBRATE 1.5mm"); U8G2.setFont(u8g2_font_t0_22_mf); U8G2.setFontPosBaseline(); U8G2.drawButtonUTF8(15, 50, U8G2_BTN_INV, 0, 2, 2, "MIN" ); U8G2.setCursor(65, 50); U8G2.print(getValue(2)); U8G2.sendBuffer(); U8G2.clearBuffer(); } while(digitalRead(pinSW)); min_s1 = getValue(2); min_s2 = getValue(3); min_s3 = getValue(4); delay(500); do { U8G2.setFont(u8g2_font_t0_11_tr); U8G2.setFontPosCenter(); U8G2.setCursor(10, 10); U8G2.print("CALIBRATE 2mm"); U8G2.setFont(u8g2_font_t0_22_mf); U8G2.setFontPosBaseline(); U8G2.drawButtonUTF8(15, 50, U8G2_BTN_INV, 0, 2, 2, "MAX" ); U8G2.setCursor(65, 50); U8G2.print(getValue(2)); U8G2.sendBuffer(); U8G2.clearBuffer(); } while(digitalRead(pinSW)); max_s1 = getValue(2); max_s2 = getValue(3); max_s3 = getValue(4); delay(500); do { U8G2.setFont(u8g2_font_t0_11_tr); U8G2.setCursor(60, 8); U8G2.print("MIN"); U8G2.setCursor(90, 8); U8G2.print("MAX"); U8G2.setCursor(0, 24); U8G2.print("Sensor 1: "); U8G2.setCursor(60, 24); U8G2.print(min_s1); U8G2.setCursor(90, 24); U8G2.print(max_s1); U8G2.setCursor(0, 44); U8G2.print("Sensor 2: "); U8G2.setCursor(60, 44); U8G2.print(min_s2); U8G2.setCursor(90, 44); U8G2.print(max_s2); U8G2.setCursor(0, 64); U8G2.print("Sensor 3: "); U8G2.setCursor(60, 64); U8G2.print(min_s3); U8G2.setCursor(90, 64); U8G2.print(max_s3); U8G2.sendBuffer(); U8G2.clearBuffer(); } while(digitalRead(pinSW)); } void updateMenu() { switch (menu) { case 0: delay(200); menu = 1; encoder.setPosition(1); break; case 1: U8G2.clearDisplay(); U8G2.setFont(u8g2_font_profont22_tr); U8G2.setCursor(0, 25); U8G2.print(">"); U8G2.setCursor(20, 25); U8G2.print("Measure"); U8G2.setCursor(20, 55); U8G2.print("Calibrate"); U8G2.sendBuffer(); break; case 2: U8G2.clearDisplay(); U8G2.setFont(u8g2_font_profont22_tr); U8G2.setCursor(20, 25); U8G2.print("Measure"); U8G2.setCursor(0, 55); U8G2.print(">"); U8G2.setCursor(20, 55); U8G2.print("Calibrate"); U8G2.sendBuffer(); break; case 3: U8G2.clearDisplay(); U8G2.setFont(u8g2_font_profont22_tr); U8G2.setCursor(0, 25); U8G2.print(">"); U8G2.setCursor(20, 25); U8G2.print("Sensors"); U8G2.setCursor(20, 55); U8G2.print("About"); U8G2.sendBuffer(); break; case 4: U8G2.clearDisplay(); U8G2.setFont(u8g2_font_profont22_tr); U8G2.setCursor(20, 25); U8G2.print("Sensors"); U8G2.setCursor(0, 55); U8G2.print(">"); U8G2.setCursor(20, 55); U8G2.print("About"); U8G2.sendBuffer(); break; case 5: menu = 4; encoder.setPosition(4); break; } } void executeAction() { switch (menu) { case 0: U8G2.clearDisplay(); delay(500); updateMenu(); break; case 1: U8G2.clearDisplay(); delay(500); while(digitalRead(pinSW) && !leaving) { graph(); } break; case 2: U8G2.clearDisplay(); delay(500); while(digitalRead(pinSW) && !leaving) { calibrate(); } break; case 3: U8G2.clearDisplay(); delay(500); while(digitalRead(pinSW) && !leaving) { displaySensors(); } break; case 4: U8G2.clearDisplay(); delay(500); while(digitalRead(pinSW) && !leaving){ U8G2.drawXBM(0, 0, bmp_width, bmp_height, bmp_about); U8G2.sendBuffer(); U8G2.clearBuffer(); } break; } }