Compare commits

...

No commits in common. "master" and "main" have entirely different histories.
master ... main

21 changed files with 3 additions and 2610 deletions

5
.gitignore vendored
View file

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

View file

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

View file

@ -1,5 +0,0 @@
{
"files.associations": {
"functional": "cpp"
}
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# adventsfenster
Small unit to control an Adventsfenster ;-)

View file

@ -1,39 +0,0 @@
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

View file

@ -1,171 +0,0 @@
#ifndef __display_H__
#define __display_H__
#include "fonts.h"
#include <Wire.h>
#include "SSD1306Wire.h"
class display
{
private:
const uint8_t MAX_CONTRAST = 255;
SSD1306Wire * _display;
uint8_t _dispaddr;
int _pin_sda, _pin_scl;
bool _screen_flipped;
public:
display(uint8_t dispaddr, int pin_sda, int pin_scl);
~display();
void init();
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();
void flipScreenVert();
void setBrigthness(uint8_t value);
};
display::display(uint8_t dispaddr, int pin_sda, int pin_scl)
{
_pin_sda = pin_sda;
_pin_scl = pin_scl;
_dispaddr = dispaddr;
_display = new SSD1306Wire(_dispaddr, _pin_sda, _pin_scl);
}
display::~display()
{
}
void display::init()
{
//initialise OLED and display Welcome Message ...
_display->init();
_display->flipScreenVertically();
_screen_flipped = true;
_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();
}
void display::flipScreenVert()
{
if(_screen_flipped == true)
{
_screen_flipped = false;
_display->invertDisplay();
}
else
{
_screen_flipped = true;
_display->normalDisplay();
//_display->flipScreenVertically();
}
}
void display::setBrigthness(uint8_t value)
{
_display->setBrightness(value);
}
#endif

View file

@ -1,40 +0,0 @@
#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 );
void begin();
};
eeprom::eeprom()
{
}
eeprom::~eeprom()
{
}
void eeprom::begin()
{
NVS.begin();
}
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

View file

@ -1,458 +0,0 @@
// 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
};

View file

