Initial Version

This commit is contained in:
Jens Noack 2021-11-03 17:55:42 +01:00
commit ff64a36e20
16 changed files with 1459 additions and 0 deletions

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

7
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

39
include/README Normal file
View file

@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

147
include/display.h Normal file
View file

@ -0,0 +1,147 @@
#ifndef __display_H__
#define __display_H__
#include "fonts.h"
#include "SSD1306Wire.h"
class display
{
private:
const uint8_t MAX_CONTRAST = 255;
SSD1306Wire * _display;
unsigned int _dispaddr;
size_t _pin_sda, _pin_scl;
void _initDisplay();
public:
display(size_t pin_sda, size_t pin_scl, unsigned int display_addr);
~display();
void header(String title);
void header(String title, bool wificonected, bool localvalues, bool lastdatasent, bool timesynced);
void data(unsigned int x, unsigned int y , float val, String valname);
void data(unsigned int x, unsigned int y , uint64_t val, String valname);
void data(unsigned int x, unsigned int y ,bool valid, String val, String valname, unsigned int digits, String valunit);
void show();
void clear();
};
display::display(size_t pin_sda, size_t pin_scl, unsigned int display_addr)
{
_pin_sda = pin_sda;
_pin_scl = pin_scl;
_dispaddr = display_addr;
_display = new SSD1306Wire(_dispaddr, _pin_sda, _pin_scl);
_initDisplay();
}
display::~display()
{
}
void display::_initDisplay()
{
//initialise OLED and display Welcome Message ...
_display->init();
_display->flipScreenVertically();
_display->setTextAlignment(TEXT_ALIGN_CENTER);
_display->setFont(Roboto_Condensed_Bold_16);
_display->clear();
_display->setContrast(MAX_CONTRAST);
_display->drawString(64, 32, "Itsblue.de");
_display->display();
}
void display::header(String title, bool wificonected, bool localvalues, bool lastdatasent, bool timesynced)
{
_display->setTextAlignment(TEXT_ALIGN_CENTER_BOTH);
_display->setColor(WHITE);
_display->fillRect(0, 1, 128, 12);
_display->setColor(BLACK);
_display->setFont(ArialMT_Plain_10);
unsigned int y = 6;
_display->drawString(64, y, title);
if (wificonected)
{
_display->drawString(110,y, "Y");
}
else
{
_display->drawString(110, y, "!");
}
if (localvalues) {
if (lastdatasent)
{
_display->drawString(120, y, " >>");
}
else
{
_display->drawString(120, y, " x ");
}
} else {
_display->drawString(120, y, " R ");
}
if (timesynced)
{
_display->drawString(10, y, "(<)");
}
else
{
_display->drawString(10, y, "( )");
}
}
void display::header(String title)
{
header(title, false, true, false, false);
}
void display::data(unsigned int x, unsigned int y ,bool valid, String val, String valname, unsigned int digits, String valunit)
{
_display->setColor(WHITE);
_display->setTextAlignment(TEXT_ALIGN_CENTER);
_display->setFont(ArialMT_Plain_10);
String namestring = valname + ":";
_display->drawString(x,y, namestring);
_display->setFont(ArialMT_Plain_16);
String valstring = "";
if (valid == true) {
valstring = val;
}
else
{
for(unsigned int digit=0; digit < digits; digit++){
valstring+="-";
}
}
_display->drawString(x,y+10, valstring);
unsigned int valwidth = _display->getStringWidth(valstring)/2;
_display->setFont(ArialMT_Plain_10);
_display->setTextAlignment(TEXT_ALIGN_LEFT);
_display->drawString(x+valwidth,y+10, valunit);
_display->setTextAlignment(TEXT_ALIGN_CENTER);
}
void display::data(unsigned int x, unsigned int y , uint64_t val, String valname)
{
data(x, y,true, String((unsigned long)val,10), valname, 0, "");
}
void display::data(unsigned int x, unsigned int y , float val, String valname)
{
data(x, y,true, String(val,1), valname, 0, "");
}
void display::show()
{
_display->display();
}
void display::clear()
{
_display->clear();
}
#endif

36
include/eeprom.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef __eeprom_H__
#define __eeprom_H__
#include <TridentTD_ESP32NVS.h>
class eeprom
{
private:
public:
eeprom();
~eeprom();
void set_int(String name , uint64_t val );
uint64_t get_int(String name );
};
eeprom::eeprom()
{
NVS.begin();
}
eeprom::~eeprom()
{
}
void eeprom::set_int(String name , uint64_t val )
{
NVS.setInt(name, val);
}
uint64_t eeprom::get_int(String name )
{
return NVS.getInt(name);
}
#endif

458
include/fonts.h Normal file
View file

