#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "INA226.h"
#include <EEPROM.h>
INA226 INA(0x40);
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
//#include "BluetoothA2DPSink.h"
int positive_increment_pin = 4;
int negative_reduct_pin = 5;
int select_pin = 33;
int menu = 1;
int selection_settings = 0;
int selection_controls = 0;
// 'menu_selection_1', 128x32px
const unsigned char epd_bitmap_menu_selection_1 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x9f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x90, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x90, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x90, 0x00, 0x1c, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x90, 0x00, 0x38, 0x08, 0x00, 0x02, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x41, 0x86, 0x01,
0x90, 0x00, 0x78, 0x08, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x61, 0x86, 0x01,
0x90, 0x00, 0xf0, 0x08, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x61, 0x86, 0x01,
0x90, 0x01, 0xf0, 0x08, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x63, 0xc6, 0x01,
0x90, 0x03, 0xe0, 0x08, 0x00, 0xda, 0xd8, 0x00, 0x00, 0x3e, 0x60, 0xc0, 0x00, 0x63, 0xc6, 0x01,
0x93, 0xff, 0xff, 0x08, 0x00, 0xda, 0xd8, 0x00, 0x00, 0x38, 0x63, 0xc0, 0x00, 0x67, 0xe6, 0x01,
0x92, 0x07, 0xc1, 0x08, 0x00, 0xda, 0xdb, 0x40, 0x00, 0x30, 0x63, 0xc0, 0x00, 0x67, 0xe6, 0x01,
0x92, 0xef, 0xc1, 0xc8, 0x00, 0xda, 0xdb, 0x40, 0x00, 0x30, 0x63, 0xc0, 0x00, 0xe7, 0xe6, 0x01,
0x92, 0xe7, 0xf1, 0xc8, 0x06, 0xda, 0xdb, 0x40, 0x00, 0x21, 0xe3, 0x80, 0x00, 0xf3, 0xcf, 0x01,
0x92, 0xe3, 0xf1, 0xc8, 0x06, 0xda, 0xdb, 0x40, 0x00, 0x23, 0xe7, 0x80, 0x01, 0xf3, 0x9f, 0x81,
0x92, 0xe3, 0xf1, 0xc8, 0x00, 0xda, 0xdb, 0x40, 0x00, 0x67, 0xe7, 0x00, 0x01, 0xf1, 0x8f, 0x81,
0x92, 0x03, 0xe1, 0xc8, 0x00, 0xda, 0xdb, 0x40, 0x01, 0xe7, 0xe7, 0x00, 0x01, 0xf3, 0x8f, 0x81,
0x93, 0xff, 0xff, 0x88, 0x00, 0xda, 0xdb, 0x00, 0x03, 0xe3, 0xff, 0x00, 0x00, 0xe3, 0x87, 0x01,
0x93, 0xff, 0xff, 0x08, 0x00, 0xda, 0xd8, 0x00, 0x03, 0xe0, 0xff, 0x00, 0x00, 0xe3, 0x86, 0x01,
0x90, 0x0f, 0x00, 0x08, 0x00, 0x1a, 0xd8, 0x00, 0x03, 0xe0, 0x3f, 0x00, 0x00, 0x63, 0x86, 0x01,
0x90, 0x1e, 0x00, 0x08, 0x00, 0x1a, 0xc0, 0x00, 0x03, 0xc0, 0x3e, 0x00, 0x00, 0x63, 0x86, 0x01,
0x90, 0x1c, 0x00, 0x08, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x63, 0x86, 0x01,
0x90, 0x38, 0x00, 0x08, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x61, 0x86, 0x01,
0x90, 0x30, 0x00, 0x08, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x90, 0x30, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x90, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x9f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// 'menu_selection_2', 128x32px
const unsigned char epd_bitmap_menu_selection_2 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x1c, 0x00, 0x10, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x38, 0x00, 0x10, 0x02, 0xc0, 0x08, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x41, 0x86, 0x01,
0x80, 0x00, 0x78, 0x00, 0x10, 0x1a, 0xc0, 0x08, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x61, 0x86, 0x01,
0x80, 0x00, 0xf0, 0x00, 0x10, 0x1a, 0xc0, 0x08, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x61, 0x86, 0x01,
0x80, 0x01, 0xf0, 0x00, 0x10, 0x1a, 0xc0, 0x08, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x63, 0xc6, 0x01,
0x80, 0x03, 0xe0, 0x00, 0x10, 0xda, 0xd8, 0x08, 0x00, 0x3e, 0x60, 0xc0, 0x00, 0x63, 0xc6, 0x01,
0x83, 0xff, 0xff, 0x00, 0x10, 0xda, 0xd8, 0x08, 0x00, 0x38, 0x63, 0xc0, 0x00, 0x67, 0xe6, 0x01,
0x82, 0x07, 0xc1, 0x00, 0x10, 0xda, 0xdb, 0x48, 0x00, 0x30, 0x63, 0xc0, 0x00, 0x67, 0xe6, 0x01,
0x82, 0xef, 0xc1, 0xc0, 0x10, 0xda, 0xdb, 0x48, 0x00, 0x30, 0x63, 0xc0, 0x00, 0xe7, 0xe6, 0x01,
0x82, 0xe7, 0xf1, 0xc0, 0x16, 0xda, 0xdb, 0x48, 0x00, 0x21, 0xe3, 0x80, 0x00, 0xf3, 0xcf, 0x01,
0x82, 0xe3, 0xf1, 0xc0, 0x16, 0xda, 0xdb, 0x48, 0x00, 0x23, 0xe7, 0x80, 0x01, 0xf3, 0x9f, 0x81,
0x82, 0xe3, 0xf1, 0xc0, 0x10, 0xda, 0xdb, 0x48, 0x00, 0x67, 0xe7, 0x00, 0x01, 0xf1, 0x8f, 0x81,
0x82, 0x03, 0xe1, 0xc0, 0x10, 0xda, 0xdb, 0x48, 0x01, 0xe7, 0xe7, 0x00, 0x01, 0xf3, 0x8f, 0x81,
0x83, 0xff, 0xff, 0x80, 0x10, 0xda, 0xdb, 0x08, 0x03, 0xe3, 0xff, 0x00, 0x00, 0xe3, 0x87, 0x01,
0x83, 0xff, 0xff, 0x00, 0x10, 0xda, 0xd8, 0x08, 0x03, 0xe0, 0xff, 0x00, 0x00, 0xe3, 0x86, 0x01,
0x80, 0x0f, 0x00, 0x00, 0x10, 0x1a, 0xd8, 0x08, 0x03, 0xe0, 0x3f, 0x00, 0x00, 0x63, 0x86, 0x01,
0x80, 0x1e, 0x00, 0x00, 0x10, 0x1a, 0xc0, 0x08, 0x03, 0xc0, 0x3e, 0x00, 0x00, 0x63, 0x86, 0x01,
0x80, 0x1c, 0x00, 0x00, 0x10, 0x1a, 0xc0, 0x08, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x63, 0x86, 0x01,
0x80, 0x38, 0x00, 0x00, 0x10, 0x1a, 0xc0, 0x08, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x61, 0x86, 0x01,
0x80, 0x30, 0x00, 0x00, 0x10, 0x02, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x30, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// 'menu_selection_3', 128x32px
const unsigned char epd_bitmap_menu_selection_3 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x1c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x38, 0x00, 0x00, 0x02, 0xc0, 0x00, 0x10, 0x00, 0xe0, 0x08, 0x00, 0x41, 0x86, 0x01,
0x80, 0x00, 0x78, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x10, 0x0f, 0xe0, 0x08, 0x00, 0x61, 0x86, 0x01,
0x80, 0x00, 0xf0, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x10, 0x3f, 0xe0, 0x08, 0x00, 0x61, 0x86, 0x01,
0x80, 0x01, 0xf0, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x10, 0x3f, 0xe0, 0x08, 0x00, 0x63, 0xc6, 0x01,
0x80, 0x03, 0xe0, 0x00, 0x00, 0xda, 0xd8, 0x00, 0x10, 0x3e, 0x60, 0xc8, 0x00, 0x63, 0xc6, 0x01,
0x83, 0xff, 0xff, 0x00, 0x00, 0xda, 0xd8, 0x00, 0x10, 0x38, 0x63, 0xc8, 0x00, 0x67, 0xe6, 0x01,
0x82, 0x07, 0xc1, 0x00, 0x00, 0xda, 0xdb, 0x40, 0x10, 0x30, 0x63, 0xc8, 0x00, 0x67, 0xe6, 0x01,
0x82, 0xef, 0xc1, 0xc0, 0x00, 0xda, 0xdb, 0x40, 0x10, 0x30, 0x63, 0xc8, 0x00, 0xe7, 0xe6, 0x01,
0x82, 0xe7, 0xf1, 0xc0, 0x06, 0xda, 0xdb, 0x40, 0x10, 0x21, 0xe3, 0x88, 0x00, 0xf3, 0xcf, 0x01,
0x82, 0xe3, 0xf1, 0xc0, 0x06, 0xda, 0xdb, 0x40, 0x10, 0x23, 0xe7, 0x88, 0x01, 0xf3, 0x9f, 0x81,
0x82, 0xe3, 0xf1, 0xc0, 0x00, 0xda, 0xdb, 0x40, 0x10, 0x67, 0xe7, 0x08, 0x01, 0xf1, 0x8f, 0x81,
0x82, 0x03, 0xe1, 0xc0, 0x00, 0xda, 0xdb, 0x40, 0x11, 0xe7, 0xe7, 0x08, 0x01, 0xf3, 0x8f, 0x81,
0x83, 0xff, 0xff, 0x80, 0x00, 0xda, 0xdb, 0x00, 0x13, 0xe3, 0xff, 0x08, 0x00, 0xe3, 0x87, 0x01,
0x83, 0xff, 0xff, 0x00, 0x00, 0xda, 0xd8, 0x00, 0x13, 0xe0, 0xff, 0x08, 0x00, 0xe3, 0x86, 0x01,
0x80, 0x0f, 0x00, 0x00, 0x00, 0x1a, 0xd8, 0x00, 0x13, 0xe0, 0x3f, 0x08, 0x00, 0x63, 0x86, 0x01,
0x80, 0x1e, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x13, 0xc0, 0x3e, 0x08, 0x00, 0x63, 0x86, 0x01,
0x80, 0x1c, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x10, 0x00, 0x3e, 0x08, 0x00, 0x63, 0x86, 0x01,
0x80, 0x38, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x10, 0x00, 0x1c, 0x08, 0x00, 0x61, 0x86, 0x01,
0x80, 0x30, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// 'menu_selection_4', 128x32px
const unsigned char epd_bitmap_menu_selection_4 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf9,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x09,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x09,
0x80, 0x00, 0x1c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x09,
0x80, 0x00, 0x38, 0x00, 0x00, 0x02, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x10, 0x41, 0x86, 0x09,
0x80, 0x00, 0x78, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x10, 0x61, 0x86, 0x09,
0x80, 0x00, 0xf0, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x10, 0x61, 0x86, 0x09,
0x80, 0x01, 0xf0, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x10, 0x63, 0xc6, 0x09,
0x80, 0x03, 0xe0, 0x00, 0x00, 0xda, 0xd8, 0x00, 0x00, 0x3e, 0x60, 0xc0, 0x10, 0x63, 0xc6, 0x09,
0x83, 0xff, 0xff, 0x00, 0x00, 0xda, 0xd8, 0x00, 0x00, 0x38, 0x63, 0xc0, 0x10, 0x67, 0xe6, 0x09,
0x82, 0x07, 0xc1, 0x00, 0x00, 0xda, 0xdb, 0x40, 0x00, 0x30, 0x63, 0xc0, 0x10, 0x67, 0xe6, 0x09,
0x82, 0xef, 0xc1, 0xc0, 0x00, 0xda, 0xdb, 0x40, 0x00, 0x30, 0x63, 0xc0, 0x10, 0xe7, 0xe6, 0x09,
0x82, 0xe7, 0xf1, 0xc0, 0x06, 0xda, 0xdb, 0x40, 0x00, 0x21, 0xe3, 0x80, 0x10, 0xf3, 0xcf, 0x09,
0x82, 0xe3, 0xf1, 0xc0, 0x06, 0xda, 0xdb, 0x40, 0x00, 0x23, 0xe7, 0x80, 0x11, 0xf3, 0x9f, 0x89,
0x82, 0xe3, 0xf1, 0xc0, 0x00, 0xda, 0xdb, 0x40, 0x00, 0x67, 0xe7, 0x00, 0x11, 0xf1, 0x8f, 0x89,
0x82, 0x03, 0xe1, 0xc0, 0x00, 0xda, 0xdb, 0x40, 0x01, 0xe7, 0xe7, 0x00, 0x11, 0xf3, 0x8f, 0x89,
0x83, 0xff, 0xff, 0x80, 0x00, 0xda, 0xdb, 0x00, 0x03, 0xe3, 0xff, 0x00, 0x10, 0xe3, 0x87, 0x09,
0x83, 0xff, 0xff, 0x00, 0x00, 0xda, 0xd8, 0x00, 0x03, 0xe0, 0xff, 0x00, 0x10, 0xe3, 0x86, 0x09,
0x80, 0x0f, 0x00, 0x00, 0x00, 0x1a, 0xd8, 0x00, 0x03, 0xe0, 0x3f, 0x00, 0x10, 0x63, 0x86, 0x09,
0x80, 0x1e, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x03, 0xc0, 0x3e, 0x00, 0x10, 0x63, 0x86, 0x09,
0x80, 0x1c, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x10, 0x63, 0x86, 0x09,
0x80, 0x38, 0x00, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x10, 0x61, 0x86, 0x09,
0x80, 0x30, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x09,
0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x09,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x09,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf9,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// 'white_edge', 128x32px
const unsigned char epd_bitmap_white_edge [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 2640)
const int epd_bitmap_allArray_LEN = 5;
const unsigned char* epd_bitmap_allArray[5] = {
epd_bitmap_menu_selection_1,
epd_bitmap_menu_selection_2,
epd_bitmap_menu_selection_3,
epd_bitmap_menu_selection_4,
epd_bitmap_white_edge
};
bool is_active = true;
char metadata[64];
int x, minX;
void(* resetFunc) (void) = 0;
void setup() {
//eeprom saved variables (settings GUI):
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(33, INPUT_PULLUP);
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setTextWrap(false);
display.clearDisplay();
x = display.width();
Wire.begin();
INA.begin();
}
void loop() {
display.clearDisplay();
float batterijspanning = INA.getBusVoltage();
if (digitalRead(positive_increment_pin) == LOW && menu <= 5) {
menu++;
delay(500);
}
if (digitalRead(negative_reduct_pin) == LOW && menu >= 2) {
menu--;
delay(500);
}
/////////////////////////////////////////////////////////////////////////////
if (digitalRead(select_pin) == LOW && menu == 1 ) {
menu = 6;
while (menu == 6) {
float batterijspanning = INA.getBusVoltage();
display.clearDisplay();
display.drawBitmap(0, 0, epd_bitmap_white_edge , 128, 32, WHITE);
display.setTextSize(2);
display.setCursor(12, 8);
display.print(batterijspanning);
display.print("V");
display.display();
Serial.print(menu);
if (digitalRead(negative_reduct_pin) == LOW && menu == 6) {
menu = 1;
delay(500);
}
}
}
////////////////////////////////////////////////////////////////////////////////
if (digitalRead(select_pin) == LOW && menu == 3 ) {
menu = 6;
while (menu == 6) {
display.clearDisplay();
minX = -12 * strlen(metadata); // 12 = 6 pixels/character * text size 2
display.drawBitmap(0, 0, epd_bitmap_white_edge , 128, 32, WHITE);
display.setTextSize(2);
display.setCursor(x, 8);
display.print(metadata);
display.display();
x = x - 1; // scroll speed, make more positive to slow down the scroll
if (x < minX) x = display.width();
if (digitalRead(negative_reduct_pin) == LOW && menu == 6) {
menu = 3;
delay(500);
}
}
}
////////////////////////////////////////////////////////////////////////////
if (digitalRead(select_pin) == LOW && menu == 2 ) {
menu = 6;
while (menu == 6) {
display.clearDisplay();
display.drawBitmap(0, 0, epd_bitmap_white_edge , 128, 32, WHITE);
display.setTextSize(1);
display.setCursor(12, 8);
display.drawTriangle(6, 6, 6, 26, 22, 16, WHITE); //play
display.drawRect(30, 6, 5, 22, WHITE); //pause
display.drawRect(38, 6, 5, 22, WHITE); //pause2
display.drawTriangle(66, 6, 66, 26,50, 16, WHITE); //reverse
display.drawTriangle(82, 6, 82, 26,66, 16, WHITE); //reverse2
display.drawTriangle(90, 6, 90, 26,106, 16, WHITE); //forward
display.drawTriangle(106, 6, 106, 26,122, 16, WHITE); //forward2
display.display();
if (digitalRead(positive_increment_pin) == LOW && menu == 6) {
selection_controls = selection_controls + 1;
delay(500);
}
if (selection_controls == 1) { //play
delay(250);
display.fillTriangle(6, 6, 6, 26, 22, 16, WHITE);
display.display();
delay(250);
if (digitalRead(select_pin) == LOW && selection_controls == 1) {
delay(250);
}
}
if (selection_controls == 2) { //pause
delay(250);
display.fillRect(30, 6, 5, 22, WHITE); //pause
display.fillRect(38, 6, 5, 22, WHITE); //pause2
display.display();
delay(250);
if (digitalRead(select_pin) == LOW && selection_controls == 2) {
}
}
if (selection_controls == 3) { //rewind
delay(250);
display.fillTriangle(66, 6, 66, 26,50, 16, WHITE); //reverse
display.fillTriangle(82, 6, 82, 26,66, 16, WHITE); //reverse2
display.display();
delay(250);
if (digitalRead(select_pin) == LOW && selection_controls == 3) {
}
}
if (selection_controls == 4) { //forward
delay(250);
display.fillTriangle(90, 6, 90, 26,106, 16, WHITE); //forward
display.fillTriangle(106, 6, 106, 26,122, 16, WHITE); //forwward2
display.display();
delay(250);
if (digitalRead(select_pin) == LOW && selection_controls == 4) {
}
}
else if (selection_controls >= 5) {
selection_controls = 1;
}
Serial.print(menu);
if (digitalRead(negative_reduct_pin) == LOW && menu == 6) {
menu = 1;
delay(500);
}
}
}
////////////////////////////////////////////////////////////////////////////
if (digitalRead(select_pin) == LOW && menu >= 4) {
menu = 6;
while (menu == 6) {
display.clearDisplay();
display.drawBitmap(0, 0, epd_bitmap_white_edge , 128, 32, WHITE);
display.setTextSize(1);
display.setCursor(6, 6);
display.print("Restart device");
display.setCursor(6, 18);
display.print("Connection Status");
display.drawRect(114, 4, 10,10, WHITE);
display.drawRect(114, 18, 10,10, WHITE);
display.display();
if (digitalRead(positive_increment_pin) == LOW && menu == 6) {
selection_settings = selection_settings + 1;
delay(500);
}
if (selection_settings == 1) {
delay(250);
display.fillRect(114, 4, 10,10, WHITE);
display.display();
delay(250);
if (digitalRead(select_pin) == LOW && selection_settings == 1) {
display.fillRect(1, 1, 16,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 32,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 48,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 64,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 80,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 96,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 112,32, WHITE);
display.display();
delay(100);
display.fillRect(1, 1, 128,32, WHITE);
display.display();
delay(100);
ESP.restart();
}
}
if (selection_settings == 2) {
delay(250);
display.fillRect(114, 18, 10,10, WHITE);
display.display();
delay(250);
////code for connection status
if (digitalRead(select_pin) == LOW && selection_settings == 2) {
display.print("in progress");
display.display();
}
}
else if (selection_settings >= 3) {
selection_settings = 1;
}
if (digitalRead(negative_reduct_pin) == LOW && menu == 6) {
menu = 4;
selection_settings = 0;
delay(500);
}
}
}
////////////////////////////////////////////////////////////////////////////
if (menu <= 1) {
display.drawBitmap(0, 0, epd_bitmap_menu_selection_1 , 128, 32, WHITE);
display.display();
}
else if (menu == 2) {
display.drawBitmap(0, 0, epd_bitmap_menu_selection_2 , 128, 32, WHITE);
display.display();
}
else if (menu == 3) {
display.drawBitmap(0, 0, epd_bitmap_menu_selection_3 , 128, 32, WHITE);
display.display();
}
else if (menu == 4) {
display.drawBitmap(0, 0, epd_bitmap_menu_selection_4 , 128, 32, WHITE);
display.display();
}
Serial.print(menu);
}