@ -1,409 +0,0 @@
#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;
uint32_t * _state_flag;
uint32_t _state_mask;
int _fadestep = 0;
unsigned long _last_faded_ms = 0;
bool _fading_done = false;
uint16_t _prev_state = 0;
Adafruit_NeoPixel * _stripe;
int _tcr_firstPixelHue;
int _tcr_b ;
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;
uint16_t _blue_color, _blue_pixel;
unsigned long _last_rainbowcycle = 0;
uint32_t _wheel(byte pos);
public:
enum led_update {UP_RAINBOW = 1, UP_FADE = 2, UP_BLUE = 4};
leds(Adafruit_NeoPixel * stripe, uint32_t * state_flag, uint16_t state_mask, uint16_t H, uint8_t S, unsigned int pixel_first, unsigned int pixel_last );
~leds();
bool update();
bool update(led_update type);
void clear();
bool colorWipe( uint32_t color );
void add_button_id(uint16_t mask);
bool do_fade();
bool fade_off();
bool fade_on();
void setBrigthness(uint8_t brigthness);
void setHS(uint16_t H, uint8_t S);
void setColor(uint32_t color);
void rainbowCycle();
bool do_rainbowCycle();
void theaterChaseRainbow();
void blueCycle();
bool do_blueCycle();
};
leds::leds(Adafruit_NeoPixel * stripe, uint32_t * state_flag, uint16_t state_mask, uint16_t H, uint8_t S, unsigned int pixel_first, unsigned int pixel_last )
{
_blue_color = 0;
_blue_pixel = 0;
_tcr_firstPixelHue = 0;
_tcr_b = 0;
_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);
size_t index = 0;
for(size_t nr=pixel_first; nr<=pixel_last;nr++)
{
_pixels[index].lednr = nr;
index++;
}
_stripe = stripe;
_R = _calc_R();
_setLeds(0);
_rainbow_pixel = 0;
_rainbow_color = 0;
_prev_state = *_state_flag;
_fading_done = true;
}
leds::~leds()
{
if(NULL != _pixels)
free(_pixels);
}
void leds::_setLeds()
{
for(unsigned int nr = 0; nr < _pixel_nr; nr++)
{
_stripe->setPixelColor(_pixels[nr].lednr, _pixels[nr].color);
}
}
void leds::_setLeds(uint32_t color)
{
for(unsigned int nr = 0; nr < _pixel_nr; nr++)
{
//Serial.printf("setting led %d with nr %d in stripe to color %d\n", nr, _pixels[nr].lednr, color);
_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::update()
{
return(update(UP_FADE));
}
bool leds::update(led_update type)
{
if(type == UP_RAINBOW )
{
return(do_rainbowCycle());
}
if(type == UP_BLUE )
{
return(do_blueCycle());
}
if(type == UP_FADE)
{
return(do_fade());
}
return(false);
}
bool leds::do_rainbowCycle()
{
bool updated = false;
uint16_t curr_state = _state_mask & *_state_flag;
if(curr_state == 0)
{
clear();
}
else
{
rainbowCycle();
updated = true;
}
return(updated);
}
bool leds::do_blueCycle()
{
bool updated = false;
uint16_t curr_state = _state_mask & *_state_flag;
if(curr_state == 0)
{
clear();
}
else
{
blueCycle();
updated = true;
}
return(updated);
}
bool leds::do_fade()
{
bool updated = false;
uint16_t curr_state = _state_mask & *_state_flag;
if(_prev_state != curr_state)
{
//Serial.printf("Current state is 0x%08x\n", curr_state);
_prev_state = curr_state;
_fading_done = false;
}
if(_fading_done == false)
{
updated = true;
if(0 == curr_state)
{
_fade_off();
//Serial.printf("Fading off.\n");
}
else
{
_fade_on();
//Serial.printf("Fading ON\n");
}
}
return updated;
}
bool leds::fade_on()
{
return _fade_on();
}
bool leds::fade_off()
{
return _fade_off();
}
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::theaterChaseRainbow()
{
if((millis() - _last_rainbowcycle) > WAIT_RAINBOWCYCLE_MS)
{
_last_rainbowcycle = millis();
_tcr_b++;
if(_tcr_b >= 3)
_tcr_b = 0;
clear(); // Set all pixels in RAM to 0 (off)
for(int c=_tcr_b; c<_pixel_nr; c += 3)
{
int hue = _tcr_firstPixelHue + c * 65536L / _pixel_nr;
uint32_t color = _stripe->gamma32(_stripe->ColorHSV(hue)); // hue -> RGB
_pixels[c].color = color;
}
_setLeds();
_tcr_firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
}
}
void leds::rainbowCycle()
{
if((millis() - _last_rainbowcycle) > WAIT_RAINBOWCYCLE_MS)
{
//Serial.printf("Rainbow! Next color\n");
_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);
_pixels[nr].color = _wheel(((nr * 256 / _pixel_nr) + _rainbow_color) & 255);
}
_setLeds();
}
}
void leds::blueCycle()
{
if((millis() - _last_rainbowcycle) > 2*WAIT_RAINBOWCYCLE_MS)
{
//Serial.printf("Rainbow! Next color\n");
_last_rainbowcycle = millis();
_blue_color++;
if(_blue_color >= 3)
_blue_color = 0;
for(size_t nr = _blue_color; nr< _pixel_nr; nr = nr+3) {
if(_blue_pixel >= 3)
_blue_pixel = 0;
uint32_t color = _stripe->ColorHSV(43690,255, 1 + _blue_pixel*10);
//Serial.printf(" blue_color is %d, cnt is %d , color is %d, pixel is %d\n", _blue_color, _blue_pixel, color, nr);
_pixels[nr].color = color;
_blue_pixel++;
}
_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

View file

@ -1,114 +0,0 @@
#include <Arduino.h>
#include "train.h"
#include "relais.h"
#include "taster.h"
#include "leds.h"
#include "mp3.h"
#include "display.h"
#include <TridentTD_ESP32NVS.h>
//#include "eeprom.h"
//eeprom flash;
const unsigned long SZENE_TIMEOUT_TO_SET_TO_DEFAULT_MS = 600000;
const unsigned long MAX_DISCO_TIME = 120000;
///---- OLED ----
const int PIN_MONI_SDA = 21 ; //12
const int PIN_MONI_SCL = 22 ; //14
const uint8_t ADDR_MONI = 0x3c;
display moni(ADDR_MONI, PIN_MONI_SDA, PIN_MONI_SCL);
///---- MP3 ----
const size_t PIN_MP3_RX = 25 ; //D2;
const size_t PIN_MP3_TX = 26 ; //D3;
const uint8_t SONG_EINE_INSEL = 1;
const uint8_t SONG_WEIHNACHTSBAECKEREI = 3;
const uint8_t SONG_WEIHNACHTSBAHN = 5;
const uint8_t SONG_OH_TANNEBAUM = 7;
const uint8_t SONG_DISCO_MARYSBOYCHILD = 9;
const uint8_t SONG_DISCO_LASTCHRISTMAS = 11;
const uint8_t SONG_DISCO_DOTHEYKNOWITSCHRISTMAS = 13;
const uint8_t SONG_WEIHNACHTSZEIT = 15;
const uint8_t SONG_ZEIT_ANGEKOMMEN = 17;
const uint8_t SONG_WINTER = 19;
const uint8_t SONG_WEIHNACHTSTRAUM = 21;
const uint8_t SONG_DISCO_MERRY_CHRISTMAS = 23;
//const uint8_t SONG_DISCO_ = ;
//const uint8_t SONG_DISCO_ = ;
mp3 mp3ply(PIN_MP3_RX, PIN_MP3_TX);
///---- RELAIS ----
enum relais_t {RNONE = 0, RZUGOBEN=1, RZUGUNTEN=2, RWOLKE=4, RSPIEGEL=8};
const size_t PIN_RELAIS_0 = 5;
const size_t PIN_RELAIS_1 = 17;
const size_t PIN_RELAIS_2 = 16;
const size_t PIN_RELAIS_3 = 4;
const size_t PIN_IO2 = 9; //relais Wolke
relais relais_wolke_schiene(PIN_RELAIS_2);
relais relais_spiegel(PIN_RELAIS_3);
//relais relais_wolke(PIN_IO2);
///---- Spannungsregler
uint32_t spannungsregler_state_flag = 0;
const size_t PIN_TRAIN_UNTEN = 32;
const size_t PIN_TRAIN_OBEN = 33;
const size_t PIN_LICHT = 15; //------------------------
#define PWM_CHANNEL_OBEN 5
#define PWM_CHANNEL_UNTEN 6
#define PWM_CHANNEL_LICHT 7
train zugunten("Zugunten", PIN_TRAIN_UNTEN, PWM_CHANNEL_UNTEN, PIN_RELAIS_1,5);
train zugoben("Zugoben", PIN_TRAIN_OBEN, PWM_CHANNEL_OBEN, PIN_RELAIS_0,5 );
train licht("Licht", PIN_LICHT, PWM_CHANNEL_LICHT, -1 ,5);
///--- IOs ----
const size_t PIN_IO0 = 23; //Schiene oben
const size_t PIN_IO1 = 10;
const size_t PIN_IO3 = 18;
///--- Taster ----
const unsigned long BOUNCING_TIME_MS = 300;
const size_t PIN_TASTER_AUSSEN_LICHT = 36;
const size_t PIN_TASTER_AUSSEN_MOVE = 39; //-----------------
const size_t PIN_TASTER_TRAIN_UNTEN = 35;
const size_t PIN_TASTER_TRAIN_OBEN = 13;
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);
//taster taster_schiene(PIN_IO0);
///--- RGB LEDs ---
uint32_t licht_state_flag = 0;
const size_t PIN_RGBLEDS = 19;
#define NUMRGBLEDS 109
Adafruit_NeoPixel rgb_leds(NUMRGBLEDS, PIN_RGBLEDS, NEO_GRB + NEO_KHZ800);
enum led_t {LTANNE=1, LBACK=2, LBAUHOF=4, LTEICH=8, LBURG=16, LSTERNE1=32, LSTERNE2=64, LSTERNBILD1 = 128, LSTERNBILD2=256, LSTERNBILD3=512, LHAEUSER=1024, LSPIEGEL=2048};
/*
leds led_back(&rgb_leds, &licht_state_flag, LBACK, 5000,220, 0, 6 );
leds led_burg(&rgb_leds, &licht_state_flag, LBURG, 5000,220, 7, 9);
leds led_teich(&rgb_leds, &licht_state_flag, LTEICH, 5000,220, 10, 16 );
leds led_sternbilder1(&rgb_leds, &licht_state_flag, LSTERNBILD1, 5000,220, 17, 17 );
leds led_sterne1(&rgb_leds, &licht_state_flag, LSTERNE1, 5000,220, 18, 18 );
leds led_sternbilder2(&rgb_leds, &licht_state_flag, LSTERNBILD2, 5000,220, 19, 19 );
leds led_sterne2(&rgb_leds, &licht_state_flag, LSTERNE2, 5000,220, 20, 20 );
leds led_sternbilder3(&rgb_leds, &licht_state_flag, LSTERNBILD3, 5000,220, 21, 21 );
leds led_bauhof(&rgb_leds, &licht_state_flag, LBAUHOF, 5000,220, 22, 24);
leds led_tanne(&rgb_leds, &licht_state_flag, LTANNE, 5000,220, 25, 25 );
*/
leds led_back(&rgb_leds, &licht_state_flag, LBACK, 5000,220, 0, 69 );
leds led_burg(&rgb_leds, &licht_state_flag, LBURG, 5000,220, 70, 76);
leds led_teich(&rgb_leds, &licht_state_flag, LTEICH, 5000,220, 77, 88 );
leds led_sternbilder1(&rgb_leds, &licht_state_flag, LSTERNBILD1, 5000,220, 89, 90 );
leds led_sterne1(&rgb_leds, &licht_state_flag, LSTERNE1, 5000,220, 91, 92 );
leds led_sternbilder2(&rgb_leds, &licht_state_flag, LSTERNBILD2, 5000,220, 93, 94 );
leds led_sterne2(&rgb_leds, &licht_state_flag, LSTERNE2, 5000,220, 95, 96 );
leds led_sternbilder3(&rgb_leds, &licht_state_flag, LSTERNBILD3, 5000,220, 97, 98 );
leds led_bauhof(&rgb_leds, &licht_state_flag, LBAUHOF, 5000,220, 99, 106);
leds led_tanne(&rgb_leds, &licht_state_flag, LTANNE, 5000,220, 107, 108 );

View file

@ -1,168 +0,0 @@
#ifndef __mp3_H__
#define __mp3_H__
#include "SerialMP3Player.h"
class mp3
{
private:
const byte FADESTEP_WITH = 5;
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;
const byte _MAX_FADE_STEP = 255;
const byte _MIN_FADE_STEP = 0;
byte _current_max_fade_step;
byte _current_min_fade_step;
static const unsigned long _FADE_DELAY_MS = 10;
byte _fade_step;
unsigned long _last_faded_ms;
unsigned long _delay_ms;
bool _fade(bool fade_up);
void _vol(byte val);
public:
mp3(size_t rx_pin, size_t tx_pin);
~mp3();
void stop();
bool fade_out();
bool fade_in();
void play(size_t nr);
unsigned long is_playing();
void begin(byte vol=30);
void play_vol(size_t nr, byte vol);
void vol(byte val);
};
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);
_fade_step = 0;
_last_faded_ms = 0;
_delay_ms = _FADE_DELAY_MS;
_current_max_fade_step = _MAX_FADE_STEP;
_current_min_fade_step = _MIN_FADE_STEP;
}
mp3::~mp3()
{
}
void mp3::begin(byte vol)
{
_current_max_fade_step = vol;
player->begin(9600);
delay(500);
player->sendCommand(CMD_SEL_DEV, 0, 2); //select sd-card
delay(500);
player->setVol(vol);
}
void mp3::play_vol(size_t nr, byte vol)
{
_current_max_fade_step = vol;
_vol(vol);
player->play(nr);
_play_since_ms = millis();
}
void mp3::play(size_t nr)
{
player->playSL(nr);
_play_since_ms = millis();
}
void mp3::vol(byte val)
{
_current_max_fade_step = val;
_vol(val);
}
void mp3::_vol(byte val)
{
_fade_step = val;
Serial.printf("MP3 players volume set to %d.\n", val);
player->setVol(val);
}
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 1;
}
}
Serial.printf("MP3 Player is not playing\n");
return 0;
}
void mp3::stop()
{
player->stop();
}
bool mp3::_fade(bool fade_up)
{
if(millis() - _last_faded_ms > _delay_ms)
{
_last_faded_ms = millis();
if(true == fade_up)
{
if(_current_max_fade_step > _fade_step)
{
if(_fade_step + FADESTEP_WITH > _current_max_fade_step)
_fade_step = _current_max_fade_step;
else
_fade_step = FADESTEP_WITH + _fade_step;
_fade_step = _fade_step + FADESTEP_WITH;
}
else
return false;
}
else
{
if(_current_min_fade_step < _fade_step)
if(_fade_step - FADESTEP_WITH < _current_min_fade_step)
_fade_step = _current_min_fade_step;
else
_fade_step = _fade_step - FADESTEP_WITH;
else
return false;
}
_vol(_fade_step);
}
return true;
}
bool mp3::fade_out()
{
if(_fade(false) == true)
return(true);
else
{
player->stop();
return(false);
}
}
bool mp3::fade_in()
{
return(_fade(true));
}
#endif