@ -0,0 +1,458 @@
// Created by http://oleddisplay.squix.ch/ Consider a donation
// In case of problems make sure that you are using the font file with the correct version!
const uint8_t Roboto_Condensed_Bold_16[] PROGMEM = {
0x0D, // Width: 13
0x13, // Height: 19
0x20, // First Char: 32
0xE0, // Numbers of Chars: 224
// Jump Table:
0xFF, 0xFF, 0x00, 0x04, // 32:65535
0x00, 0x00, 0x08, 0x04, // 33:0
0x00, 0x08, 0x0D, 0x05, // 34:8
0x00, 0x15, 0x16, 0x08, // 35:21
0x00, 0x2B, 0x14, 0x08, // 36:43
0x00, 0x3F, 0x1A, 0x0A, // 37:63
0x00, 0x59, 0x1A, 0x09, // 38:89
0x00, 0x73, 0x04, 0x03, // 39:115
0x00, 0x77, 0x0F, 0x05, // 40:119
0x00, 0x86, 0x0B, 0x05, // 41:134
0x00, 0x91, 0x13, 0x07, // 42:145
0x00, 0xA4, 0x14, 0x08, // 43:164
0x00, 0xB8, 0x09, 0x04, // 44:184
0x00, 0xC1, 0x0E, 0x06, // 45:193
0x00, 0xCF, 0x0B, 0x05, // 46:207
0x00, 0xDA, 0x0D, 0x05, // 47:218
0x00, 0xE7, 0x14, 0x08, // 48:231
0x00, 0xFB, 0x11, 0x08, // 49:251
0x01, 0x0C, 0x14, 0x08, // 50:268
0x01, 0x20, 0x14, 0x08, // 51:288
0x01, 0x34, 0x17, 0x08, // 52:308
0x01, 0x4B, 0x14, 0x08, // 53:331
0x01, 0x5F, 0x14, 0x08, // 54:351
0x01, 0x73, 0x13, 0x08, // 55:371
0x01, 0x86, 0x14, 0x08, // 56:390
0x01, 0x9A, 0x14, 0x08, // 57:410
0x01, 0xAE, 0x0B, 0x04, // 58:430
0x01, 0xB9, 0x0B, 0x04, // 59:441
0x01, 0xC4, 0x11, 0x07, // 60:452
0x01, 0xD5, 0x14, 0x08, // 61:469
0x01, 0xE9, 0x14, 0x07, // 62:489
0x01, 0xFD, 0x11, 0x07, // 63:509
0x02, 0x0E, 0x20, 0x0C, // 64:526
0x02, 0x2E, 0x1D, 0x0A, // 65:558
0x02, 0x4B, 0x17, 0x09, // 66:587
0x02, 0x62, 0x1A, 0x09, // 67:610
0x02, 0x7C, 0x17, 0x09, // 68:636
0x02, 0x93, 0x14, 0x08, // 69:659
0x02, 0xA7, 0x14, 0x08, // 70:679
0x02, 0xBB, 0x17, 0x09, // 71:699
0x02, 0xD2, 0x1A, 0x0A, // 72:722
0x02, 0xEC, 0x08, 0x04, // 73:748
0x02, 0xF4, 0x14, 0x08, // 74:756
0x03, 0x08, 0x1A, 0x09, // 75:776
0x03, 0x22, 0x14, 0x08, // 76:802
0x03, 0x36, 0x20, 0x0C, // 77:822
0x03, 0x56, 0x1A, 0x0A, // 78:854
0x03, 0x70, 0x1A, 0x0A, // 79:880
0x03, 0x8A, 0x17, 0x09, // 80:906
0x03, 0xA1, 0x1A, 0x0A, // 81:929
0x03, 0xBB, 0x1A, 0x09, // 82:955
0x03, 0xD5, 0x17, 0x09, // 83:981
0x03, 0xEC, 0x16, 0x09, // 84:1004
0x04, 0x02, 0x17, 0x09, // 85:1026
0x04, 0x19, 0x19, 0x09, // 86:1049
0x04, 0x32, 0x22, 0x0C, // 87:1074
0x04, 0x54, 0x1A, 0x09, // 88:1108
0x04, 0x6E, 0x19, 0x09, // 89:1134
0x04, 0x87, 0x17, 0x08, // 90:1159
0x04, 0x9E, 0x0C, 0x04, // 91:1182
0x04, 0xAA, 0x11, 0x06, // 92:1194
0x04, 0xBB, 0x09, 0x04, // 93:1211
0x04, 0xC4, 0x11, 0x06, // 94:1220
0x04, 0xD5, 0x12, 0x06, // 95:1237
0x04, 0xE7, 0x0A, 0x05, // 96:1255
0x04, 0xF1, 0x14, 0x08, // 97:1265
0x05, 0x05, 0x14, 0x08, // 98:1285
0x05, 0x19, 0x14, 0x07, // 99:1305
0x05, 0x2D, 0x14, 0x08, // 100:1325
0x05, 0x41, 0x14, 0x08, // 101:1345
0x05, 0x55, 0x0D, 0x05, // 102:1365
0x05, 0x62, 0x15, 0x08, // 103:1378
0x05, 0x77, 0x14, 0x08, // 104:1399
0x05, 0x8B, 0x08, 0x04, // 105:1419
0x05, 0x93, 0x09, 0x04, // 106:1427
0x05, 0x9C, 0x17, 0x08, // 107:1436
0x05, 0xB3, 0x08, 0x04, // 108:1459
0x05, 0xBB, 0x20, 0x0C, // 109:1467
0x05, 0xDB, 0x14, 0x08, // 110:1499
0x05, 0xEF, 0x14, 0x08, // 111:1519
0x06, 0x03, 0x14, 0x08, // 112:1539
0x06, 0x17, 0x15, 0x08, // 113:1559
0x06, 0x2C, 0x0D, 0x05, // 114:1580
0x06, 0x39, 0x14, 0x07, // 115:1593
0x06, 0x4D, 0x0E, 0x05, // 116:1613
0x06, 0x5B, 0x14, 0x08, // 117:1627
0x06, 0x6F, 0x13, 0x07, // 118:1647
0x06, 0x82, 0x1C, 0x0A, // 119:1666
0x06, 0x9E, 0x14, 0x07, // 120:1694
0x06, 0xB2, 0x13, 0x07, // 121:1714
0x06, 0xC5, 0x14, 0x07, // 122:1733
0x06, 0xD9, 0x0C, 0x05, // 123:1753
0x06, 0xE5, 0x09, 0x04, // 124:1765
0x06, 0xEE, 0x0B, 0x05, // 125:1774
0x06, 0xF9, 0x17, 0x09, // 126:1785
0x07, 0x10, 0x0E, 0x06, // 127:1808
0x07, 0x1E, 0x0E, 0x06, // 128:1822
0x07, 0x2C, 0x0E, 0x06, // 129:1836
0x07, 0x3A, 0x0E, 0x06, // 130:1850
0x07, 0x48, 0x0E, 0x06, // 131:1864
0x07, 0x56, 0x0E, 0x06, // 132:1878
0x07, 0x64, 0x0E, 0x06, // 133:1892
0x07, 0x72, 0x0E, 0x06, // 134:1906
0x07, 0x80, 0x0E, 0x06, // 135:1920
0x07, 0x8E, 0x0E, 0x06, // 136:1934
0x07, 0x9C, 0x0E, 0x06, // 137:1948
0x07, 0xAA, 0x0E, 0x06, // 138:1962
0x07, 0xB8, 0x0E, 0x06, // 139:1976
0x07, 0xC6, 0x0E, 0x06, // 140:1990
0x07, 0xD4, 0x0E, 0x06, // 141:2004
0x07, 0xE2, 0x0E, 0x06, // 142:2018
0x07, 0xF0, 0x0E, 0x06, // 143:2032
0x07, 0xFE, 0x0E, 0x06, // 144:2046
0x08, 0x0C, 0x0E, 0x06, // 145:2060
0x08, 0x1A, 0x0E, 0x06, // 146:2074
0x08, 0x28, 0x0E, 0x06, // 147:2088
0x08, 0x36, 0x0E, 0x06, // 148:2102
0x08, 0x44, 0x0E, 0x06, // 149:2116
0x08, 0x52, 0x0E, 0x06, // 150:2130
0x08, 0x60, 0x0E, 0x06, // 151:2144
0x08, 0x6E, 0x0E, 0x06, // 152:2158
0x08, 0x7C, 0x0E, 0x06, // 153:2172
0x08, 0x8A, 0x0E, 0x06, // 154:2186
0x08, 0x98, 0x0E, 0x06, // 155:2200
0x08, 0xA6, 0x0E, 0x06, // 156:2214
0x08, 0xB4, 0x0E, 0x06, // 157:2228
0x08, 0xC2, 0x0E, 0x06, // 158:2242
0x08, 0xD0, 0x0E, 0x06, // 159:2256
0xFF, 0xFF, 0x00, 0x04, // 160:65535
0x08, 0xDE, 0x09, 0x04, // 161:2270
0x08, 0xE7, 0x14, 0x08, // 162:2279
0x08, 0xFB, 0x17, 0x08, // 163:2299
0x09, 0x12, 0x1D, 0x0B, // 164:2322
0x09, 0x2F, 0x16, 0x08, // 165:2351
0x09, 0x45, 0x09, 0x04, // 166:2373
0x09, 0x4E, 0x18, 0x09, // 167:2382
0x09, 0x66, 0x13, 0x08, // 168:2406
0x09, 0x79, 0x23, 0x0D, // 169:2425
0x09, 0x9C, 0x0E, 0x06, // 170:2460
0x09, 0xAA, 0x11, 0x07, // 171:2474
0x09, 0xBB, 0x14, 0x08, // 172:2491
0x09, 0xCF, 0x0E, 0x06, // 173:2511
0x09, 0xDD, 0x23, 0x0D, // 174:2525
0x0A, 0x00, 0x10, 0x07, // 175:2560
0x0A, 0x10, 0x0D, 0x06, // 176:2576
0x0A, 0x1D, 0x14, 0x08, // 177:2589
0x0A, 0x31, 0x0E, 0x05, // 178:2609
0x0A, 0x3F, 0x0D, 0x05, // 179:2623
0x0A, 0x4C, 0x0D, 0x05, // 180:2636
0x0A, 0x59, 0x17, 0x09, // 181:2649
0x0A, 0x70, 0x11, 0x07, // 182:2672
0x0A, 0x81, 0x0B, 0x05, // 183:2689
0x0A, 0x8C, 0x09, 0x04, // 184:2700
0x0A, 0x95, 0x0B, 0x05, // 185:2709
0x0A, 0xA0, 0x10, 0x07, // 186:2720
0x0A, 0xB0, 0x14, 0x07, // 187:2736
0x0A, 0xC4, 0x1D, 0x0A, // 188:2756
0x0A, 0xE1, 0x1D, 0x0B, // 189:2785
0x0A, 0xFE, 0x20, 0x0B, // 190:2814
0x0B, 0x1E, 0x14, 0x07, // 191:2846
0x0B, 0x32, 0x1D, 0x0A, // 192:2866
0x0B, 0x4F, 0x1D, 0x0A, // 193:2895
0x0B, 0x6C, 0x1D, 0x0A, // 194:2924
0x0B, 0x89, 0x1D, 0x0A, // 195:2953
0x0B, 0xA6, 0x1D, 0x0A, // 196:2982
0x0B, 0xC3, 0x1D, 0x0A, // 197:3011
0x0B, 0xE0, 0x26, 0x0D, // 198:3040
0x0C, 0x06, 0x1A, 0x09, // 199:3078
0x0C, 0x20, 0x14, 0x08, // 200:3104
0x0C, 0x34, 0x14, 0x08, // 201:3124
0x0C, 0x48, 0x14, 0x08, // 202:3144
0x0C, 0x5C, 0x16, 0x08, // 203:3164
0x0C, 0x72, 0x08, 0x04, // 204:3186
0x0C, 0x7A, 0x0A, 0x04, // 205:3194
0x0C, 0x84, 0x0A, 0x04, // 206:3204
0x0C, 0x8E, 0x0A, 0x04, // 207:3214
0x0C, 0x98, 0x17, 0x09, // 208:3224
0x0C, 0xAF, 0x1A, 0x0A, // 209:3247
0x0C, 0xC9, 0x1A, 0x0A, // 210:3273
0x0C, 0xE3, 0x1A, 0x0A, // 211:3299
0x0C, 0xFD, 0x1A, 0x0A, // 212:3325
0x0D, 0x17, 0x1A, 0x0A, // 213:3351
0x0D, 0x31, 0x1A, 0x0A, // 214:3377
0x0D, 0x4B, 0x14, 0x08, // 215:3403
0x0D, 0x5F, 0x1A, 0x0A, // 216:3423
0x0D, 0x79, 0x17, 0x09, // 217:3449
0x0D, 0x90, 0x17, 0x09, // 218:3472
0x0D, 0xA7, 0x17, 0x09, // 219:3495
0x0D, 0xBE, 0x17, 0x09, // 220:3518
0x0D, 0xD5, 0x19, 0x09, // 221:3541
0x0D, 0xEE, 0x17, 0x09, // 222:3566
0x0E, 0x05, 0x17, 0x09, // 223:3589
0x0E, 0x1C, 0x14, 0x08, // 224:3612
0x0E, 0x30, 0x14, 0x08, // 225:3632
0x0E, 0x44, 0x14, 0x08, // 226:3652
0x0E, 0x58, 0x14, 0x08, // 227:3672
0x0E, 0x6C, 0x14, 0x08, // 228:3692
0x0E, 0x80, 0x14, 0x08, // 229:3712
0x0E, 0x94, 0x20, 0x0C, // 230:3732
0x0E, 0xB4, 0x14, 0x07, // 231:3764
0x0E, 0xC8, 0x14, 0x08, // 232:3784
0x0E, 0xDC, 0x14, 0x08, // 233:3804
0x0E, 0xF0, 0x14, 0x08, // 234:3824
0x0F, 0x04, 0x14, 0x08, // 235:3844
0x0F, 0x18, 0x08, 0x04, // 236:3864
0x0F, 0x20, 0x0A, 0x04, // 237:3872
0x0F, 0x2A, 0x0A, 0x04, // 238:3882
0x0F, 0x34, 0x0A, 0x04, // 239:3892
0x0F, 0x3E, 0x14, 0x08, // 240:3902
0x0F, 0x52, 0x14, 0x08, // 241:3922
0x0F, 0x66, 0x14, 0x08, // 242:3942
0x0F, 0x7A, 0x14, 0x08, // 243:3962
0x0F, 0x8E, 0x14, 0x08, // 244:3982
0x0F, 0xA2, 0x14, 0x08, // 245:4002
0x0F, 0xB6, 0x14, 0x08, // 246:4022
0x0F, 0xCA, 0x14, 0x08, // 247:4042
0x0F, 0xDE, 0x14, 0x08, // 248:4062
0x0F, 0xF2, 0x14, 0x08, // 249:4082
0x10, 0x06, 0x14, 0x08, // 250:4102
0x10, 0x1A, 0x14, 0x08, // 251:4122
0x10, 0x2E, 0x14, 0x08, // 252:4142
0x10, 0x42, 0x13, 0x07, // 253:4162
0x10, 0x55, 0x14, 0x08, // 254:4181
0x10, 0x69, 0x13, 0x07, // 255:4201
// Font Data:
0x00,0x00,0x00,0xF8,0x6F,0x00,0xF8,0x6F, // 33
0x78,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x18, // 34
0x00,0x04,0x00,0x40,0x44,0x00,0xC0,0x7F,0x00,0xF8,0x05,0x00,0x40,0x7E,0x00,0xF8,0x0F,0x00,0x58,0x04,0x00,0x40, // 35
0x00,0x00,0x00,0xF0,0x38,0x00,0xF8,0x79,0x00,0x98,0xE3,0x01,0x1E,0xE3,0x01,0x78,0x7E,0x00,0x70,0x3E, // 36
0x00,0x00,0x00,0xF8,0x00,0x00,0x88,0x20,0x00,0xF8,0x18,0x00,0x70,0x06,0x00,0x80,0x39,0x00,0x60,0x7C,0x00,0x10,0x44,0x00,0x00,0x7C, // 37
0x00,0x08,0x00,0x60,0x3E,0x00,0xF8,0x7F,0x00,0x98,0x67,0x00,0x98,0x6F,0x00,0xF0,0x7C,0x00,0x20,0x7E,0x00,0x00,0x7E,0x00,0x00,0x40, // 38
0x00,0x00,0x00,0x78, // 39
0x00,0x00,0x00,0xC0,0x7F,0x00,0xF0,0xFF,0x01,0x1C,0x00,0x07,0x08,0x00,0x04, // 40
0x04,0x00,0x04,0x18,0x00,0x03,0xF0,0xFF,0x01,0xC0,0x7F, // 41
0x20,0x00,0x00,0x20,0x01,0x00,0xA0,0x01,0x00,0x78,0x00,0x00,0xE0,0x01,0x00,0x20,0x01,0x00,0x20, // 42
0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0xC0,0x3F,0x00,0xC0,0x3F,0x00,0x00,0x06,0x00,0x00,0x06, // 43
0x00,0x00,0x02,0x00,0xE0,0x03,0x00,0xE0,0x01, // 44
0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06, // 45
0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60, // 46
0x00,0xC0,0x00,0x00,0xFC,0x00,0xC0,0x1F,0x00,0xF8,0x01,0x00,0x18, // 47
0x00,0x00,0x00,0xF0,0x3F,0x00,0xF8,0x7F,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0xF8,0x7F,0x00,0xF0,0x3F, // 48
0x00,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0xF0,0x7F,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 49
0x00,0x00,0x00,0x70,0x70,0x00,0x78,0x78,0x00,0x18,0x7C,0x00,0x18,0x6F,0x00,0xF8,0x63,0x00,0xF0,0x61, // 50
0x00,0x10,0x00,0x30,0x30,0x00,0x38,0x70,0x00,0x98,0x61,0x00,0x98,0x61,0x00,0xF8,0x7F,0x00,0x70,0x3E, // 51
0x00,0x00,0x00,0x00,0x0E,0x00,0x80,0x0F,0x00,0xE0,0x0C,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x00,0x0C, // 52
0x00,0x00,0x00,0xF8,0x31,0x00,0xF8,0x71,0x00,0x98,0x61,0x00,0x98,0x61,0x00,0x98,0x7F,0x00,0x18,0x3F, // 53
0x00,0x00,0x00,0xC0,0x1F,0x00,0xF0,0x7F,0x00,0xB0,0x61,0x00,0x98,0x61,0x00,0x98,0x7F,0x00,0x00,0x3F, // 54
0x00,0x00,0x00,0x18,0x40,0x00,0x18,0x70,0x00,0x18,0x7E,0x00,0x98,0x1F,0x00,0xF8,0x03,0x00,0x78, // 55
0x00,0x00,0x00,0xF0,0x3C,0x00,0xF8,0x7F,0x00,0x18,0x63,0x00,0x18,0x63,0x00,0xF8,0x7F,0x00,0xF0,0x3C, // 56
0x00,0x00,0x00,0xF0,0x03,0x00,0xF8,0x67,0x00,0x18,0x66,0x00,0x18,0x76,0x00,0xF8,0x3F,0x00,0xE0,0x0F, // 57
0x00,0x00,0x00,0x80,0x61,0x00,0x80,0x61,0x00,0x80,0x61, // 58
0x00,0x00,0x02,0x80,0xE1,0x03,0x80,0xE1,0x01,0x80,0x01, // 59
0x00,0x06,0x00,0x00,0x0F,0x00,0x00,0x0F,0x00,0x80,0x1F,0x00,0x80,0x19,0x00,0xC0,0x39, // 60
0x00,0x00,0x00,0x00,0x1B,0x00,0x00,0x1B,0x00,0x00,0x1B,0x00,0x00,0x1B,0x00,0x00,0x1B,0x00,0x00,0x1B, // 61
0x00,0x00,0x00,0xC0,0x39,0x00,0x80,0x19,0x00,0x80,0x1D,0x00,0x00,0x0F,0x00,0x00,0x0F,0x00,0x00,0x06, // 62
0x20,0x00,0x00,0x30,0x00,0x00,0x38,0x6C,0x00,0x18,0x6F,0x00,0xF8,0x43,0x00,0xF0,0x01, // 63
0x00,0x00,0x00,0x80,0xFF,0x00,0xC0,0x80,0x01,0x20,0x1C,0x03,0x10,0x7F,0x02,0x90,0x41,0x02,0x90,0x20,0x02,0x90,0x7F,0x03,0x30,0x41,0x00,0x60,0x40,0x00,0xC0,0x3F, // 64
0x00,0x40,0x00,0x00,0x78,0x00,0x00,0x7F,0x00,0xE0,0x1F,0x00,0xF8,0x18,0x00,0xF8,0x18,0x00,0xE0,0x1F,0x00,0x00,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 65
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x98,0x61,0x00,0x98,0x61,0x00,0x98,0x61,0x00,0xF8,0x7F,0x00,0x70,0x3F, // 66
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF0,0x3F,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0x78,0x78,0x00,0x70,0x38,0x00,0x40,0x08, // 67
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0x38,0x70,0x00,0xF0,0x3F,0x00,0xE0,0x1F, // 68
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x63,0x00,0x18,0x63,0x00,0x18,0x63,0x00,0x18,0x63, // 69
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x03,0x00,0x18,0x03,0x00,0x18,0x03,0x00,0x18,0x03, // 70
0x00,0x00,0x00,0xF0,0x3F,0x00,0xF0,0x3F,0x00,0x18,0x70,0x00,0x18,0x60,0x00,0x18,0x66,0x00,0x78,0x7E,0x00,0x70,0x3E, // 71
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 72
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 73
0x00,0x08,0x00,0x00,0x38,0x00,0x00,0x78,0x00,0x00,0x60,0x00,0x00,0x70,0x00,0xF8,0x3F,0x00,0xF8,0x1F, // 74
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x00,0x07,0x00,0xC0,0x07,0x00,0xF0,0x1F,0x00,0x78,0x7C,0x00,0x18,0x70,0x00,0x08,0x40, // 75
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60, // 76
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0xF8,0x01,0x00,0xE0,0x0F,0x00,0x00,0x7E,0x00,0x00,0x7C,0x00,0xC0,0x1F,0x00,0xF8,0x01,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 77
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x78,0x00,0x00,0xC0,0x03,0x00,0x00,0x0F,0x00,0x00,0x7C,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 78
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF0,0x3F,0x00,0x38,0x70,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0x38,0x70,0x00,0xF0,0x3F,0x00,0xE0,0x1F, // 79
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x06,0x00,0x18,0x06,0x00,0x18,0x06,0x00,0xF8,0x07,0x00,0xF0,0x03, // 80
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF0,0x3F,0x00,0x38,0x70,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0x38,0xF0,0x00,0xF0,0xFF,0x01,0xE0,0x9F, // 81
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x06,0x00,0x18,0x06,0x00,0x18,0x3E,0x00,0xF8,0x7F,0x00,0xF0,0x73,0x00,0x00,0x40, // 82
0x00,0x00,0x00,0xE0,0x38,0x00,0xF0,0x39,0x00,0xB8,0x63,0x00,0x18,0x63,0x00,0x18,0x67,0x00,0x78,0x7E,0x00,0x70,0x3C, // 83
0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18, // 84
0x00,0x00,0x00,0xF8,0x3F,0x00,0xF8,0x7F,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0xF8,0x7F,0x00,0xF8,0x3F, // 85
0x18,0x00,0x00,0xF8,0x00,0x00,0xF8,0x0F,0x00,0x80,0x7F,0x00,0x00,0x70,0x00,0x80,0x7F,0x00,0xF8,0x0F,0x00,0xF8,0x00,0x00,0x18, // 86
0x08,0x00,0x00,0xF8,0x03,0x00,0xF8,0x7F,0x00,0x00,0x7E,0x00,0xC0,0x7F,0x00,0xF8,0x07,0x00,0xF8,0x07,0x00,0xC0,0x7F,0x00,0x00,0x7E,0x00,0xF8,0x7F,0x00,0xF8,0x03,0x00,0x08, // 87
0x08,0x40,0x00,0x38,0x70,0x00,0xF8,0x7C,0x00,0xF0,0x1F,0x00,0x80,0x07,0x00,0xF0,0x3F,0x00,0xF8,0x7C,0x00,0x38,0x70,0x00,0x08,0x40, // 88
0x08,0x00,0x00,0x38,0x00,0x00,0xF8,0x01,0x00,0xC0,0x7F,0x00,0x00,0x7F,0x00,0xE0,0x7F,0x00,0xF8,0x00,0x00,0x38,0x00,0x00,0x08, // 89
0x00,0x00,0x00,0x18,0x70,0x00,0x18,0x7C,0x00,0x18,0x7F,0x00,0xD8,0x67,0x00,0xF8,0x61,0x00,0x78,0x60,0x00,0x18,0x60, // 90
0x00,0x00,0x00,0xFC,0xFF,0x03,0xFC,0xFF,0x03,0x0C,0x00,0x03, // 91
0x08,0x00,0x00,0xF8,0x00,0x00,0xF0,0x07,0x00,0x80,0x3F,0x00,0x00,0xFC,0x00,0x00,0xE0, // 92
0x0C,0x00,0x03,0xFC,0xFF,0x03,0xFC,0xFF,0x03, // 93
0x00,0x01,0x00,0xE0,0x01,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0xE0,0x01,0x00,0x00,0x01, // 94
0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01, // 95
0x08,0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x00,0x10, // 96
0x00,0x00,0x00,0x80,0x39,0x00,0xC0,0x7D,0x00,0xC0,0x6C,0x00,0xC0,0x6C,0x00,0xC0,0x7F,0x00,0x80,0x7F, // 97
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x60,0x00,0xC0,0x7F,0x00,0x80,0x3F, // 98
0x00,0x0E,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x61,0x00,0x80,0x31,0x00,0x00,0x11, // 99
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x60,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 100
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xC0,0x6C,0x00,0xC0,0x6C,0x00,0xC0,0x7F,0x00,0x80,0x2F, // 101
0xC0,0x00,0x00,0xF0,0x7F,0x00,0xF8,0x7F,0x00,0xD8,0x00,0x00,0xD8, // 102
0x00,0x00,0x00,0x80,0x3F,0x01,0xC0,0x7F,0x03,0xC0,0x60,0x03,0xC0,0x60,0x03,0xC0,0xFF,0x03,0xC0,0xFF,0x01, // 103
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x7F,0x00,0x80,0x7F, // 104
0x00,0x00,0x00,0xD8,0x7F,0x00,0xD8,0x7F, // 105
0x00,0x00,0x03,0xD8,0xFF,0x03,0xD8,0xFF,0x01, // 106
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x00,0x0F,0x00,0x80,0x3F,0x00,0xC0,0x79,0x00,0x40,0x60,0x00,0x00,0x40, // 107
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 108
0x00,0x00,0x00,0xC0,0x7F,0x00,0xC0,0x7F,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x7F,0x00,0x80,0x7F,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x7F,0x00,0x80,0x7F, // 109
0x00,0x00,0x00,0xC0,0x7F,0x00,0xC0,0x7F,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x7F,0x00,0x80,0x7F, // 110
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x60,0x00,0xC0,0x7F,0x00,0x80,0x3F, // 111
0x00,0x00,0x00,0xC0,0xFF,0x03,0xC0,0xFF,0x03,0xC0,0x60,0x00,0xC0,0x60,0x00,0xC0,0x7F,0x00,0x80,0x3F, // 112
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x60,0x00,0xC0,0xFF,0x03,0xC0,0xFF,0x03, // 113
0x00,0x00,0x00,0xC0,0x7F,0x00,0xC0,0x7F,0x00,0xC0,0x00,0x00,0xC0, // 114
0x00,0x10,0x00,0x80,0x37,0x00,0xC0,0x77,0x00,0xC0,0x6E,0x00,0xC0,0x7D,0x00,0x80,0x3D,0x00,0x00,0x11, // 115
0xC0,0x00,0x00,0xF0,0x3F,0x00,0xF0,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x60, // 116
0x00,0x00,0x00,0xC0,0x3F,0x00,0xC0,0x7F,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0xC0,0x7F,0x00,0xC0,0x7F, // 117
0xC0,0x00,0x00,0xC0,0x07,0x00,0xC0,0x7F,0x00,0x00,0x70,0x00,0xC0,0x7F,0x00,0xC0,0x07,0x00,0x40, // 118
0xC0,0x00,0x00,0xC0,0x1F,0x00,0x80,0x7F,0x00,0x00,0x7E,0x00,0xC0,0x0F,0x00,0xC0,0x0F,0x00,0x00,0x7E,0x00,0x80,0x7F,0x00,0xC0,0x1F,0x00,0x40, // 119
0x40,0x40,0x00,0xC0,0x71,0x00,0xC0,0x7F,0x00,0x00,0x1F,0x00,0xC0,0x3F,0x00,0xC0,0x79,0x00,0x40,0x40, // 120
0xC0,0x00,0x00,0xC0,0x07,0x03,0xC0,0xFF,0x03,0x00,0xF8,0x01,0xC0,0x7F,0x00,0xC0,0x07,0x00,0x40, // 121
0x00,0x00,0x00,0xC0,0x70,0x00,0xC0,0x7C,0x00,0xC0,0x7E,0x00,0xC0,0x67,0x00,0xC0,0x61,0x00,0xC0,0x60, // 122
0x00,0x00,0x00,0x00,0x1E,0x00,0xF0,0xFF,0x01,0xF8,0xF1,0x03, // 123
0x00,0x00,0x00,0xF8,0xFF,0x01,0xF8,0xFF,0x01, // 124
0x00,0x00,0x00,0xF8,0xF1,0x03,0xF0,0xFF,0x01,0x00,0x1E, // 125
0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x06, // 126
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 127
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 128
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 129
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 130
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 131
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 132
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 133
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 134
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 135
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 136
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 137
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 138
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 139
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 140
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 141
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 142
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 143
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 144
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 145
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 146
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 147
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 148
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 149
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 150
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 151
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 152
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 153
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 154
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 155
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 156
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 157
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 158
0x00,0x00,0x00,0xF8,0x7F,0x00,0x88,0x47,0x00,0xC8,0x5C,0x00,0xF8,0x7F, // 159
0x00,0x00,0x00,0xC0,0xFE,0x03,0xC0,0xFE,0x03, // 161
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xE0,0xE0,0x01,0xE0,0xE0,0x01,0xC0,0x71,0x00,0x80,0x31, // 162
0x00,0x00,0x00,0x00,0x63,0x00,0xF0,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x63,0x00,0x38,0x63,0x00,0x30,0x60,0x00,0x20,0x60, // 163
0x00,0x00,0x00,0xE0,0x7F,0x00,0xC0,0x39,0x00,0xE0,0x70,0x00,0x60,0x60,0x00,0x60,0x60,0x00,0x60,0x60,0x00,0xE0,0x70,0x00,0xC0,0x39,0x00,0xE0,0x7F, // 164
0x08,0x00,0x00,0x38,0x0A,0x00,0xF8,0x0B,0x00,0xE0,0x7F,0x00,0xE0,0x7F,0x00,0xF8,0x0B,0x00,0x38,0x0A,0x00,0x08, // 165
0x00,0x00,0x00,0xF8,0xFB,0x01,0xF8,0xFB,0x01, // 166
0x00,0x00,0x00,0xF0,0x9E,0x03,0xF8,0xBF,0x07,0x98,0x33,0x06,0x18,0x33,0x06,0x38,0x67,0x06,0x70,0xFF,0x07,0x60,0xDE,0x03, // 167
0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18, // 168
0x00,0x00,0x00,0xC0,0x0F,0x00,0x20,0x10,0x00,0x10,0x20,0x00,0xC8,0x4F,0x00,0x28,0x50,0x00,0x28,0x50,0x00,0x68,0x58,0x00,0xD8,0x6C,0x00,0x10,0x20,0x00,0x60,0x18,0x00,0x80,0x07, // 169
0x00,0x00,0x00,0xE8,0x01,0x00,0x28,0x01,0x00,0x28,0x01,0x00,0xF0,0x01, // 170
0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x21, // 171
0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x0E,0x00,0x00,0x0E, // 172
0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06, // 173
0x00,0x00,0x00,0xC0,0x0F,0x00,0x20,0x10,0x00,0x10,0x20,0x00,0xE8,0x4F,0x00,0x28,0x41,0x00,0x28,0x41,0x00,0xE8,0x4F,0x00,0xD0,0x2E,0x00,0x10,0x20,0x00,0x60,0x18,0x00,0x80,0x07, // 174
0x00,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x10, // 175
0x00,0x00,0x00,0x30,0x00,0x00,0x48,0x00,0x00,0x48,0x00,0x00,0x30, // 176
0x00,0x00,0x00,0x00,0x63,0x00,0x00,0x63,0x00,0xE0,0x6F,0x00,0xE0,0x6F,0x00,0x00,0x63,0x00,0x00,0x63, // 177
0x20,0x00,0x00,0x18,0x03,0x00,0x88,0x03,0x00,0xF8,0x02,0x00,0x30,0x02, // 178
0x90,0x01,0x00,0x88,0x03,0x00,0x28,0x02,0x00,0xF8,0x03,0x00,0x90, // 179
0x00,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08, // 180
0x00,0x00,0x00,0xC0,0xFF,0x03,0xC0,0xFF,0x03,0x00,0x70,0x00,0x00,0x60,0x00,0xC0,0x7F,0x00,0xC0,0x7F,0x00,0xC0,0x7F, // 181
0x00,0x00,0x00,0xF0,0x03,0x00,0xF8,0x03,0x00,0xF8,0x07,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 182
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03, // 183
0x00,0x00,0x00,0x00,0x80,0x05,0x00,0x80,0x07, // 184
0x00,0x00,0x00,0x10,0x00,0x00,0xF8,0x03,0x00,0xF8,0x03, // 185
0x00,0x00,0x00,0xF0,0x00,0x00,0x08,0x01,0x00,0x08,0x01,0x00,0xF8,0x01,0x00,0x60, // 186
0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x1E,0x00,0x00,0x0C,0x00,0x00,0x33,0x00,0x00,0x1E,0x00,0x00,0x0C, // 187
0x00,0x00,0x00,0x10,0x00,0x00,0xF8,0x21,0x00,0xF8,0x39,0x00,0x00,0x0E,0x00,0x00,0x23,0x00,0xC0,0x38,0x00,0x60,0x2E,0x00,0x00,0x7E,0x00,0x00,0x20, // 188
0x00,0x00,0x00,0x10,0x00,0x00,0xF8,0x21,0x00,0xF8,0x39,0x00,0x00,0x0E,0x00,0x00,0x47,0x00,0xC0,0x66,0x00,0x60,0x72,0x00,0x00,0x5E,0x00,0x00,0x40, // 189
0x90,0x00,0x00,0x98,0x01,0x00,0x28,0x01,0x00,0xF8,0x21,0x00,0xD0,0x38,0x00,0x00,0x0E,0x00,0x00,0x23,0x00,0xC0,0x38,0x00,0x60,0x2E,0x00,0x00,0x7E,0x00,0x00,0x20, // 190
0x00,0x00,0x00,0x00,0xF0,0x01,0x80,0xFC,0x03,0xC0,0x1E,0x03,0xC0,0xC6,0x03,0x00,0xC0,0x01,0x00,0xC0, // 191
0x00,0x40,0x00,0x00,0x78,0x00,0x01,0x7F,0x00,0xE1,0x1F,0x00,0xFB,0x18,0x00,0xFA,0x18,0x00,0xE0,0x1F,0x00,0x00,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 192
0x00,0x40,0x00,0x00,0x78,0x00,0x00,0x7F,0x00,0xE0,0x1F,0x00,0xFA,0x18,0x00,0xFB,0x18,0x00,0xE1,0x1F,0x00,0x01,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 193
0x00,0x40,0x00,0x00,0x78,0x00,0x02,0x7F,0x00,0xE3,0x1F,0x00,0xF9,0x18,0x00,0xFB,0x18,0x00,0xE2,0x1F,0x00,0x00,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 194
0x00,0x40,0x00,0x00,0x78,0x00,0x03,0x7F,0x00,0xE1,0x1F,0x00,0xFA,0x18,0x00,0xFA,0x18,0x00,0xE3,0x1F,0x00,0x00,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 195
0x00,0x40,0x00,0x00,0x78,0x00,0x03,0x7F,0x00,0xE3,0x1F,0x00,0xF8,0x18,0x00,0xF8,0x18,0x00,0xE3,0x1F,0x00,0x03,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 196
0x00,0x40,0x00,0x00,0x78,0x00,0x00,0x7F,0x00,0xE3,0x1F,0x00,0xFA,0x18,0x00,0xFB,0x18,0x00,0xE0,0x1F,0x00,0x00,0x7F,0x00,0x00,0x78,0x00,0x00,0x40, // 197
0x00,0x40,0x00,0x00,0x70,0x00,0x00,0x7E,0x00,0x80,0x1F,0x00,0xE0,0x0F,0x00,0xF8,0x0C,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x7F,0x00,0x18,0x63,0x00,0x18,0x63,0x00,0x18,0x63,0x00,0x00,0x60, // 198
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF0,0x3F,0x00,0x18,0x60,0x00,0x18,0xE0,0x05,0x18,0xE0,0x07,0x78,0x78,0x00,0x70,0x38,0x00,0x40,0x08, // 199
0x00,0x00,0x00,0xF9,0x7F,0x00,0xF9,0x7F,0x00,0x1B,0x63,0x00,0x1A,0x63,0x00,0x18,0x63,0x00,0x18,0x63, // 200
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x1A,0x63,0x00,0x1B,0x63,0x00,0x19,0x63,0x00,0x19,0x63, // 201
0x00,0x00,0x00,0xF8,0x7F,0x00,0xFA,0x7F,0x00,0x1B,0x63,0x00,0x19,0x63,0x00,0x1B,0x63,0x00,0x1A,0x63, // 202
0x00,0x00,0x00,0xF8,0x7F,0x00,0xFB,0x7F,0x00,0x1B,0x63,0x00,0x18,0x63,0x00,0x18,0x63,0x00,0x1B,0x63,0x00,0x03, // 203
0x01,0x00,0x00,0xFB,0x7F,0x00,0xFA,0x7F, // 204
0x00,0x00,0x00,0xFA,0x7F,0x00,0xFB,0x7F,0x00,0x01, // 205
0x02,0x00,0x00,0xFB,0x7F,0x00,0xF9,0x7F,0x00,0x03, // 206
0x03,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x03, // 207
0x00,0x01,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x61,0x00,0x18,0x61,0x00,0x18,0x70,0x00,0xF0,0x3F,0x00,0xE0,0x1F, // 208
0x00,0x00,0x00,0xF8,0x7F,0x00,0xFB,0x7F,0x00,0x79,0x00,0x00,0xC2,0x03,0x00,0x02,0x0F,0x00,0x03,0x7C,0x00,0xF8,0x7F,0x00,0xF8,0x7F, // 209
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF1,0x3F,0x00,0x39,0x70,0x00,0x1B,0x60,0x00,0x1A,0x60,0x00,0x38,0x70,0x00,0xF0,0x3F,0x00,0xE0,0x1F, // 210
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF0,0x3F,0x00,0x38,0x70,0x00,0x1A,0x60,0x00,0x1B,0x60,0x00,0x39,0x70,0x00,0xF1,0x3F,0x00,0xE0,0x1F, // 211
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF2,0x3F,0x00,0x3B,0x70,0x00,0x19,0x60,0x00,0x1B,0x60,0x00,0x3A,0x70,0x00,0xF0,0x3F,0x00,0xE0,0x1F, // 212
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF3,0x3F,0x00,0x39,0x70,0x00,0x1A,0x60,0x00,0x1A,0x60,0x00,0x3B,0x70,0x00,0xF0,0x3F,0x00,0xE0,0x1F, // 213
0x00,0x00,0x00,0xE0,0x1F,0x00,0xF3,0x3F,0x00,0x3B,0x70,0x00,0x18,0x60,0x00,0x18,0x60,0x00,0x3B,0x70,0x00,0xF3,0x3F,0x00,0xE0,0x1F, // 214
0x00,0x00,0x00,0xC0,0x18,0x00,0x80,0x0D,0x00,0x00,0x07,0x00,0x80,0x0F,0x00,0xC0,0x1D,0x00,0x80,0x08, // 215
0x00,0x00,0x00,0xE0,0x9F,0x00,0xF0,0xFF,0x00,0x38,0x78,0x00,0x18,0x67,0x00,0xD8,0x61,0x00,0x78,0x78,0x00,0xF8,0x3F,0x00,0xC8,0x0F, // 216
0x00,0x00,0x00,0xF9,0x3F,0x00,0xF9,0x7F,0x00,0x03,0x60,0x00,0x02,0x60,0x00,0x00,0x60,0x00,0xF8,0x7F,0x00,0xF8,0x3F, // 217
0x00,0x00,0x00,0xF8,0x3F,0x00,0xF8,0x7F,0x00,0x00,0x60,0x00,0x02,0x60,0x00,0x03,0x60,0x00,0xF9,0x7F,0x00,0xF9,0x3F, // 218
0x00,0x00,0x00,0xF8,0x3F,0x00,0xFA,0x7F,0x00,0x03,0x60,0x00,0x01,0x60,0x00,0x03,0x60,0x00,0xFA,0x7F,0x00,0xF8,0x3F, // 219
0x00,0x00,0x00,0xF8,0x3F,0x00,0xFB,0x7F,0x00,0x03,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0xFB,0x7F,0x00,0xFB,0x3F, // 220
0x08,0x00,0x00,0x38,0x00,0x00,0xF8,0x01,0x00,0xC2,0x7F,0x00,0x03,0x7F,0x00,0xE1,0x7F,0x00,0xF9,0x00,0x00,0x38,0x00,0x00,0x08, // 221
0x00,0x00,0x00,0xF8,0x7F,0x00,0xF8,0x7F,0x00,0x60,0x18,0x00,0x60,0x18,0x00,0x60,0x18,0x00,0xE0,0x1F,0x00,0xC0,0x0F, // 222
0x00,0x00,0x00,0xF0,0x7F,0x00,0xF8,0x7F,0x00,0x18,0x00,0x00,0x18,0x63,0x00,0xF8,0x67,0x00,0xF0,0x7F,0x00,0x00,0x3C, // 223
0x08,0x00,0x00,0x88,0x39,0x00,0xD8,0x7D,0x00,0xD0,0x6C,0x00,0xC0,0x6C,0x00,0xC0,0x7F,0x00,0x80,0x7F, // 224
0x00,0x00,0x00,0x80,0x39,0x00,0xC0,0x7D,0x00,0xD0,0x6C,0x00,0xD8,0x6C,0x00,0xC8,0x7F,0x00,0x88,0x7F, // 225
0x00,0x00,0x00,0x90,0x39,0x00,0xD8,0x7D,0x00,0xC8,0x6C,0x00,0xD8,0x6C,0x00,0xD0,0x7F,0x00,0x80,0x7F, // 226
0x00,0x00,0x00,0x98,0x39,0x00,0xC8,0x7D,0x00,0xD0,0x6C,0x00,0xD0,0x6C,0x00,0xD8,0x7F,0x00,0x80,0x7F, // 227
0x00,0x00,0x00,0x98,0x39,0x00,0xD8,0x7D,0x00,0xC0,0x6C,0x00,0xC0,0x6C,0x00,0xD8,0x7F,0x00,0x98,0x7F, // 228
0x00,0x00,0x00,0x80,0x39,0x00,0xDC,0x7D,0x00,0xD4,0x6C,0x00,0xDC,0x6C,0x00,0xC0,0x7F,0x00,0x80,0x7F, // 229
0x00,0x00,0x00,0x80,0x39,0x00,0xC0,0x7D,0x00,0xC0,0x6C,0x00,0xC0,0x6C,0x00,0xC0,0x3F,0x00,0x80,0x3F,0x00,0xC0,0x6D,0x00,0xC0,0x6C,0x00,0xC0,0x6F,0x00,0x80,0x7F, // 230
0x00,0x0E,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xC0,0xE0,0x05,0xC0,0xE1,0x07,0x80,0x31,0x00,0x00,0x11, // 231
0x08,0x00,0x00,0x88,0x3F,0x00,0xD8,0x7F,0x00,0xD0,0x6C,0x00,0xC0,0x6C,0x00,0xC0,0x7F,0x00,0x80,0x2F, // 232
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xD0,0x6C,0x00,0xD8,0x6C,0x00,0xC8,0x7F,0x00,0x88,0x2F, // 233
0x00,0x00,0x00,0x90,0x3F,0x00,0xD8,0x7F,0x00,0xC8,0x6C,0x00,0xD8,0x6C,0x00,0xD0,0x7F,0x00,0x80,0x2F, // 234
0x00,0x00,0x00,0x98,0x3F,0x00,0xD8,0x7F,0x00,0xC0,0x6C,0x00,0xC0,0x6C,0x00,0xD8,0x7F,0x00,0x98,0x2F, // 235
0x08,0x00,0x00,0xD8,0x7F,0x00,0xD0,0x7F, // 236
0x00,0x00,0x00,0xD0,0x7F,0x00,0xD8,0x7F,0x00,0x08, // 237
0x10,0x00,0x00,0xD8,0x7F,0x00,0xC8,0x7F,0x00,0x18, // 238
0x18,0x00,0x00,0xC0,0x7F,0x00,0xC0,0x7F,0x00,0x18, // 239
0x00,0x00,0x00,0x00,0x3E,0x00,0x58,0x7F,0x00,0x78,0x63,0x00,0x70,0x63,0x00,0xF0,0x7F,0x00,0xD0,0x3F, // 240
0x00,0x00,0x00,0xD8,0x7F,0x00,0xC8,0x7F,0x00,0xD0,0x00,0x00,0xD0,0x00,0x00,0xD8,0x7F,0x00,0x80,0x7F, // 241
0x00,0x00,0x00,0x88,0x3F,0x00,0xC8,0x7F,0x00,0xD8,0x60,0x00,0xD0,0x60,0x00,0xC0,0x7F,0x00,0x80,0x3F, // 242
0x00,0x00,0x00,0x80,0x3F,0x00,0xC0,0x7F,0x00,0xD0,0x60,0x00,0xD8,0x60,0x00,0xC8,0x7F,0x00,0x88,0x3F, // 243
0x00,0x00,0x00,0x90,0x3F,0x00,0xD8,0x7F,0x00,0xC8,0x60,0x00,0xD8,0x60,0x00,0xD0,0x7F,0x00,0x80,0x3F, // 244
0x00,0x00,0x00,0x98,0x3F,0x00,0xC8,0x7F,0x00,0xD0,0x60,0x00,0xD0,0x60,0x00,0xD8,0x7F,0x00,0x80,0x3F, // 245
0x00,0x00,0x00,0x98,0x3F,0x00,0xD8,0x7F,0x00,0xC0,0x60,0x00,0xC0,0x60,0x00,0xD8,0x7F,0x00,0x98,0x3F, // 246
0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0xC0,0x36,0x00,0xC0,0x36,0x00,0x00,0x06,0x00,0x00,0x06, // 247
0x00,0x00,0x00,0x80,0xBF,0x00,0xC0,0xFF,0x00,0xC0,0x7C,0x00,0xC0,0x67,0x00,0xE0,0x7F,0x00,0xA0,0x3F, // 248
0x00,0x00,0x00,0xC8,0x3F,0x00,0xC8,0x7F,0x00,0x18,0x60,0x00,0x10,0x60,0x00,0xC0,0x7F,0x00,0xC0,0x7F, // 249
0x00,0x00,0x00,0xC0,0x3F,0x00,0xC0,0x7F,0x00,0x10,0x60,0x00,0x18,0x60,0x00,0xC8,0x7F,0x00,0xC8,0x7F, // 250
0x00,0x00,0x00,0xD0,0x3F,0x00,0xD8,0x7F,0x00,0x08,0x60,0x00,0x18,0x60,0x00,0xD0,0x7F,0x00,0xC0,0x7F, // 251
0x00,0x00,0x00,0xD8,0x3F,0x00,0xD8,0x7F,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0xD8,0x7F,0x00,0xD8,0x7F, // 252
0xC0,0x00,0x00,0xC0,0x07,0x03,0xC0,0xFF,0x03,0x10,0xF8,0x01,0xD8,0x7F,0x00,0xC8,0x07,0x00,0x48, // 253
0x00,0x00,0x00,0xF8,0xFF,0x03,0xF8,0xFF,0x03,0xC0,0x60,0x00,0xC0,0x60,0x00,0xC0,0x7F,0x00,0x80,0x3F, // 254
0xC0,0x00,0x00,0xD8,0x07,0x03,0xD8,0xFF,0x03,0x00,0xF8,0x01,0xC0,0x7F,0x00,0xD8,0x07,0x00,0x58 // 255
};

