#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); // Fast I2C / TWI


// 'OLED_Menu_by_Upir', 128x64px
const unsigned char epd_bitmap_OLED_Menu_by_Upir [] 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, 0x02, 
	0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x01, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x02, 0x80, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x02, 0x40, 0x50, 0x03, 0xc0, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 
	0x04, 0x20, 0x08, 0x02, 0x20, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 
	0x04, 0x1c, 0x08, 0x02, 0x23, 0x87, 0x1e, 0x3c, 0x38, 0x71, 0x31, 0xe0, 0x00, 0x00, 0x00, 0x00, 
	0x05, 0x12, 0x28, 0x02, 0x24, 0x48, 0x91, 0x22, 0x44, 0x89, 0x42, 0x20, 0x00, 0x00, 0x00, 0x02, 
	0x04, 0x12, 0x08, 0x02, 0x20, 0x48, 0x11, 0x22, 0x44, 0x09, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 
	0x04, 0x0c, 0x08, 0x02, 0x23, 0xc7, 0x11, 0x22, 0x44, 0x79, 0x02, 0x20, 0x00, 0x00, 0x00, 0x02, 
	0x05, 0x00, 0x28, 0x02, 0x24, 0x40, 0x91, 0x22, 0x44, 0x89, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 
	0x02, 0x00, 0x10, 0x02, 0x24, 0x48, 0x91, 0x22, 0x44, 0x89, 0x02, 0x20, 0x00, 0x00, 0x00, 0x02, 
	0x02, 0x5e, 0x90, 0x03, 0xc3, 0xc7, 0x11, 0x3c, 0x38, 0x79, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 
	0x01, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 
	0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 
	0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 
	0x87, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x81, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 
	0x81, 0x28, 0x00, 0x03, 0xe0, 0x00, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x87, 0xc8, 0x08, 0x03, 0x30, 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 
	0x80, 0x04, 0x08, 0x03, 0x31, 0xe3, 0x33, 0x30, 0x30, 0x1e, 0x3e, 0x1e, 0x1e, 0x33, 0x00, 0x30, 
	0x80, 0x64, 0x28, 0x03, 0x33, 0x33, 0x73, 0x60, 0x30, 0x33, 0x33, 0x33, 0x33, 0x37, 0x00, 0x32, 
	0x80, 0x94, 0xa8, 0x03, 0xe0, 0x33, 0x83, 0xc0, 0x1e, 0x33, 0x33, 0x30, 0x33, 0x38, 0x00, 0x30, 
	0x86, 0x94, 0xa8, 0x03, 0x01, 0xf3, 0x03, 0x80, 0x03, 0x3f, 0x33, 0x1e, 0x33, 0x30, 0x00, 0x32, 
	0x80, 0x60, 0x28, 0x03, 0x03, 0x33, 0x03, 0xc0, 0x03, 0x30, 0x33, 0x03, 0x33, 0x30, 0x00, 0x30, 
	0x80, 0x00, 0x08, 0x03, 0x03, 0x33, 0x03, 0x60, 0x33, 0x33, 0x33, 0x33, 0x33, 0x30, 0x00, 0x32, 
	0x80, 0x00, 0x00, 0x03, 0x01, 0xf3, 0x03, 0x30, 0x1e, 0x1e, 0x33, 0x1e, 0x1e, 0x30, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 
	0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x3f, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x00, 0xc0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x02, 0x00, 0x08, 0x03, 0xe0, 0x00, 0x10, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x02, 0x1f, 0x88, 0x00, 0x80, 0x00, 0x10, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x04, 0x22, 0x70, 0x00, 0x84, 0x49, 0x9e, 0x1c, 0x04, 0x07, 0x11, 0x1e, 0x38, 0x00, 0x00, 0x00, 
	0x04, 0x55, 0x00, 0x00, 0x84, 0x4a, 0x11, 0x22, 0x04, 0x08, 0x91, 0x22, 0x44, 0x00, 0x00, 0x02, 
	0x04, 0x49, 0x10, 0x00, 0x84, 0x4c, 0x11, 0x22, 0x04, 0xc0, 0x91, 0x22, 0x44, 0x00, 0x00, 0x00, 
	0x04, 0x55, 0x10, 0x00, 0x84, 0x48, 0x11, 0x22, 0x04, 0x47, 0x91, 0x22, 0x7c, 0x00, 0x00, 0x02, 
	0x04, 0x22, 0x10, 0x00, 0x84, 0x48, 0x11, 0x22, 0x04, 0x48, 0x91, 0x22, 0x40, 0x00, 0x00, 0x00, 
	0x02, 0x1c, 0x20, 0x00, 0x84, 0x48, 0x11, 0x22, 0x04, 0x48, 0x91, 0x1e, 0x44, 0x00, 0x00, 0x02, 
	0x02, 0x00, 0x20, 0x00, 0x83, 0x88, 0x1e, 0x1c, 0x03, 0xc7, 0x8e, 0x02, 0x38, 0x00, 0x00, 0x00, 
	0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 
	0x00, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};