View file

@ -1,75 +0,0 @@
#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();
void begin();
};
relais::relais(size_t ctrl_pin)
{
_ctrl_pin = ctrl_pin;
_relais_on = false;
}
void relais::begin()
{
pinMode(_ctrl_pin, OUTPUT);
digitalWrite(_ctrl_pin, HIGH);
_relais_on = false;
}
relais::~relais()
{
}
void relais::on()
{
if(_relais_on == false)
{
digitalWrite(_ctrl_pin, LOW);
_relais_on = true;
}
}
void relais::off()
{
if(_relais_on == true)
{
digitalWrite(_ctrl_pin, HIGH);
_relais_on = false;
}
}
void relais::toggle()
{
if(true == _relais_on)
{
digitalWrite(_ctrl_pin, HIGH);
_relais_on = false;
}
else
{
digitalWrite(_ctrl_pin, LOW);
_relais_on = true;
}
}
bool relais::is_on()
{
return(_relais_on);
}
#endif

View file

@ -1,84 +0,0 @@
#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;
unsigned long _number_pressed;
unsigned long _number_checked;
size_t _taster_pin;
volatile unsigned long * _ptr_number_pressed;
void IRAM_ATTR _taster_int()
{
unsigned long msecs = millis();
if(msecs -_last_pressed > _BOUNCING_TIME_MS)
{
_last_pressed = msecs;
_number_pressed += 1;
}
}
public:
//taster(const size_t pin, volatile unsigned long* ptr_number_pressed);
taster(const size_t pin);
~taster();
bool pressed();
void reset();
void begin();
};
//taster::taster(size_t pin, volatile unsigned long* ptr_number_pressed)
taster::taster(size_t pin)
{
_taster_pin = pin;
//_ptr_number_pressed = ptr_number_pressed;
_number_checked = 0;
_number_pressed = 0;
_last_pressed = 0;
}
void taster::begin()
{
pinMode(_taster_pin, INPUT_PULLUP);
//attachInterrupt(_taster_pin, std::bind(&taster::_taster_int,this), FALLING);
//attachInterrupt(_taster_pin, isrfunction, FALLING);
}
taster::~taster()
{
//detachInterrupt(_taster_pin);
}
bool taster::pressed() {
unsigned long msecs = millis();
if(msecs -_last_pressed > _BOUNCING_TIME_MS)
{
_last_pressed = msecs;
if(digitalRead(_taster_pin) == LOW)
return(true);
else
return false;
}
return false;
/*
//if (*_ptr_number_pressed > _number_checked)
if (_number_pressed > _number_checked)
{
//_number_checked = *_ptr_number_pressed;
_number_checked = _number_pressed;
return true;
}
return false;
*/
}
void taster::reset() {
_number_pressed = _number_checked;
}
#endif

