591 lines
18 KiB
C++
591 lines
18 KiB
C++
#include <TFT_eSPI.h>
|
|
#include "esp_adc_cal.h"
|
|
#include "Button2.h"
|
|
#include "animation.h"
|
|
#include "dndlogo.h"
|
|
|
|
#define ADC_EN 14 //ADC_EN is the ADC detection enable port
|
|
#define ADC_PIN 34
|
|
#define BUTTON_1 35
|
|
#define BUTTON_2 0
|
|
|
|
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
|
Button2 btn1(BUTTON_1);
|
|
Button2 btn2(BUTTON_2);
|
|
|
|
// MENU
|
|
int menuItems[] = { 20, 12, 10, 8, 6, 4, 3, 2 };
|
|
int menuPosition = 0;
|
|
int menuHeight = 20;
|
|
int num_items = sizeof(menuItems) / sizeof(int);
|
|
|
|
String temp;
|
|
char currentPrintOut[10];
|
|
int vref = 1100;
|
|
|
|
bool showing = false;
|
|
byte showingDuration = 2;
|
|
unsigned long lastPush = 0;
|
|
|
|
void setup()
|
|
{
|
|
randomSeed(analogRead(1));
|
|
Serial.begin(115200);
|
|
button_init();
|
|
|
|
tft.init();
|
|
tft.setRotation(1);
|
|
tft.fillScreen(TFT_BLACK);
|
|
tft.setSwapBytes(true);
|
|
tft.pushImage(0, 0, 240, 135, dndlogo);
|
|
tft.setSwapBytes(false);
|
|
espDelay(1000);
|
|
|
|
drawMenu();
|
|
}
|
|
|
|
void showVoltage()
|
|
{
|
|
static uint64_t timeStamp = 0;
|
|
if (millis() - timeStamp > 1000)
|
|
{
|
|
timeStamp = millis();
|
|
uint16_t v = analogRead(ADC_PIN);
|
|
float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
|
|
String voltage = "Voltage :" + String(battery_voltage) + "V";
|
|
tft.fillScreen(TFT_BLACK);
|
|
tft.setTextDatum(BL_DATUM);
|
|
tft.drawString(voltage, tft.width() / 1.5, tft.height());
|
|
}
|
|
}
|
|
|
|
void throwDice()
|
|
{
|
|
tft.fillScreen(TFT_BLACK);
|
|
drawMenu();
|
|
randomSeed(analogRead(1));
|
|
int dice = menuItems[menuPosition];
|
|
int number = random(dice) + 1;
|
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
|
tft.setTextSize(6);
|
|
tft.setTextDatum(MC_DATUM);
|
|
tft.setTextPadding(tft.height());
|
|
tft.drawString(String(number), tft.width() / 2, (tft.height() / 2) + (menuHeight / 2));
|
|
}
|
|
|
|
void drawMenu()
|
|
{
|
|
tft.fillScreen(TFT_BLACK);
|
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
|
tft.setTextSize(2);
|
|
tft.drawRect(0, menuHeight, TFT_HEIGHT, 1, TFT_WHITE);
|
|
|
|
int boxWidth = round(tft.width() / num_items);
|
|
|
|
for (int i = 1; i <= num_items; i++)
|
|
{
|
|
tft.drawFastVLine(i * boxWidth, 0, menuHeight, TFT_WHITE);
|
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
|
tft.setTextSize(2);
|
|
tft.setTextDatum(MC_DATUM);
|
|
tft.setTextPadding(0);
|
|
temp = String(menuItems[i - 1]);
|
|
temp.toCharArray(currentPrintOut, 10);
|
|
tft.drawString(currentPrintOut, (i * boxWidth) - (boxWidth / 2), 10);
|
|
}
|
|
|
|
drawSelectedMenu();
|
|
}
|
|
|
|
int duration = 150;
|
|
void animateThrow() {
|
|
for (size_t i = 0; i < 4; i++)
|
|
{
|
|
tft.drawRect(0, menuHeight + 1, tft.width(), tft.height(), TFT_BLACK);
|
|
tft.fillRect(0, menuHeight + 1, tft.width(), tft.height(), TFT_BLACK);
|
|
diceDrawr();
|
|
espDelay(duration);
|
|
tft.drawRect(0, menuHeight + 1, tft.width(), tft.height(), TFT_BLACK);
|
|
tft.fillRect(0, menuHeight + 1, tft.width(), tft.height(), TFT_BLACK);
|
|
diceDraw();
|
|
espDelay(duration);
|
|
}
|
|
}
|
|
|
|
void drawSelectedMenu()
|
|
{
|
|
int boxWidth = round(tft.width() / num_items);
|
|
|
|
tft.drawRect(menuPosition * boxWidth, 0, boxWidth, menuHeight, TFT_WHITE);
|
|
tft.fillRect(menuPosition * boxWidth, 0, boxWidth, menuHeight, TFT_WHITE);
|
|
|
|
tft.setTextColor(TFT_BLACK, TFT_WHITE);
|
|
tft.setTextDatum(MC_DATUM);
|
|
tft.setTextPadding(0);
|
|
temp = String(menuItems[menuPosition]);
|
|
temp.toCharArray(currentPrintOut, 10);
|
|
tft.drawString(currentPrintOut, ((menuPosition + 1) * boxWidth) - (boxWidth / 2), 10);
|
|
}
|
|
|
|
void drawSelectedDice()
|
|
{
|
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
|
tft.setTextSize(6);
|
|
tft.setTextDatum(MC_DATUM);
|
|
tft.setTextPadding(tft.height());
|
|
temp = "D";
|
|
temp += String(menuItems[menuPosition]);
|
|
temp.toCharArray(currentPrintOut, 10);
|
|
tft.drawString(currentPrintOut, tft.width() / 2, tft.height() / 2);
|
|
}
|
|
|
|
void clearScreen()
|
|
{
|
|
tft.fillScreen(TFT_BLACK);
|
|
drawMenu();
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
button_loop();
|
|
}
|
|
|
|
void button_init()
|
|
{
|
|
// btn1.setLongClickHandler([](Button2 &b)
|
|
// {
|
|
// tft.setSwapBytes(true);
|
|
// tft.pushImage(0, 0, 240, 135, arne);
|
|
// tft.setSwapBytes(false);
|
|
// espDelay(1000);
|
|
// clearScreen();
|
|
// drawMenu();
|
|
// });
|
|
btn1.setPressedHandler([](Button2& b)
|
|
{
|
|
animateThrow();
|
|
throwDice();
|
|
});
|
|
|
|
btn2.setPressedHandler([](Button2& b)
|
|
{
|
|
menuPosition++;
|
|
menuPosition = menuPosition++ % num_items;
|
|
Serial.println(menuPosition, DEC);
|
|
drawMenu();
|
|
// drawSelectedDice();
|
|
// espDelay(1000);
|
|
clearScreen();
|
|
});
|
|
}
|
|
|
|
void button_loop()
|
|
{
|
|
btn1.loop();
|
|
btn2.loop();
|
|
}
|
|
|
|
void espDelay(int ms)
|
|
{
|
|
esp_sleep_enable_timer_wakeup(ms * 1000);
|
|
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
|
esp_light_sleep_start();
|
|
}
|
|
|
|
void diceDraw() {
|
|
temp = String(menuItems[menuPosition]);
|
|
switch(temp.toInt()) {
|
|
case 3:
|
|
case 2:
|
|
static const unsigned char PROGMEM imd2[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x0f, 0xff, 0xf0, 0x00
|
|
, 0x00, 0xe0, 0x00, 0x07, 0x00
|
|
, 0x07, 0x00, 0x00, 0x00, 0xe0
|
|
, 0x0c, 0x00, 0x00, 0x00, 0x30
|
|
, 0x30, 0x00, 0x00, 0x00, 0x0c
|
|
, 0x20, 0x00, 0x00, 0x00, 0x04
|
|
, 0x20, 0x00, 0x00, 0x00, 0x04
|
|
, 0x20, 0x00, 0x00, 0x00, 0x04
|
|
, 0x30, 0x00, 0x00, 0x00, 0x0c
|
|
, 0x38, 0x00, 0x00, 0x00, 0x1c
|
|
, 0x36, 0x00, 0x00, 0x00, 0x6c
|
|
, 0x31, 0xc0, 0x00, 0x03, 0x8c
|
|
, 0x1d, 0xff, 0xc3, 0xfd, 0x38
|
|
, 0x07, 0x86, 0x18, 0x61, 0xe0
|
|
, 0x01, 0xf6, 0x18, 0x6f, 0x80
|
|
, 0x00, 0x1f, 0xff, 0xf8, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd2, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 4:
|
|
static const unsigned char PROGMEM imd4[] = {
|
|
0x00, 0x00, 0x40, 0x00, 0x00
|
|
, 0x00, 0x00, 0xe0, 0x00, 0x00
|
|
, 0x00, 0x01, 0xd8, 0x00, 0x00
|
|
, 0x00, 0x03, 0x8c, 0x00, 0x00
|
|
, 0x00, 0x06, 0x87, 0x00, 0x00
|
|
, 0x00, 0x0c, 0x81, 0x80, 0x00
|
|
, 0x00, 0x18, 0x80, 0xc0, 0x00
|
|
, 0x00, 0x30, 0x00, 0x70, 0x00
|
|
, 0x00, 0x61, 0x00, 0x18, 0x00
|
|
, 0x00, 0xc1, 0x00, 0x0c, 0x00
|
|
, 0x01, 0x81, 0x00, 0x03, 0x00
|
|
, 0x03, 0x00, 0x00, 0x01, 0x80
|
|
, 0x06, 0x02, 0x00, 0x00, 0xe0
|
|
, 0x0c, 0x02, 0x00, 0x00, 0x30
|
|
, 0x18, 0x02, 0x00, 0x00, 0x18
|
|
, 0x0c, 0x02, 0x00, 0x00, 0x0e
|
|
, 0x06, 0x04, 0x00, 0x00, 0xf8
|
|
, 0x01, 0x84, 0x00, 0x1f, 0x00
|
|
, 0x00, 0xc4, 0x03, 0xf0, 0x00
|
|
, 0x00, 0x74, 0x3e, 0x00, 0x00
|
|
, 0x00, 0x1f, 0xc0, 0x00, 0x00
|
|
, 0x00, 0x08, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd4, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 6:
|
|
static const unsigned char PROGMEM imd6[] = {
|
|
0x00, 0x00, 0x38, 0x00, 0x00
|
|
, 0x00, 0x01, 0xcf, 0x00, 0x00
|
|
, 0x00, 0x07, 0x01, 0xc0, 0x00
|
|
, 0x00, 0x3c, 0x00, 0x38, 0x00
|
|
, 0x00, 0xe0, 0x00, 0x07, 0x00
|
|
, 0x03, 0x80, 0x00, 0x00, 0xe0
|
|
, 0x1c, 0x00, 0x00, 0x00, 0x38
|
|
, 0x1c, 0x00, 0x00, 0x00, 0x38
|
|
, 0x19, 0x80, 0x00, 0x01, 0x98
|
|
, 0x18, 0x20, 0x00, 0x06, 0x18
|
|
, 0x18, 0x0c, 0x00, 0x18, 0x18
|
|
, 0x18, 0x01, 0x00, 0x60, 0x18
|
|
, 0x18, 0x00, 0x61, 0x00, 0x18
|
|
, 0x18, 0x00, 0x0c, 0x00, 0x18
|
|
, 0x1c, 0x00, 0x04, 0x00, 0x70
|
|
, 0x07, 0x00, 0x04, 0x01, 0xc0
|
|
, 0x01, 0xe0, 0x04, 0x07, 0x00
|
|
, 0x00, 0x38, 0x04, 0x1c, 0x00
|
|
, 0x00, 0x07, 0x04, 0x30, 0x00
|
|
, 0x00, 0x01, 0xc4, 0xc0, 0x00
|
|
, 0x00, 0x00, 0x3f, 0x00, 0x00
|
|
, 0x00, 0x00, 0x0c, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd6, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 8:
|
|
static const unsigned char PROGMEM imd8[] = {
|
|
0x00, 0x60, 0x00, 0x00, 0x00
|
|
, 0x00, 0xff, 0x80, 0x00, 0x00
|
|
, 0x00, 0xe0, 0x7e, 0x00, 0x00
|
|
, 0x01, 0xa0, 0x01, 0xf8, 0x00
|
|
, 0x01, 0x90, 0x00, 0x07, 0xf0
|
|
, 0x03, 0x10, 0x00, 0x00, 0x1e
|
|
, 0x03, 0x10, 0x00, 0x00, 0x1e
|
|
, 0x06, 0x08, 0x00, 0x00, 0x8c
|
|
, 0x04, 0x08, 0x00, 0x0c, 0x0c
|
|
, 0x0c, 0x08, 0x00, 0x60, 0x18
|
|
, 0x18, 0x04, 0x03, 0x00, 0x18
|
|
, 0x18, 0x04, 0x18, 0x00, 0x30
|
|
, 0x30, 0x04, 0xc0, 0x00, 0x30
|
|
, 0x30, 0x0f, 0x00, 0x00, 0x60
|
|
, 0x60, 0xc0, 0x80, 0x00, 0x40
|
|
, 0x78, 0x00, 0x20, 0x00, 0xc0
|
|
, 0x7e, 0x00, 0x08, 0x01, 0x80
|
|
, 0x03, 0xf8, 0x02, 0x01, 0x80
|
|
, 0x00, 0x0f, 0xc0, 0x83, 0x00
|
|
, 0x00, 0x00, 0x3f, 0x33, 0x00
|
|
, 0x00, 0x00, 0x00, 0xfe, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd8, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 10:
|
|
static const unsigned char PROGMEM imd10[] = {
|
|
0x00, 0x0c, 0x00, 0x00, 0x00
|
|
, 0x00, 0x1f, 0xe0, 0x00, 0x00
|
|
, 0x00, 0x34, 0x3e, 0x00, 0x00
|
|
, 0x00, 0x64, 0x03, 0xe0, 0x00
|
|
, 0x00, 0xc4, 0x00, 0x1e, 0x00
|
|
, 0x01, 0x84, 0x00, 0x01, 0xf0
|
|
, 0x03, 0x80, 0x00, 0x00, 0x1c
|
|
, 0x03, 0x02, 0x00, 0x00, 0x26
|
|
, 0x06, 0x02, 0x00, 0x00, 0x87
|
|
, 0x0c, 0x02, 0x00, 0x01, 0x06
|
|
, 0x18, 0x03, 0x28, 0x02, 0x0c
|
|
, 0x30, 0x08, 0x00, 0x0c, 0x18
|
|
, 0x60, 0x20, 0x00, 0x08, 0x30
|
|
, 0xc0, 0x80, 0x00, 0x08, 0x60
|
|
, 0x7f, 0x00, 0x00, 0x08, 0xc0
|
|
, 0x38, 0xc0, 0x00, 0x09, 0x80
|
|
, 0x0f, 0x98, 0x00, 0x0b, 0x00
|
|
, 0x00, 0x7f, 0x00, 0x13, 0x00
|
|
, 0x00, 0x07, 0xf0, 0x1e, 0x00
|
|
, 0x00, 0x00, 0x3e, 0x1c, 0x00
|
|
, 0x00, 0x00, 0x03, 0xf8, 0x00
|
|
, 0x00, 0x00, 0x00, 0x10, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd10, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 12:
|
|
static const unsigned char PROGMEM imd12[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0xf8, 0x00, 0x00
|
|
, 0x00, 0x07, 0x83, 0xc0, 0x00
|
|
, 0x00, 0x18, 0x30, 0x3c, 0x00
|
|
, 0x00, 0x60, 0x03, 0x03, 0x80
|
|
, 0x01, 0x80, 0x00, 0x70, 0xe0
|
|
, 0x0e, 0x00, 0x00, 0x40, 0xf0
|
|
, 0x18, 0x00, 0x00, 0x80, 0x18
|
|
, 0x38, 0x00, 0x00, 0x80, 0x18
|
|
, 0x68, 0x00, 0x01, 0x00, 0x08
|
|
, 0x64, 0x00, 0x02, 0x00, 0x0c
|
|
, 0x24, 0x00, 0x02, 0x00, 0x0c
|
|
, 0x32, 0x00, 0x04, 0x00, 0x0c
|
|
, 0x32, 0x00, 0x38, 0x00, 0x04
|
|
, 0x11, 0xf0, 0x06, 0x00, 0x0c
|
|
, 0x19, 0x00, 0x01, 0x00, 0x18
|
|
, 0x0d, 0x00, 0x00, 0x80, 0x30
|
|
, 0x07, 0x00, 0x00, 0x20, 0xc0
|
|
, 0x03, 0x00, 0x00, 0x11, 0x80
|
|
, 0x01, 0xc0, 0x00, 0x0f, 0x00
|
|
, 0x00, 0x3e, 0x00, 0x78, 0x00
|
|
, 0x00, 0x01, 0xff, 0x80, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd12, 40, 22, TFT_WHITE);
|
|
break;
|
|
case 20:
|
|
static const unsigned char PROGMEM imd20[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x7f, 0xff, 0xfc, 0x00
|
|
, 0x00, 0xff, 0x80, 0x0e, 0x00
|
|
, 0x01, 0xe0, 0xf8, 0x0f, 0x00
|
|
, 0x03, 0xa0, 0x0f, 0x99, 0x80
|
|
, 0x07, 0x20, 0x00, 0xf8, 0xc0
|
|
, 0x0e, 0x20, 0x01, 0xfe, 0x70
|
|
, 0x1c, 0x20, 0x1f, 0x13, 0xb8
|
|
, 0x38, 0x20, 0xf0, 0x10, 0xfc
|
|
, 0x70, 0x37, 0x80, 0x10, 0x1e
|
|
, 0xff, 0xfc, 0x00, 0x10, 0x07
|
|
, 0x60, 0x7c, 0x00, 0x10, 0x0e
|
|
, 0x30, 0x37, 0x80, 0x10, 0x1c
|
|
, 0x18, 0x20, 0xf0, 0x10, 0x78
|
|
, 0x0c, 0x20, 0x1c, 0x11, 0xf0
|
|
, 0x06, 0x20, 0x07, 0x9f, 0x60
|
|
, 0x03, 0x20, 0x00, 0xfc, 0xc0
|
|
, 0x01, 0xa0, 0x03, 0xf9, 0x80
|
|
, 0x00, 0xe0, 0x7e, 0x1b, 0x00
|
|
, 0x00, 0x7f, 0xe0, 0x0e, 0x00
|
|
, 0x00, 0x3f, 0xff, 0xfc, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd20, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
void diceDrawr() {
|
|
temp = String(menuItems[menuPosition]);
|
|
switch(temp.toInt()) {
|
|
case 3:
|
|
case 2:
|
|
static const unsigned char PROGMEM imd2r[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x0f, 0x80, 0x00
|
|
, 0x00, 0x00, 0x66, 0x60, 0x00
|
|
, 0x00, 0x00, 0x83, 0x30, 0x00
|
|
, 0x00, 0x01, 0x00, 0xb8, 0x00
|
|
, 0x00, 0x02, 0x00, 0xcc, 0x00
|
|
, 0x00, 0x04, 0x00, 0x4c, 0x00
|
|
, 0x00, 0x04, 0x00, 0x6c, 0x00
|
|
, 0x00, 0x08, 0x00, 0x7e, 0x00
|
|
, 0x00, 0x08, 0x00, 0x66, 0x00
|
|
, 0x00, 0x08, 0x00, 0x66, 0x00
|
|
, 0x00, 0x08, 0x00, 0x7e, 0x00
|
|
, 0x00, 0x08, 0x00, 0x66, 0x00
|
|
, 0x00, 0x08, 0x00, 0x44, 0x00
|
|
, 0x00, 0x08, 0x00, 0x7c, 0x00
|
|
, 0x00, 0x04, 0x00, 0x88, 0x00
|
|
, 0x00, 0x04, 0x01, 0x98, 0x00
|
|
, 0x00, 0x02, 0x03, 0xf0, 0x00
|
|
, 0x00, 0x01, 0x06, 0x60, 0x00
|
|
, 0x00, 0x00, 0xcc, 0xc0, 0x00
|
|
, 0x00, 0x00, 0x1f, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd2r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 4:
|
|
static const unsigned char PROGMEM imd4r[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x0e, 0x00, 0x00, 0x00
|
|
, 0x00, 0x3b, 0xe0, 0x00, 0x00
|
|
, 0x00, 0xe0, 0x1f, 0x00, 0x00
|
|
, 0x03, 0x80, 0x01, 0xf0, 0x00
|
|
, 0x0e, 0x00, 0x00, 0x0f, 0x80
|
|
, 0x18, 0x00, 0x00, 0x00, 0xf8
|
|
, 0x38, 0x03, 0xff, 0xff, 0xff
|
|
, 0x18, 0x00, 0x00, 0x00, 0x0e
|
|
, 0x0c, 0x00, 0x00, 0x00, 0x38
|
|
, 0x06, 0x00, 0x00, 0x00, 0xe0
|
|
, 0x03, 0x00, 0x00, 0x01, 0x80
|
|
, 0x01, 0x80, 0x00, 0x06, 0x00
|
|
, 0x00, 0x80, 0x00, 0x18, 0x00
|
|
, 0x00, 0xc0, 0x00, 0x60, 0x00
|
|
, 0x00, 0x60, 0x01, 0x80, 0x00
|
|
, 0x00, 0x30, 0x06, 0x00, 0x00
|
|
, 0x00, 0x18, 0x1c, 0x00, 0x00
|
|
, 0x00, 0x0c, 0x70, 0x00, 0x00
|
|
, 0x00, 0x07, 0xc0, 0x00, 0x00
|
|
, 0x00, 0x03, 0x00, 0x00, 0x00
|
|
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd4r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 6:
|
|
static const unsigned char PROGMEM imd6r[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x03, 0xf8, 0x00, 0x00
|
|
, 0x00, 0x0e, 0x8f, 0xf0, 0x00
|
|
, 0x00, 0x38, 0x40, 0x1c, 0x00
|
|
, 0x00, 0x60, 0x20, 0x06, 0x00
|
|
, 0x01, 0x80, 0x10, 0x03, 0x00
|
|
, 0x06, 0x00, 0x08, 0x01, 0x80
|
|
, 0x1c, 0x00, 0x04, 0x00, 0xc0
|
|
, 0x70, 0x00, 0x02, 0x00, 0x60
|
|
, 0x60, 0x00, 0x01, 0x00, 0x30
|
|
, 0x60, 0x00, 0x00, 0x80, 0x1c
|
|
, 0x30, 0x00, 0x01, 0x8f, 0x0e
|
|
, 0x18, 0x00, 0x06, 0x00, 0x0e
|
|
, 0x0c, 0x00, 0x18, 0x00, 0x1c
|
|
, 0x06, 0x00, 0x60, 0x00, 0x70
|
|
, 0x07, 0x01, 0x80, 0x01, 0xc0
|
|
, 0x03, 0x06, 0x00, 0x07, 0x00
|
|
, 0x01, 0x98, 0x00, 0x1c, 0x00
|
|
, 0x00, 0xf0, 0x00, 0x70, 0x00
|
|
, 0x00, 0x1f, 0xf9, 0xc0, 0x00
|
|
, 0x00, 0x00, 0x0f, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd6r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 8:
|
|
static const unsigned char PROGMEM imd8r[] = {
|
|
0x00, 0x00, 0x07, 0xe0, 0x00
|
|
, 0x00, 0x00, 0x3c, 0xb0, 0x00
|
|
, 0x00, 0x01, 0xe0, 0x98, 0x00
|
|
, 0x00, 0x0f, 0x01, 0x0c, 0x00
|
|
, 0x00, 0x78, 0x01, 0x06, 0x00
|
|
, 0x03, 0xc0, 0x00, 0x03, 0x00
|
|
, 0x1c, 0x00, 0x02, 0x01, 0x80
|
|
, 0xe0, 0x00, 0x02, 0x00, 0xc0
|
|
, 0xc0, 0x00, 0x04, 0x00, 0x70
|
|
, 0xf0, 0x00, 0x04, 0x00, 0x38
|
|
, 0x62, 0x00, 0x04, 0x00, 0x0c
|
|
, 0x30, 0xc0, 0x08, 0x00, 0x06
|
|
, 0x18, 0x18, 0x08, 0x00, 0x03
|
|
, 0x0c, 0x03, 0x10, 0x00, 0x03
|
|
, 0x06, 0x00, 0x70, 0xfe, 0x1f
|
|
, 0x03, 0x00, 0x20, 0x00, 0x78
|
|
, 0x01, 0x80, 0x20, 0x03, 0x80
|
|
, 0x00, 0xc0, 0x40, 0x1c, 0x00
|
|
, 0x00, 0x60, 0x81, 0xe0, 0x00
|
|
, 0x00, 0x31, 0x0f, 0x00, 0x00
|
|
, 0x00, 0x1d, 0x78, 0x00, 0x00
|
|
, 0x00, 0x07, 0x80, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd8r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 10:
|
|
static const unsigned char PROGMEM imd10r[] = {
|
|
0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x7f, 0xff, 0x80
|
|
, 0x07, 0xff, 0x80, 0x31, 0x80
|
|
, 0x0c, 0x00, 0x03, 0x01, 0x80
|
|
, 0x1c, 0x00, 0x18, 0x00, 0xc0
|
|
, 0x18, 0x6b, 0x80, 0x00, 0xc0
|
|
, 0x18, 0x00, 0x80, 0x00, 0xc0
|
|
, 0x0c, 0x00, 0x40, 0x00, 0xe0
|
|
, 0x0c, 0x00, 0x20, 0x00, 0xe0
|
|
, 0x0c, 0x00, 0x20, 0x00, 0xe0
|
|
, 0x04, 0x00, 0x10, 0x00, 0xb0
|
|
, 0x06, 0x00, 0x08, 0x00, 0xb0
|
|
, 0x06, 0x00, 0x04, 0x00, 0xb0
|
|
, 0x02, 0x00, 0x18, 0x70, 0x18
|
|
, 0x03, 0x00, 0x60, 0x00, 0xd8
|
|
, 0x03, 0x01, 0x00, 0x00, 0x58
|
|
, 0x03, 0x04, 0x00, 0x00, 0x70
|
|
, 0x01, 0xb0, 0x00, 0xff, 0xe0
|
|
, 0x01, 0xff, 0xff, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd10r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 12:
|
|
static const unsigned char PROGMEM imd12r[] = {
|
|
0x00, 0x01, 0xc0, 0x00, 0x00
|
|
, 0x00, 0x0f, 0x3f, 0xfc, 0x00
|
|
, 0x00, 0x38, 0x00, 0x07, 0x00
|
|
, 0x01, 0xc0, 0x00, 0x03, 0x80
|
|
, 0x03, 0x80, 0x00, 0x02, 0xe0
|
|
, 0x06, 0x30, 0x00, 0x01, 0x30
|
|
, 0x0c, 0x0c, 0x00, 0x01, 0x10
|
|
, 0x18, 0x01, 0x00, 0x38, 0x98
|
|
, 0x30, 0x00, 0x47, 0x00, 0x4c
|
|
, 0x60, 0x00, 0x30, 0x00, 0x26
|
|
, 0x60, 0x00, 0x20, 0x00, 0x16
|
|
, 0x20, 0x00, 0x20, 0x00, 0x1b
|
|
, 0x30, 0x00, 0x40, 0x00, 0x0e
|
|
, 0x18, 0x00, 0x40, 0x00, 0x0e
|
|
, 0x18, 0x00, 0x40, 0x00, 0x18
|
|
, 0x0c, 0x00, 0x80, 0x00, 0x30
|
|
, 0x06, 0x00, 0x80, 0x00, 0xc0
|
|
, 0x07, 0xfd, 0x80, 0x01, 0x80
|
|
, 0x01, 0xc0, 0x0e, 0x07, 0x00
|
|
, 0x00, 0x3f, 0x00, 0x3c, 0x00
|
|
, 0x00, 0x00, 0xff, 0xf0, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd12r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
case 20:
|
|
static const unsigned char PROGMEM imd20r[] = {
|
|
0x00, 0x00, 0x1f, 0x80, 0x00
|
|
, 0x00, 0x01, 0xfd, 0xe0, 0x00
|
|
, 0x00, 0x1f, 0x38, 0xfc, 0x00
|
|
, 0x00, 0xf0, 0x60, 0x67, 0x00
|
|
, 0x0f, 0x00, 0xc0, 0x30, 0xe0
|
|
, 0x0f, 0x03, 0x80, 0x18, 0x38
|
|
, 0x09, 0xe6, 0x00, 0x0c, 0x0e
|
|
, 0x18, 0x3f, 0x00, 0x06, 0x3c
|
|
, 0x18, 0x3f, 0xff, 0xff, 0xec
|
|
, 0x18, 0x76, 0x00, 0x07, 0x8c
|
|
, 0x18, 0xc6, 0x00, 0x07, 0x8c
|
|
, 0x31, 0x83, 0x00, 0x1c, 0xcc
|
|
, 0x37, 0x01, 0x80, 0x30, 0x58
|
|
, 0x3c, 0x01, 0x80, 0x60, 0x78
|
|
, 0x38, 0x00, 0xc0, 0xc0, 0x78
|
|
, 0x3c, 0x00, 0x63, 0x80, 0x38
|
|
, 0x0f, 0xf0, 0x66, 0x00, 0x38
|
|
, 0x03, 0xdf, 0xfc, 0xff, 0xf0
|
|
, 0x00, 0x70, 0x7f, 0x3f, 0x00
|
|
, 0x00, 0x1e, 0x31, 0xf0, 0x00
|
|
, 0x00, 0x03, 0xff, 0x00, 0x00
|
|
, 0x00, 0x00, 0xf0, 0x00, 0x00
|
|
};
|
|
tft.drawBitmap(tft.width() / 2, (tft.height() / 2) + 1, imd20r, 40, 22, TFT_WHITE); // draw d20
|
|
break;
|
|
default:
|
|
tft.drawString("Yes fout!" + String(menuItems[menuPosition]), 50, 50);
|
|
break;
|
|
}
|
|
|
|
} |