// 'icon_3dcube', 16x16px
const unsigned char epd_bitmap_icon_3dcube [] PROGMEM = {
	0x00, 0x00, 0x01, 0x80, 0x07, 0x60, 0x19, 0x18, 0x61, 0x06, 0x51, 0x0a, 0x45, 0xa2, 0x41, 0x02, 
	0x45, 0x22, 0x41, 0x02, 0x45, 0xa2, 0x51, 0x0a, 0x61, 0x06, 0x19, 0x18, 0x07, 0x60, 0x01, 0x80
};
// 'icon_battery', 16x16px
const unsigned char epd_bitmap_icon_battery [] PROGMEM = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x40, 0x04, 0x5b, 0x66, 0x5b, 0x66, 
	0x5b, 0x66, 0x40, 0x04, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_DB', 16x16px
const unsigned char epd_bitmap_icon_DB [] 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
};
// 'icon_fireworks', 16x16px
const unsigned char epd_bitmap_icon_fireworks [] PROGMEM = {
	0x00, 0x00, 0x00, 0x08, 0x00, 0x94, 0x10, 0x08, 0x10, 0x00, 0x6c, 0x00, 0x10, 0x10, 0x10, 0x10, 
	0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x10, 0x04, 0x10, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00
};
// 'icon_gps_speed', 16x16px
const unsigned char epd_bitmap_icon_gps_speed [] PROGMEM = {
	0x00, 0x00, 0x03, 0xf0, 0x00, 0x08, 0x01, 0xe4, 0x00, 0x12, 0x00, 0xca, 0x06, 0x2a, 0x07, 0x2a, 
	0x07, 0x8a, 0x07, 0xc2, 0x07, 0xc0, 0x0a, 0x00, 0x1f, 0x00, 0x20, 0x80, 0x7f, 0xc0, 0x00, 0x00
};
// 'icon_knob_over_oled', 16x16px
const unsigned char epd_bitmap_icon_knob_over_oled [] PROGMEM = {
	0x00, 0x00, 0x1f, 0xf0, 0x13, 0x50, 0x1b, 0xb0, 0x11, 0x50, 0x1f, 0xf0, 0x03, 0x80, 0x01, 0x00, 
	0x00, 0x00, 0x09, 0x20, 0x49, 0x24, 0x20, 0x08, 0x00, 0x01, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00
};
// 'icon_PS', 16x16px
const unsigned char epd_bitmap_icon_PS [] PROGMEM = {
	0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x22, 0x00, 0x25, 0x00, 0xf9, 0x01, 0x00, 0x81, 0x0c, 0x85, 
	0x12, 0x95, 0xd2, 0x95, 0x0c, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_TG', 16x16px
const unsigned char epd_bitmap_icon_TG [] PROGMEM = {
	0x00, 0x0e, 0x07, 0xf1, 0x18, 0x01, 0x20, 0x01, 0x40, 0x01, 0x43, 0xf1, 0x84, 0x4e, 0x8a, 0xa0, 
	0x89, 0x22, 0x8a, 0xa2, 0x84, 0x42, 0x43, 0x84, 0x40, 0x04, 0x20, 0x08, 0x18, 0x30, 0x07, 0xc0
};

// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 384)
// It is recommended to use the Array names for your commands
const unsigned char* bitmap_icons[8] = {    // "bitmap_icons" can be changed into a different name
	epd_bitmap_icon_3dcube,  
	epd_bitmap_icon_battery,
	epd_bitmap_icon_DB,
	epd_bitmap_icon_fireworks,
	epd_bitmap_icon_gps_speed,
	epd_bitmap_icon_knob_over_oled,
	epd_bitmap_icon_PS,
	epd_bitmap_icon_TG
};


// 'item_sec_background', 128x21px
const unsigned char epd_bitmap_item_sec_background [] PROGMEM = {
	0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
	0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
	0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 
	0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
};
// 'scrollbar_background', 8x64px
const unsigned char epd_bitmap_scrollbar_background [] PROGMEM = {
	0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 
	0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 
	0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 
	0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00
};

#define BUTTON_UP_PIN 12 // pin for up button
#define BUTTON_SELECT_PIN 8 // pin for SELECT button
#define BUTTON_DOWN_PIN 4 // pin for DOWN button

const int NUM_ITEMS = 8;  // 8 bitmap_icons

char menu_items [NUM_ITEMS] [20] = {
	{ "3D Cube" },  //Remember to add "," in every string, except the last one.
	{ "Battery" },
	{ "Dashboard" },
	{ "Fireworks" },
	{ "GPS Speed" },
	{ "Big Knob" },
	{ "Park Sensor" },
	{ "Turbo Gauge" }
};

int item_selected = 0; // which item in the menu is selected
int item_sel_previous; // previous item - item before the selected one
int item_sel_next;     // next item - item after the selected one

void setup() {
	u8g.setColorIndex(1); // set the color to white

	pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
	pinMode(BUTTON_SELECT_PIN, INPUT_PULLUP);
	pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);

  u8g.setFont(u8g_font_tpssb);
  u8g.setColorIndex(1);
}