View file

@ -1,189 +0,0 @@
#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;
uint8_t _current_max_fade_step;
uint8_t _current_min_fade_step;
static const unsigned long _FADE_DELAY_MS = 50;
size_t _relais_pin;
const char* _name;
bool _switch_zero_relais;
uint8_t _prev_pwm_value = 255;
size_t _pwmpin;
size_t _pwmchannel;
uint8_t _fade_step;
unsigned long _last_faded_ms;
unsigned long _delay_ms;
bool _fade(bool fade_up);
public:
train(const char* name, size_t pwmpin , size_t pwmchannel, size_t relais_pin, unsigned long delay_ms = _FADE_DELAY_MS);
~train();
void stop();
bool fade_on();
bool fade_off();
void set_pwm(uint8_t pwm_value);
void begin();
bool is_stopped();
bool is_up();
bool is_down();
uint8_t get_pwm();
void switch_zero_relais(bool do_switch);
bool fade_down_to(uint8_t pwm_value);
bool fade_up_to(uint8_t pwm_value);
};
train::train(const char* name, size_t pwmpin, size_t pwmchannel, size_t relais_pin, unsigned long delay_ms)
{
_pwmpin = pwmpin;
_pwmchannel = pwmchannel;
_fade_step = 0;
_last_faded_ms = 0;
_delay_ms = delay_ms;
_relais_pin = relais_pin;
_name = name;
_switch_zero_relais = true;
_current_max_fade_step = _MAX_FADE_STEP;
_current_min_fade_step = _MIN_FADE_STEP;
}
void train::begin()
{
//pinMode(_pwmpin, OUTPUT);
ledcSetup(_pwmchannel, 100, 8);
ledcAttachPin(_pwmpin, _pwmchannel);
if(_relais_pin != -1)
{
pinMode(_relais_pin, OUTPUT);
digitalWrite(_relais_pin, HIGH);
}
}
train::~train()
{
}
void train::set_pwm(uint8_t pwm_value) {
if(_prev_pwm_value != pwm_value)
{
_prev_pwm_value = pwm_value;
if(_relais_pin != -1 )
{
if(pwm_value == 0 )
{
if( _switch_zero_relais == true)
digitalWrite(_relais_pin, HIGH);
}
else
{
digitalWrite(_relais_pin, LOW);
}
}
_fade_step = pwm_value;
ledcWrite(_pwmchannel, pwm_value);
//Serial.printf("PWM '%s' set to value %d\n", _name, 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(_current_max_fade_step > _fade_step)
{
_fade_step++;
}
else
return false;
}
else
{
if(_current_min_fade_step < _fade_step)
_fade_step--;
else
return false;
}
set_pwm(_fade_step);
}
return true;
}
bool train::fade_down_to(uint8_t pwm_value)
{
_current_min_fade_step = pwm_value;
return _fade(false);
}
bool train::fade_up_to(uint8_t pwm_value)
{
_current_max_fade_step = pwm_value;
return _fade(true);
}
bool train::fade_on()
{
_current_max_fade_step = _MAX_FADE_STEP;
return _fade(true);
}
bool train::fade_off()
{
_current_min_fade_step = _MIN_FADE_STEP;
return _fade(false);
}
void train::switch_zero_relais(bool do_switch)
{
_switch_zero_relais = do_switch;
}
bool train::is_stopped()
{
if(_prev_pwm_value == 0)
return true;
else
return false;
}
bool train::is_up()
{
if(_prev_pwm_value == _current_max_fade_step)
return true;
else
return false;
}
bool train::is_down()
{
if(_prev_pwm_value == _current_min_fade_step)
return true;
else
return false;
}
uint8_t train::get_pwm()
{
return _prev_pwm_value;
}
#endif

View file

@ -1,46 +0,0 @@
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

View file

@ -1,20 +0,0 @@
; 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
tridenttd/TridentTD_ESP32NVS@^1.0
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.1

View file