268
include/leds.h Normal file
View file

@ -0,0 +1,268 @@
#ifndef __leds_H__
#define __leds_H__
#include "Arduino.h"
#include <Adafruit_NeoPixel.h>
class leds
{
const uint8_t FADESTEPS = 40;
const unsigned long FADE_WAIT_MS = 10;
const uint8_t MAX_BRIGHTNESS = 255;
const uint8_t MIN_BRIGHTNESS = 10;
const unsigned long WAIT_RAINBOWCYCLE_MS = 50;
uint8_t _local_brightness = 255;
float _R = 0;
typedef struct
{
uint16_t lednr;
uint32_t color;
} _pixel;
unsigned int _pixel_nr = 0;
unsigned int _pixel_last, _pixel_first;
_pixel *_pixels;
uint16_t * _state_flag;
uint16_t _state_mask;
int _fadestep = 0;
unsigned long _last_faded_ms = 0;
bool _fading_done = false;
uint16_t _prev_state = 0;
Adafruit_NeoPixel * _stripe;
uint8_t _s = 0;
uint16_t _h = 0;
float _calc_R();
void _setLeds();
void _setLeds(uint32_t color);
void _resetLeds(uint32_t color);
bool _fade(bool fade_in);
bool _fade_off();
bool _fade_on();
uint16_t _rainbow_pixel, _rainbow_color;
unsigned long _last_rainbowcycle = 0;
uint32_t _wheel(byte pos);
public:
leds(Adafruit_NeoPixel * stripe, uint16_t * state_flag, uint16_t state_mask, uint16_t H, uint8_t S, unsigned int pixel_first, unsigned int pixel_last );
~leds();
void clear();
bool colorWipe( uint32_t color );
void add_button_id(uint16_t mask);
bool do_fade();
void setBrigthness(uint8_t brigthness);
void setHS(uint16_t H, uint8_t S);
void setColor(uint32_t color);
void rainbowCycle();
};
leds::leds(Adafruit_NeoPixel * stripe, uint16_t * state_flag, uint16_t state_mask, uint16_t H, uint8_t S, unsigned int pixel_first, unsigned int pixel_last )
{
_state_flag = state_flag;
_state_mask = state_mask;
_h = H;
_s = S;
_pixel_last = pixel_last;
_pixel_first = pixel_first;
_pixel_nr = 1 + abs(pixel_last - pixel_first);
_pixels = (_pixel *) malloc(sizeof(_pixel) * _pixel_nr);
_stripe = stripe;
_R = _calc_R();
_setLeds(0);
_rainbow_pixel = 0;
_rainbow_color = 0;
}
leds::~leds()
{
if(NULL != _pixels)
free(_pixels);
}
void leds::_setLeds()
{
for(uint8_t nr = 0; nr < _pixel_nr; nr++)
{
_stripe->setPixelColor(_pixels[nr].lednr, _pixels[nr].color);
}
}
void leds::_setLeds(uint32_t color)
{
for(uint8_t nr = 0; nr < _pixel_nr; nr++)
{
_stripe->setPixelColor(_pixels[nr].lednr, color);
_pixels[nr].color = color;
}
}
void leds::clear()
{
_setLeds(0);
}
void leds::add_button_id(uint16_t id)
{
_state_mask = _state_mask | id;
}
bool leds::do_fade()
{
bool updated = false;
uint16_t curr_state = _state_mask & *_state_flag;
if(_prev_state != curr_state)
{
_prev_state = curr_state;
_fading_done = false;
}
if(_fading_done == false)
{
updated = true;
if(0 == curr_state)
{
_fade_off();
}
else
{
_fade_on();
}
}
return updated;
}
float leds::_calc_R(void)
{
return (FADESTEPS * log10(2))/(log10(_local_brightness));
}
void leds::setBrigthness(uint8_t brigthness)
{
if(brigthness > MAX_BRIGHTNESS)
_local_brightness = MAX_BRIGHTNESS;
else
{
if(brigthness < MIN_BRIGHTNESS)
_local_brightness = MIN_BRIGHTNESS;
else
_local_brightness = brigthness;
}
_R = _calc_R();
uint8_t fade = pow (2, (_fadestep / _R)) - 1;
_setLeds(_stripe->ColorHSV(_h, _s, fade));
}
void leds::setHS(uint16_t H, uint8_t S)
{
_h = H;
_s = S;
uint8_t fade = pow (2, (_fadestep / _R)) - 1;
_setLeds(_stripe->ColorHSV(_h, _s, fade));
}
void leds::setColor(uint32_t color)
{
_setLeds(color);
}
bool leds::_fade(bool fade_in)
{
unsigned long curr_millis = millis();
if( _last_faded_ms > (curr_millis - FADE_WAIT_MS))
return(false);
_last_faded_ms = curr_millis;
if(_fadestep != -1)
{
uint8_t fade = pow (2, (_fadestep / _R)) - 1;
_setLeds(_stripe->ColorHSV(_h, _s, fade));
}
if(true == fade_in)
{
if(_fadestep == -1)
_fadestep = 0;
else
{
if(_fadestep<FADESTEPS)
_fadestep++ ;
else
{
_fadestep = -1;
_fading_done = true;
return(true);
}
}
}
else
{
if(_fadestep == -1)
_fadestep = FADESTEPS;
else
{
if(_fadestep>0)
_fadestep--;
else
{
_fadestep = -1;
_fading_done = true;
return(true);
}
}
}
return(false);
}
bool leds::_fade_on()
{
return _fade(true);
}
bool leds::_fade_off()
{
return _fade(false);
}
void leds::rainbowCycle()
{
if((millis() - _last_rainbowcycle) > WAIT_RAINBOWCYCLE_MS)
{
_last_rainbowcycle = millis();
_rainbow_color++;
if(_rainbow_color >= 256*1)
_rainbow_color = 0;
for(size_t nr = 0; nr< _pixel_nr; ++nr) {
_pixels[nr].color = _wheel(((_rainbow_pixel * 256 / _pixel_nr) + _rainbow_color) & 255);
}
_setLeds();
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t leds::_wheel(byte pos) {
pos = 255 - pos;
if(pos < 85) {
return _stripe->Color(255 - pos * 3, 0, pos * 3);
}
if(pos < 170) {
pos -= 85;
return _stripe->Color(0, pos * 3, 255 - pos * 3);
}
pos -= 170;
return _stripe->Color(pos * 3, 255 - pos * 3, 0);
}
#endif

53
include/main.h Normal file
View file

@ -0,0 +1,53 @@
#include <Arduino.h>
#include "train.h"
#include "relais.h"
#include "taster.h"
#include "leds.h"
#include "mp3.h"
#include "display.h"
#include "eeprom.h"
eeprom save;
///---- OLED ----
const size_t PIN_MONI_SDA = 21 ; //12
const size_t PIN_MONI_SCL = 22 ; //14
const unsigned int ADDR_MONI = 0x3c;
display moni(PIN_MONI_SDA, PIN_MONI_SCL, ADDR_MONI);
///---- MP3 ----
const size_t PIN_MP3_RX = 3 ; //D2;
const size_t PIN_MP3_TX = 1 ; //D3;
mp3 mp3ply(PIN_MP3_RX, PIN_MP3_TX);
///---- RELAIS ----
const size_t PIN_RELAIS_HAUESER = 9;
const size_t PIN_RELAIS_STERNE = 17;
const size_t PIN_RELAIS_SPIEGELBALL = 16;
const size_t PIN_RELAIS_OTHER = 4;
relais haeuser(PIN_RELAIS_HAUESER);
relais sterne(PIN_RELAIS_STERNE);
relais spiegel(PIN_RELAIS_SPIEGELBALL);
relais other(PIN_RELAIS_OTHER);
///---- Spannungsregler
const size_t PIN_TRAIN_UNTEN = 32;
const size_t PIN_TRAIN_OBEN = 33;
#define PWM_CHANNEL_OBEN 5
#define PWM_CHANNEL_UNTEN 6
train zugunten(PIN_TRAIN_UNTEN, PWM_CHANNEL_UNTEN );
train zugoben(PIN_TRAIN_OBEN, PWM_CHANNEL_OBEN );
///--- Taster ----
const size_t PIN_TASTER_AUSSEN_LICHT = 36;
const size_t PIN_TASTER_AUSSEN_MOVE = 39;
const size_t PIN_TASTER_TRAIN_UNTEN = 34;
const size_t PIN_TASTER_TRAIN_OBEN = 35;
taster taster_aussen_licht(PIN_TASTER_AUSSEN_LICHT);
taster taster_aussen_move(PIN_TASTER_AUSSEN_MOVE);
taster taster_train_unten(PIN_TASTER_TRAIN_UNTEN);
taster taster_train_oben(PIN_TASTER_TRAIN_OBEN);
///--- RGB LEDs ---
uint16_t rgbled_state_flag = 0;
const size_t PIN_RGBLEDS = 19;
#define NUMRGBLEDS 20
Adafruit_NeoPixel rgb_leds(NUMRGBLEDS, PIN_RGBLEDS, NEO_GRB + NEO_KHZ800);
enum led_t {LTANNE=1, LBACK=2, LSTERNE=4, LTEICH=8};
leds led_tanne(&rgb_leds, &rgbled_state_flag, LTANNE, 5000,220, 0, 5 );
leds led_teich(&rgb_leds, &rgbled_state_flag, LTEICH, 5000,220, 6, 10 );

63
include/mp3.h Normal file
View file

@ -0,0 +1,63 @@
#ifndef __mp3_H__
#define __mp3_H__
#include "SerialMP3Player.h"
class mp3
{
private:
const char* STARTED_STRING = "Status: playing";
const char* STOPPED_STRING = "Status: stopped";
SerialMP3Player *player;
size_t _rx_pin,_tx_pin;
unsigned long _play_since_ms = 0;
public:
mp3(size_t rx_pin, size_t tx_pin);
~mp3();
void stop();
void play(size_t nr);
unsigned long is_playing();
};
mp3::mp3(size_t rx_pin, size_t tx_pin)
{
_rx_pin = rx_pin;
_tx_pin = tx_pin;
player = new SerialMP3Player(_rx_pin, _tx_pin);
player->begin(9600);
delay(500);
player->sendCommand(CMD_SEL_DEV, 0, 2); //select sd-card
delay(500);
player->setVol(30);
}
mp3::~mp3()
{
}
void mp3::play(size_t nr)
{
player->play(nr);
_play_since_ms = millis();
}
unsigned long mp3::is_playing()
{
player->qStatus();
if (player->available()){
String answer = player->decodeMP3Answer();
if(answer.indexOf(STARTED_STRING) > -1)
{
return(millis() - _play_since_ms);
}
}
return 0;
}
void mp3::stop()
{
player->stop();
}
#endif

62
include/relais.h Normal file
View file

@ -0,0 +1,62 @@
#ifndef __relais_H__
#define __relais_H__
#include <Arduino.h>
class relais
{
private:
size_t _ctrl_pin;
bool _relais_on = false;
public:
relais(size_t ctrl_pin);
~relais();
void on();
void off();
void toggle();
bool is_on();
};
relais::relais(size_t ctrl_pin)
{
_ctrl_pin = ctrl_pin;
_relais_on = false;
pinMode(_ctrl_pin, OUTPUT);
}
relais::~relais()
{
}
void relais::on()
{
digitalWrite(_ctrl_pin, HIGH);
_relais_on = true;
}
void relais::off()
{
digitalWrite(_ctrl_pin, LOW);
_relais_on = false;
}
void relais::toggle()
{
if(true == _relais_on)
{
digitalWrite(_ctrl_pin, LOW);
_relais_on = false;
}
else
{
digitalWrite(_ctrl_pin, HIGH);
_relais_on = true;
}
}
bool relais::is_on()
{
return(_relais_on);
}
#endif

54
include/taster.h Normal file
View file

@ -0,0 +1,54 @@
#ifndef __taster_H__
#define __taster_H__
#include <Arduino.h>
#include <FunctionalInterrupt.h>
class taster
{
private:
volatile const unsigned long _BOUNCING_TIME_MS = 200;
volatile unsigned long _last_pressed;
size_t _taster_pin;
volatile unsigned long _number_pressed;
unsigned long _number_checked;
void IRAM_ATTR _taster_int()
{
if(millis()-_last_pressed > _BOUNCING_TIME_MS)
{
_last_pressed = millis();
_number_pressed += 1;
}
}
public:
taster(size_t pin);
~taster();
bool pressed();
};
taster::taster(size_t pin)
{
_taster_pin = pin;
_number_pressed = 0;
_number_checked = 0;
_last_pressed = 0;
pinMode(_taster_pin, INPUT_PULLUP);
attachInterrupt(_taster_pin, std::bind(&taster::_taster_int,this), FALLING);
}
taster::~taster()
{
detachInterrupt(_taster_pin);
}
bool taster::pressed() {
if (_number_pressed != _number_checked)
{
_number_checked = _number_pressed;
return true;
}
return false;
}
#endif

91
include/train.h Normal file
View file

@ -0,0 +1,91 @@
#ifndef __train_H__
#define __train_H__
#include <Arduino.h>
class train
{
private:
const uint8_t _MAX_FADE_STEP = 255;
const uint8_t _MIN_FADE_STEP = 0;
static const unsigned long _FADE_DELAY_MS = 50;
size_t _pwmpin;
size_t _pwmchannel;
uint8_t _fade_step;
unsigned long _last_faded_ms;
unsigned long _delay_ms;
void _set_pwm(uint8_t pwm_value);
bool _fade(bool fade_up);
public:
train(size_t pwmpin , size_t pwmchannel,unsigned long delay_ms = _FADE_DELAY_MS);
~train();
void stop();
bool fade_on();
bool fade_off();
};
train::train(size_t pwmpin, size_t pwmchannel, unsigned long delay_ms)
{
_pwmpin = pwmpin;
_pwmchannel = pwmchannel;
_fade_step = 0;
_last_faded_ms = 0;
_delay_ms = delay_ms;
ledcSetup(pwmchannel, 100, 8);
ledcAttachPin(_pwmpin, pwmchannel);
}
train::~train()
{
}
void train::_set_pwm(uint8_t pwm_value) {
ledcWrite(_pwmchannel, pwm_value);
}
void train::stop() {
_set_pwm(0);
}
bool train::_fade(bool fade_up)
{
if(millis() - _last_faded_ms > _delay_ms)
{
_last_faded_ms = millis();
if(true == fade_up)
{
if(_MAX_FADE_STEP > _fade_step)
_fade_step++;
else
return false;
}
else
{
if(_MIN_FADE_STEP < _fade_step)
_fade_step--;
else
return false;
}
}
return true;
}
bool train::fade_on()
{
return _fade(true);
}
bool train::fade_off()
{
return _fade(false);
}
#endif

46
lib/README Normal file
View file

@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

20
platformio.ini Normal file
View file

@ -0,0 +1,20 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
salvadorrueda/SerialMP3Player@^1.1.0
plerup/EspSoftwareSerial@^6.14.1
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.1
tridenttd/TridentTD_ESP32NVS@^1.0

99
src/main.cpp Normal file
View file

@ -0,0 +1,99 @@
#include "main.h"
//funtion prototypes
void show_counters(uint64_t counter_licht, uint64_t counter_move);
//variables
uint64_t licht_all_count = 0;
uint64_t move_all_count = 0;
void setup() {
//load counters
save.set_int("licht", 0);
save.set_int("move", 0);
licht_all_count = save.get_int("licht");
move_all_count = save.get_int("move");
// all relais off;
haeuser.off();
sterne.off();
spiegel.off();
other.off();
zugoben.stop();
zugunten.stop();
led_tanne.setColor(0x0f0);
mp3ply.play(1);
}
uint8_t licht_count = 0;
void loop() {
led_teich.rainbowCycle();
rgb_leds.show();
if(taster_aussen_licht.pressed())
{
licht_all_count++;
save.set_int("licht",licht_all_count);
licht_count++;
if(licht_count > 4)
licht_count = 1;
}
if(taster_aussen_move.pressed())
{
move_all_count++;
save.set_int("move", move_all_count);
}
show_counters(licht_all_count, move_all_count);
switch (licht_count)
{
case 1:
haeuser.on();
sterne.off();
spiegel.off();
other.off();
break;
case 2:
haeuser.off();
sterne.on();
spiegel.off();
other.off();
break;
case 3:
haeuser.off();
sterne.off();
spiegel.on();
other.off();
break;
case 4:
haeuser.off();
sterne.off();
spiegel.off();
other.on();
break;
default:
haeuser.off();
sterne.off();
spiegel.off();
other.off();
break;
}
}
void show_counters(uint64_t counter_licht, uint64_t counter_move)
{
moni.clear();
moni.header("Zaehler");
moni.data(10,15,counter_licht, "Licht:");
moni.data(10,15,counter_move, "Moves:");
moni.show();
}

11
test/README Normal file
View file

@ -0,0 +1,11 @@
This directory is intended for PlatformIO Unit Testing and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html