void loop() {

	if (digitalRead(BUTTON_UP_PIN) == LOW){// UP button is pressed
	  item_selected = item_selected - 1;
		if (item_selected < 0){
			item_selected = NUM_ITEMS - 1;
		}
	}
	if (digitalRead(BUTTON_DOWN_PIN) == LOW){// DOWN button is pressed
	  item_selected = item_selected + 1;
		if (item_selected >= NUM_ITEMS){
			item_selected = 0;
		}
	} 


	item_sel_previous = item_selected - 1; 
	if (item_sel_previous < 0) {item_sel_previous = NUM_ITEMS-1;} // previous item would be below first - make it the last
	item_sel_next = item_selected + 1;
	if (item_sel_next >= NUM_ITEMS) {item_sel_next - 0;} // next time would be after the last - make it the first


  u8g.firstPage(); // required for page drawing mode for u8g library
  do {
    // previous item
		u8g.setFont(u8g_font_7x14);
		u8g.drawStr(26, 15, menu_items[item_sel_previous]);
		u8g.drawBitmapP( 4, 2, 16/8, 16, bitmap_icons[item_sel_previous]);

    // selected item
		u8g.setFont(u8g_font_7x14B);
		u8g.drawStr(26, 37, menu_items[item_selected]);
		u8g.drawBitmapP( 4, 24, 16/8, 16, bitmap_icons[item_selected]);

    // next item
		u8g.setFont(u8g_font_7x14);
		u8g.drawStr(26, 59, menu_items[item_sel_next]);
		u8g.drawBitmapP( 4, 46, 16/8, 16, bitmap_icons[item_sel_next]);

		u8g.drawBitmapP( 0, 22, 128/8, 21, epd_bitmap_item_sec_background);
		u8g.drawBitmapP( 120, 0, 8/8, 64, epd_bitmap_scrollbar_background);

  } while ( u8g.nextPage() );
}