@ -1,769 +0,0 @@
#include "main.h"
void taster_abfrage();
void set_lichtszene();
void set_moveszene();
bool licht_update();
void szene_oh_tannebaum();
void szene_nachts_dorf();
void szene_schnee_dorf();
void szene_nachts();
void szene_tag_dorf();
void move_zugoben();
void move_zugunten();
void move_schiene_oben();
void show_counters();
void updateNVS();
void disco();
void disco_licht();
unsigned int licht_all_count = 0;
unsigned int move_all_count = 0;
unsigned int disco_all_count = 0;
unsigned long last_updated_NVS = 0;
bool licht_is_fading = false;
bool mp3_isused = false;
void setup() {
Serial.begin(115200);
randomSeed(analogRead(0));
taster_aussen_licht.begin();
taster_aussen_move.begin();
//taster_train_unten.begin();
//taster_train_oben.begin();
//taster_schiene.begin();
relais_wolke_schiene.begin();
relais_spiegel.begin();
//relais_wolke.begin();
zugoben.begin();
zugunten.begin();
licht.begin();
NVS.begin();
licht_all_count = NVS.getInt("licht_cnt"); //1985
delay(500);
move_all_count = NVS.getInt("move_cnt"); //978
delay(500);
disco_all_count = NVS.getInt("disco_cnt"); //100
moni.init();
moni.setBrigthness(100);
licht_state_flag = LSTERNBILD1 | LSTERNBILD2 | LSTERNBILD3 | LSTERNE1 | LSTERNE2 | LTANNE;
mp3ply.begin();
mp3ply.stop();
led_sterne1.setBrigthness(20);
led_sterne2.setBrigthness(20);
led_sternbilder1.setBrigthness(220);
led_sternbilder2.setBrigthness(220);
led_sternbilder3.setBrigthness(220);
led_bauhof.setBrigthness(40);
led_burg.setBrigthness(40);
led_teich.setBrigthness(1);
led_back.setBrigthness(200);
//blau led_back.setHS(32000,200);
led_back.setHS(9000,180);
led_teich.setHS(40000,255);
}
void loop() {
updateNVS();
show_counters();
taster_abfrage();
set_lichtszene();
set_moveszene();
licht_is_fading = licht_update();
}
bool next_licht_szene_possible = true;
bool next_move_szene_possible = true;
uint8_t licht_szene = 0;
uint8_t move_szene = 0;
unsigned long szene_time_ms = 0;
unsigned long szene_overall_time_ms = 0;
void set_lichtszene()
{
if(next_licht_szene_possible == false)
{
szene_overall_time_ms = millis();
switch(licht_szene)
{
case 0:
szene_nachts();
break;
case 1:
szene_nachts_dorf();
break;
case 2:
szene_schnee_dorf();
break;
case 3:
szene_tag_dorf();
break;
case 4:
szene_oh_tannebaum();
break;
default:
licht_szene = 0;
}
}
if(millis() - szene_overall_time_ms > SZENE_TIMEOUT_TO_SET_TO_DEFAULT_MS)
{
szene_overall_time_ms = millis();
Serial.printf("Setting Licht backt to default night withe Tannenbaum\n");
licht_state_flag = LSTERNBILD1 | LSTERNBILD2 | LSTERNBILD3 | LSTERNE1 | LSTERNE2 | LTANNE;
licht_szene = 0;
taster_aussen_licht.reset();
next_licht_szene_possible = true;
}
}
void set_moveszene()
{
if(next_move_szene_possible == false)
{
switch(move_szene)
{
case 0:
move_zugoben();
break;
case 1:
move_zugunten();
break;
case 2:
move_schiene_oben();
break;
default:
move_szene = 0;
break;
}
}
}
const byte TANNENBAUM_VOL = 20;
const unsigned long TANNENBAUM_PLAY_MUSIC_MS = 135000;
typedef enum {TA_INIT = 0, TA_LIGHT_READY, TA_MIN_PLAYING,TA_PLAYING, TA_STOP_PLAYING, TA_FINSIHED} szene_tanne_t;
szene_tanne_t tanne_state = TA_INIT;
void szene_oh_tannebaum()
{
unsigned long msecs = millis();
switch(tanne_state)
{
case TA_INIT:
Serial.printf("Tannenbaum spielt\n");
licht_state_flag = LSTERNBILD1 | LSTERNBILD2 | LSTERNBILD3 | LSTERNE1 | LSTERNE2 | LTANNE;
tanne_state = TA_LIGHT_READY;
break;
case TA_LIGHT_READY:
if(licht_is_fading == false)
{
if(mp3_isused == true)
tanne_state = TA_FINSIHED;
else{
mp3_isused = true;
tanne_state = TA_MIN_PLAYING;
Serial.printf("All lights are ready for Oh Tannebaum\n");
//mp3ply.play_vol(SONG_OH_TANNEBAUM, TANNENBAUM_VOL);
mp3ply.play_vol(SONG_WINTER, TANNENBAUM_VOL);
szene_time_ms = msecs;
}
}
break;
case TA_MIN_PLAYING:
taster_aussen_licht.reset();
if(msecs - szene_time_ms > 1000)
tanne_state = TA_PLAYING;
break;
case TA_PLAYING:
if(msecs - szene_time_ms > TANNENBAUM_PLAY_MUSIC_MS || taster_aussen_licht.pressed() == true )
tanne_state = TA_STOP_PLAYING;
break;
case TA_STOP_PLAYING:
if(mp3ply.fade_out() == false)
{
Serial.printf("Oh Tannebaum faded out and stopped\n");
tanne_state = TA_FINSIHED;
mp3_isused = false;
}
break;
case TA_FINSIHED:
tanne_state = TA_INIT;
next_licht_szene_possible = true;
//taster_aussen_licht.reset();
Serial.printf("Tannenbaum finished\n");
break;
}
}
typedef enum {NA_INIT = 0, NA_LIGHT_READY, NA_FINISHED} szene_nacht_t;
szene_nacht_t nacht_state = NA_INIT;
void szene_nachts_dorf()
{
switch(nacht_state)
{
case NA_INIT:
Serial.printf("Nachts im Dorf\n");
licht_state_flag = LSTERNBILD1 | LSTERNBILD2 | LSTERNBILD3 | LSTERNE1 | LSTERNE2 | LTANNE | LBURG | LBAUHOF | LTEICH | LHAEUSER;
nacht_state = NA_LIGHT_READY;
break;
case NA_LIGHT_READY:
if(licht_is_fading == false)
{
nacht_state = NA_FINISHED;
Serial.printf("All lights are ready for Nachts im Dorf\n");
}
break;
case NA_FINISHED:
nacht_state = NA_INIT;
next_licht_szene_possible = true;
taster_aussen_licht.reset();
Serial.printf("Nachts im Dorf finished\n");
break;
}
}
typedef enum {SD_INIT = 0, SD_LIGHT_READY, SD_FINISHED} szene_schnee_t;
szene_schnee_t schnee_state = SD_INIT;
void szene_schnee_dorf()
{
switch(schnee_state)
{
case SD_INIT:
Serial.printf("Schnee im Dorf\n");
licht_state_flag = LSTERNE1 | LSTERNE2 | LTANNE | LBURG | LBAUHOF | LTEICH | LSPIEGEL | LHAEUSER;
schnee_state = SD_LIGHT_READY;
break;
case SD_LIGHT_READY:
if(licht_is_fading == false)
{
schnee_state = SD_FINISHED;
Serial.printf("All lights are ready for Schnee im Dorf\n");
}
break;
case SD_FINISHED:
schnee_state = SD_INIT;
next_licht_szene_possible = true;
taster_aussen_licht.reset();
Serial.printf("Schnee im Dorf finished\n");
break;
}
}
typedef enum {DU_INIT = 0, DU_LIGHT_READY, DU_FINISHED} szene_dunkel_t;
szene_dunkel_t dunkel_state = DU_INIT;
void szene_nachts()
{
switch(dunkel_state)
{
case DU_INIT:
Serial.printf("Dunkel im Dorf\n");
licht_state_flag = LSTERNBILD1 | LSTERNBILD2 | LSTERNBILD3 | LSTERNE1 | LSTERNE2;
dunkel_state = DU_LIGHT_READY;
break;
case DU_LIGHT_READY:
if(licht_is_fading == false)
{
dunkel_state = DU_FINISHED;
Serial.printf("All lights are ready for Dunkel im Dorf\n");
}
break;
case DU_FINISHED:
dunkel_state = DU_INIT;
next_licht_szene_possible = true;
taster_aussen_licht.reset();
Serial.printf("Dunkel im Dorf finished\n");
break;
}
}
typedef enum {TAG_INIT = 0, TAG_LIGHT_READY, TAG_FINISHED} szene_tag_t;
szene_tag_t tag_state = TAG_INIT;
void szene_tag_dorf()
{
switch(tag_state)
{
case TAG_INIT:
Serial.printf("Tag im Dorf\n");
licht_state_flag = LTANNE | LBACK;
tag_state = TAG_LIGHT_READY;
break;
case TAG_LIGHT_READY:
if(licht_is_fading == false)
{
tag_state = TAG_FINISHED;
Serial.printf("All lights are ready for Tag im Dorf\n");
}
break;
case TAG_FINISHED:
tag_state = TAG_INIT;
next_licht_szene_possible = true;
taster_aussen_licht.reset();
Serial.printf("Tag im Dorf finished\n");
break;
}
}
unsigned int zugunten_error = 0;
const unsigned int ZUGUNTEN_MAX_ERROR_COUNT = 5;
const unsigned long ZUGUNTEN_DRIVES_TO_STATION_MS = 4300;
const unsigned long ZUGUNTEN_STOPPED_AT_STATION_MS = 5000;
const unsigned long ZUGUNTEN_MAX_TIME_TO_HOME_MS = 35000;///21000; ///timeout time
typedef enum {ZU_INIT = 0, ZU_AT_HOME , ZU_DRIVES_TO_STATION, ZU_STOPPES_AT_STATION, ZU_STOPPED_AT_STATION, ZU_DRIVES_HOME, ZU_STOPPES_AT_HOME, ZU_STOPPED_PLAYING, ZU_DONE} szene_zugunten_t;
szene_zugunten_t zugunten_state = ZU_INIT;
bool mp3_zugunten = false;
void move_zugunten()
{
unsigned long msecs = millis();
switch(zugunten_state)
{
case ZU_INIT:
Serial.printf("Zugunten fährt\n");
//taster_train_unten.reset();
if (zugunten_error > ZUGUNTEN_MAX_ERROR_COUNT)
{
zugunten_state = ZU_DONE;
Serial.printf("Zugunten . More errors than allowed - will stop here.");
}
else
{
zugunten_state = ZU_AT_HOME;
if(mp3_isused == false)
{
Serial.printf("Playing Eine Insel\n");
//mp3ply.play_vol(SONG_EINE_INSEL, 20);
mp3ply.play_vol(SONG_WEIHNACHTSZEIT, 20);
mp3_zugunten = true;
mp3_isused = true;
}
else
mp3_zugunten = false;
}
break;
case ZU_AT_HOME:
szene_time_ms = msecs;
if(zugunten.fade_on() == false)
//zugunten_state = ZU_DRIVES_TO_STATION;
zugunten_state = ZU_DRIVES_HOME;
break;
case ZU_DRIVES_TO_STATION:
if(msecs - szene_time_ms > ZUGUNTEN_DRIVES_TO_STATION_MS)
{
zugunten_state = ZU_STOPPES_AT_STATION;
zugunten.switch_zero_relais(false);
}
break;
case ZU_STOPPES_AT_STATION:
szene_time_ms = msecs;
if(zugunten.fade_off() == false)
zugunten_state = ZU_STOPPED_AT_STATION;
break;
case ZU_STOPPED_AT_STATION:
if(msecs - szene_time_ms > ZUGUNTEN_STOPPED_AT_STATION_MS)
{
zugunten_state = ZU_DRIVES_HOME;
szene_time_ms = msecs;
}
break;
case ZU_DRIVES_HOME:
//if(zugunten.fade_on() == false)
if( (msecs-szene_time_ms) > ZUGUNTEN_MAX_TIME_TO_HOME_MS ) //taster_train_unten.pressed() == true ||)
{
if( (msecs-szene_time_ms) > ZUGUNTEN_MAX_TIME_TO_HOME_MS)
{
Serial.printf("Train unten runs ins timeout while driving back at Home\n");
// zugunten_error++;
}
else{
Serial.printf("Train unten back at Home pressed\n");
zugunten_error = 0;
}
zugunten_state = ZU_STOPPES_AT_HOME;
zugunten.switch_zero_relais(true);
}
break;
case ZU_STOPPES_AT_HOME:
if(zugunten.fade_off() == false)
zugunten_state = ZU_STOPPED_PLAYING;
break;
case ZU_STOPPED_PLAYING:
if(mp3_zugunten == true)
{
if(mp3ply.fade_out() == false ) //&& mp3ply.is_playing() == 0)
{
zugunten_state = ZU_DONE;
mp3_isused = false;
}
}
else
zugunten_state = ZU_DONE;
break;
case ZU_DONE:
next_move_szene_possible = true;
taster_aussen_move.reset();
zugunten_state = ZU_INIT;
Serial.printf("Zugunten stopped\n");
break;
}
}
bool mp3_zugoben = false;
unsigned int zugoben_error = 0;
const unsigned int ZUGOBEN_MAX_ERROR_COUNT = 5;
const unsigned long ZUGOBEN_DRIVES_TO_BRIDGE_MS = 1000;
const unsigned long ZUGOBEN_DRIVES_ON_BRIDGE_MS = 5500;
const unsigned long ZUGOBEN_MAX_TIME_TO_HOME_MS = 3*11550; ///timeout time
const uint8_t ZUGOBEN_SPEED_ON_BRIDGE = 80;
typedef enum {ZO_INIT = 0, ZO_AT_HOME, ZO_DRIVES_HOME, ZO_STOPPES_AT_HOME,ZO_STOPPED_PLAYING,ZO_DONE} szene_zugoben_t;
szene_zugoben_t zugoben_state = ZO_INIT;
void move_zugoben()
{
unsigned long msecs = millis();
switch(zugoben_state)
{
case ZO_INIT:
Serial.printf("Zugoben fährt\n");
//taster_train_oben.reset();
if (zugoben_error > ZUGOBEN_MAX_ERROR_COUNT)
zugoben_state = ZO_STOPPES_AT_HOME;
else
{
if(mp3_isused == false)
{
Serial.printf("Playing Weihnachtsbahn\n");
//mp3ply.play_vol(SONG_WEIHNACHTSBAHN, 20);
mp3ply.play_vol(SONG_ZEIT_ANGEKOMMEN, 20);
mp3_zugoben = true;
mp3_isused = true;
}
else
mp3_zugoben = false;
zugoben_state = ZO_AT_HOME;
}
break;
case ZO_AT_HOME:
szene_time_ms = msecs;
if(zugoben.fade_on() == false)
zugoben_state = ZO_DRIVES_HOME;
break;
case ZO_DRIVES_HOME:
if(zugoben.fade_on() == false)
if( (msecs-szene_time_ms) > ZUGOBEN_MAX_TIME_TO_HOME_MS ) //||taster_train_oben.pressed() == true )
{
if((msecs-szene_time_ms) > ZUGOBEN_MAX_TIME_TO_HOME_MS)
{
Serial.printf("Train oben runs in time out while driving back at home\n");
// zugoben_error++;
}
else
{
Serial.printf("Train oben back at Home pressed\n");
zugoben_error = 0;
}
zugoben_state = ZO_STOPPES_AT_HOME;
}
break;
case ZO_STOPPES_AT_HOME:
if(zugoben.fade_off() == false)
zugoben_state = ZO_STOPPED_PLAYING;
break;
case ZO_STOPPED_PLAYING:
if(mp3_zugoben == true)
{
if(mp3ply.fade_out() == false )
{
zugoben_state = ZO_DONE;
mp3_isused = false;
}
}
else
zugoben_state = ZO_DONE;
break;
case ZO_DONE:
zugoben_state = ZO_INIT;
next_move_szene_possible = true;
taster_aussen_move.reset();
Serial.printf("Zugoben stopped at home\n");
break;
}
}
bool mp3_soben = false;
unsigned int soben_error = 0;
const unsigned int SOBEN_MAX_ERROR_COUNT = 5;
const unsigned long SOBEN_MAX_DRIVES_TIME_MS = 30400; ///timeout time
typedef enum {SO_INIT = 0, SO_AT_HOME, SO_DRIVES_HOME, SO_STOPPES_AT_HOME,SO_STOPPED_PLAYING, SO_DONE} szene_soben_t;
szene_soben_t soben_state = SO_INIT;
void move_schiene_oben()
{
unsigned long msecs = millis();
switch(soben_state)
{
case SO_INIT:
Serial.printf("Schiene oben fährt\n");
//taster_schiene.reset();
if(soben_error > SOBEN_MAX_ERROR_COUNT)
soben_state = SO_STOPPES_AT_HOME;
else
{
if(mp3_isused == false)
{
Serial.printf("Playing Weihnachtsbäckerei\n");
if( random(0, 2) == 0 )
mp3ply.play_vol(SONG_WEIHNACHTSBAECKEREI, 23);
else
mp3ply.play_vol(SONG_WEIHNACHTSTRAUM, 23);
mp3_soben = true;
mp3_isused = true;
}
else
mp3_soben = false;
soben_state = SO_AT_HOME;
}
break;
case SO_AT_HOME:
szene_time_ms = millis();
relais_wolke_schiene.on();
//relais_wolke.on();
soben_state = SO_DRIVES_HOME;
break;
case SO_DRIVES_HOME:
if( (msecs-szene_time_ms) > SOBEN_MAX_DRIVES_TIME_MS) //||taster_schiene.pressed() == true )
{
if((msecs-szene_time_ms) > SOBEN_MAX_DRIVES_TIME_MS)
{
// soben_error++;
Serial.printf("Schiene oben timeout while driving home.\n");
}
else
{
soben_error = 0;
Serial.printf("Schiene oben back at Home pressed\n");
}
soben_state = SO_STOPPES_AT_HOME;
}
break;
case SO_STOPPES_AT_HOME:
relais_wolke_schiene.off();
//relais_wolke.off();
soben_state = SO_STOPPED_PLAYING;
break;
case SO_STOPPED_PLAYING:
if(mp3_soben == true)
{
if(mp3ply.fade_out() == false ) //&& mp3ply.is_playing() == 0)
{
soben_state = SO_DONE;
mp3_isused = false;
}
}
else
soben_state = SO_DONE;
break;
case SO_DONE:
soben_state = SO_INIT;
next_move_szene_possible = true;
taster_aussen_move.reset();
Serial.printf("Schiene oben stopped at home\n");
break;
}
}
void disco()
{
unsigned long disco_time = millis();
disco_all_count++;
uint32_t stored_licht_state_flag = licht_state_flag;
uint8_t randSongNumber = random(0, 4);
Serial.printf("Disco! Playing Song %d\n", randSongNumber);
switch(randSongNumber)
{
case 0:
mp3ply.play_vol(SONG_DISCO_LASTCHRISTMAS,25);
break;
case 1:
mp3ply.play_vol(SONG_DISCO_DOTHEYKNOWITSCHRISTMAS,25);
break;
case 2:
mp3ply.play_vol(SONG_DISCO_MARYSBOYCHILD,25);
break;
case 3:
mp3ply.play_vol(SONG_DISCO_MERRY_CHRISTMAS,25);
break;
default:
mp3ply.play_vol(SONG_DISCO_LASTCHRISTMAS,25);
break;
}
/*
while(mp3ply.is_playing() == 0)
{
disco_licht();
Serial.printf("Waiting until MP3 player starts\n");
delay(100);
}
*/
while(millis() - disco_time < MAX_DISCO_TIME)
{
disco_licht();
Serial.printf("Playing Disco!!!\n");
}
while(mp3ply.fade_out()==true)
{delay(100);}
Serial.printf("Disco done.\n");
rgb_leds.clear();
rgb_leds.show();
licht_state_flag = 0;
licht_update();
licht_state_flag = stored_licht_state_flag;
while( true == licht_update())
{delay(1);}
taster_aussen_licht.reset();
taster_aussen_move.reset();
}
bool licht_update()
{
bool fade_updated = false;
bool rainbow_updated = false;
fade_updated = led_sterne1.update() || fade_updated;
fade_updated = led_sterne2.update() || fade_updated;
fade_updated = led_sternbilder1.update() || fade_updated;
fade_updated = led_sternbilder2.update() || fade_updated;
fade_updated = led_sternbilder3.update()|| fade_updated;
rainbow_updated = led_tanne.update(leds::UP_RAINBOW) || rainbow_updated;
fade_updated = led_bauhof.update() || fade_updated;
fade_updated = led_burg.update() || fade_updated;
rainbow_updated = led_teich.update(leds::UP_BLUE) || rainbow_updated;
fade_updated = led_back.update() || fade_updated;
if((licht_state_flag & LHAEUSER) == 0)
{
//Serial.printf("Fade off lights at houses");
fade_updated = licht.fade_off() || fade_updated;
}
else
{
//Serial.printf("Fade on lights at houses");
fade_updated = licht.fade_on() || fade_updated;
}
if((licht_state_flag & LSPIEGEL) == 0)
relais_spiegel.off();
else
relais_spiegel.on();
if(true == rainbow_updated || true == fade_updated)
{
rgb_leds.show();
}
return(fade_updated);
}
void disco_licht()
{
led_sterne1.theaterChaseRainbow();
led_sterne2.theaterChaseRainbow();
led_sternbilder1.theaterChaseRainbow();
led_sternbilder2.theaterChaseRainbow();
led_sternbilder3.theaterChaseRainbow();
led_tanne.theaterChaseRainbow();
led_bauhof.theaterChaseRainbow();
led_burg.theaterChaseRainbow();
led_teich.theaterChaseRainbow();
led_back.theaterChaseRainbow();
licht.fade_off();
relais_spiegel.on();
rgb_leds.show();
}
void taster_abfrage()
{
if(next_licht_szene_possible == true && next_move_szene_possible == true && digitalRead(PIN_TASTER_AUSSEN_LICHT) == LOW && digitalRead(PIN_TASTER_AUSSEN_MOVE) == LOW)
{
disco();
}
else
{
if(next_licht_szene_possible == true)
{
if(taster_aussen_licht.pressed() == true)
{
Serial.printf("Aussenlicht pressed\n");
licht_szene++;
licht_all_count++;
next_licht_szene_possible = false;
}
}
if(next_move_szene_possible == true)
{
if(taster_aussen_move.pressed() == true)
{
Serial.printf("Move pressed\n");
move_szene++;
move_all_count++;
next_move_szene_possible = false;
}
}
}
}
uint8_t nvs_value = 0;
void updateNVS()
{
if(millis() - last_updated_NVS > 1000)
{
last_updated_NVS = millis();
switch(nvs_value)
{
case 0:
NVS.setInt("licht_cnt", licht_all_count);
break;
case 1:
NVS.setInt("move_cnt", move_all_count);
break;
case 2:
NVS.setInt("disco_cnt", disco_all_count);
break;
}
if(nvs_value == 2)
nvs_value = 0;
else
nvs_value++;
}
}
unsigned long display_time_ms = 0;
const unsigned long MAX_DISPLAY_TIME_BEFORE_FLIP_MS = 600000;
void show_counters()
{
if(millis() - display_time_ms > MAX_DISPLAY_TIME_BEFORE_FLIP_MS)
{
display_time_ms = millis();
moni.flipScreenVert();
}
moni.clear();
moni.header("Zaehler");
moni.data(20,12,(uint64_t)licht_all_count, "Licht");
moni.data(60,12, (uint64_t)disco_all_count, "Disco");
moni.data(100,12, (uint64_t)move_all_count, "Moves");
moni.data(15,38,(uint64_t)zugunten_error, "ZUErr");
moni.data(60,38,(uint64_t)zugoben_error, "ZOErr");
moni.data(100,38,(uint64_t)soben_error, "SOErr");
moni.show();
}

View file

@ -1,11 +0,0 @@
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