refactor display

This commit is contained in:
Christopher Liebman 2018-03-04 16:40:46 -08:00
parent 3b6472f41e
commit e53d9270dc
8 changed files with 749 additions and 77 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ libraries
core
*.bak
*-bak
spec.d

473
DialogInput_plain_10.h Normal file
View File

@ -0,0 +1,473 @@
/*
* DialogInput_plain_10.h
*
* Created on: Mar 4, 2018
* Author: chris.l
*/
#ifndef DIALOGINPUT_PLAIN_10_H_
#define DIALOGINPUT_PLAIN_10_H_
// 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 char DialogInput_plain_10[] PROGMEM = {
0x06, // Width: 6
0x0D, // Height: 13
0x20, // First Char: 32
0xE0, // Numbers of Chars: 224
// Jump Table:
0xFF, 0xFF, 0x00, 0x06, // 32:65535
0x00, 0x00, 0x08, 0x06, // 33:0
0x00, 0x08, 0x09, 0x06, // 34:8
0x00, 0x11, 0x0B, 0x06, // 35:17
0x00, 0x1C, 0x0C, 0x06, // 36:28
0x00, 0x28, 0x0C, 0x06, // 37:40
0x00, 0x34, 0x0C, 0x06, // 38:52
0x00, 0x40, 0x07, 0x06, // 39:64
0x00, 0x47, 0x08, 0x06, // 40:71
0x00, 0x4F, 0x08, 0x06, // 41:79
0x00, 0x57, 0x0B, 0x06, // 42:87
0x00, 0x62, 0x0B, 0x06, // 43:98
0x00, 0x6D, 0x06, 0x06, // 44:109
0x00, 0x73, 0x09, 0x06, // 45:115
0x00, 0x7C, 0x06, 0x06, // 46:124
0x00, 0x82, 0x0B, 0x06, // 47:130
0x00, 0x8D, 0x0C, 0x06, // 48:141
0x00, 0x99, 0x0C, 0x06, // 49:153
0x00, 0xA5, 0x0C, 0x06, // 50:165
0x00, 0xB1, 0x0C, 0x06, // 51:177
0x00, 0xBD, 0x0B, 0x06, // 52:189
0x00, 0xC8, 0x0C, 0x06, // 53:200
0x00, 0xD4, 0x0C, 0x06, // 54:212
0x00, 0xE0, 0x0B, 0x06, // 55:224
0x00, 0xEB, 0x0C, 0x06, // 56:235
0x00, 0xF7, 0x0C, 0x06, // 57:247
0x01, 0x03, 0x06, 0x06, // 58:259
0x01, 0x09, 0x06, 0x06, // 59:265
0x01, 0x0F, 0x0C, 0x06, // 60:271
0x01, 0x1B, 0x09, 0x06, // 61:283
0x01, 0x24, 0x0B, 0x06, // 62:292
0x01, 0x2F, 0x09, 0x06, // 63:303
0x01, 0x38, 0x0C, 0x06, // 64:312
0x01, 0x44, 0x0C, 0x06, // 65:324
0x01, 0x50, 0x0C, 0x06, // 66:336
0x01, 0x5C, 0x0C, 0x06, // 67:348
0x01, 0x68, 0x0C, 0x06, // 68:360
0x01, 0x74, 0x0C, 0x06, // 69:372
0x01, 0x80, 0x0B, 0x06, // 70:384
0x01, 0x8B, 0x0C, 0x06, // 71:395
0x01, 0x97, 0x0C, 0x06, // 72:407
0x01, 0xA3, 0x0C, 0x06, // 73:419
0x01, 0xAF, 0x0A, 0x06, // 74:431
0x01, 0xB9, 0x0C, 0x06, // 75:441
0x01, 0xC5, 0x0C, 0x06, // 76:453
0x01, 0xD1, 0x0C, 0x06, // 77:465
0x01, 0xDD, 0x0C, 0x06, // 78:477
0x01, 0xE9, 0x0C, 0x06, // 79:489
0x01, 0xF5, 0x0B, 0x06, // 80:501
0x02, 0x00, 0x0C, 0x06, // 81:512
0x02, 0x0C, 0x0C, 0x06, // 82:524
0x02, 0x18, 0x0C, 0x06, // 83:536
0x02, 0x24, 0x0B, 0x06, // 84:548
0x02, 0x2F, 0x0C, 0x06, // 85:559
0x02, 0x3B, 0x0B, 0x06, // 86:571
0x02, 0x46, 0x0B, 0x06, // 87:582
0x02, 0x51, 0x0C, 0x06, // 88:593
0x02, 0x5D, 0x0B, 0x06, // 89:605
0x02, 0x68, 0x0C, 0x06, // 90:616
0x02, 0x74, 0x08, 0x06, // 91:628
0x02, 0x7C, 0x0C, 0x06, // 92:636
0x02, 0x88, 0x08, 0x06, // 93:648
0x02, 0x90, 0x09, 0x06, // 94:656
0x02, 0x99, 0x0C, 0x06, // 95:665
0x02, 0xA5, 0x05, 0x06, // 96:677
0x02, 0xAA, 0x0C, 0x06, // 97:682
0x02, 0xB6, 0x0C, 0x06, // 98:694
0x02, 0xC2, 0x0A, 0x06, // 99:706
0x02, 0xCC, 0x0C, 0x06, // 100:716
0x02, 0xD8, 0x0C, 0x06, // 101:728
0x02, 0xE4, 0x09, 0x06, // 102:740
0x02, 0xED, 0x0C, 0x06, // 103:749
0x02, 0xF9, 0x0C, 0x06, // 104:761
0x03, 0x05, 0x0C, 0x06, // 105:773
0x03, 0x11, 0x08, 0x06, // 106:785
0x03, 0x19, 0x0C, 0x06, // 107:793
0x03, 0x25, 0x0A, 0x06, // 108:805
0x03, 0x2F, 0x0C, 0x06, // 109:815
0x03, 0x3B, 0x0C, 0x06, // 110:827
0x03, 0x47, 0x0C, 0x06, // 111:839
0x03, 0x53, 0x0C, 0x06, // 112:851
0x03, 0x5F, 0x0C, 0x06, // 113:863
0x03, 0x6B, 0x0B, 0x06, // 114:875
0x03, 0x76, 0x0C, 0x06, // 115:886
0x03, 0x82, 0x0A, 0x06, // 116:898
0x03, 0x8C, 0x0C, 0x06, // 117:908
0x03, 0x98, 0x0B, 0x06, // 118:920
0x03, 0xA3, 0x0B, 0x06, // 119:931
0x03, 0xAE, 0x0C, 0x06, // 120:942
0x03, 0xBA, 0x0B, 0x06, // 121:954
0x03, 0xC5, 0x0C, 0x06, // 122:965
0x03, 0xD1, 0x0A, 0x06, // 123:977
0x03, 0xDB, 0x08, 0x06, // 124:987
0x03, 0xE3, 0x0B, 0x06, // 125:995
0x03, 0xEE, 0x0B, 0x06, // 126:1006
0x03, 0xF9, 0x0C, 0x06, // 127:1017
0x04, 0x05, 0x0C, 0x06, // 128:1029
0x04, 0x11, 0x0C, 0x06, // 129:1041
0x04, 0x1D, 0x0C, 0x06, // 130:1053
0x04, 0x29, 0x0C, 0x06, // 131:1065
0x04, 0x35, 0x0C, 0x06, // 132:1077
0x04, 0x41, 0x0C, 0x06, // 133:1089
0x04, 0x4D, 0x0C, 0x06, // 134:1101
0x04, 0x59, 0x0C, 0x06, // 135:1113
0x04, 0x65, 0x0C, 0x06, // 136:1125
0x04, 0x71, 0x0C, 0x06, // 137:1137
0x04, 0x7D, 0x0C, 0x06, // 138:1149
0x04, 0x89, 0x0C, 0x06, // 139:1161
0x04, 0x95, 0x0C, 0x06, // 140:1173
0x04, 0xA1, 0x0C, 0x06, // 141:1185
0x04, 0xAD, 0x0C, 0x06, // 142:1197
0x04, 0xB9, 0x0C, 0x06, // 143:1209
0x04, 0xC5, 0x0C, 0x06, // 144:1221
0x04, 0xD1, 0x0C, 0x06, // 145:1233
0x04, 0xDD, 0x0C, 0x06, // 146:1245
0x04, 0xE9, 0x0C, 0x06, // 147:1257
0x04, 0xF5, 0x0C, 0x06, // 148:1269
0x05, 0x01, 0x0C, 0x06, // 149:1281
0x05, 0x0D, 0x0C, 0x06, // 150:1293
0x05, 0x19, 0x0C, 0x06, // 151:1305
0x05, 0x25, 0x0C, 0x06, // 152:1317
0x05, 0x31, 0x0C, 0x06, // 153:1329
0x05, 0x3D, 0x0C, 0x06, // 154:1341
0x05, 0x49, 0x0C, 0x06, // 155:1353
0x05, 0x55, 0x0C, 0x06, // 156:1365
0x05, 0x61, 0x0C, 0x06, // 157:1377
0x05, 0x6D, 0x0C, 0x06, // 158:1389
0x05, 0x79, 0x0C, 0x06, // 159:1401
0xFF, 0xFF, 0x00, 0x06, // 160:65535
0x05, 0x85, 0x08, 0x06, // 161:1413
0x05, 0x8D, 0x0A, 0x06, // 162:1421
0x05, 0x97, 0x0C, 0x06, // 163:1431
0x05, 0xA3, 0x0C, 0x06, // 164:1443
0x05, 0xAF, 0x0B, 0x06, // 165:1455
0x05, 0xBA, 0x08, 0x06, // 166:1466
0x05, 0xC2, 0x0A, 0x06, // 167:1474
0x05, 0xCC, 0x09, 0x06, // 168:1484
0x05, 0xD5, 0x0B, 0x06, // 169:1493
0x05, 0xE0, 0x0A, 0x06, // 170:1504
0x05, 0xEA, 0x0A, 0x06, // 171:1514
0x05, 0xF4, 0x0B, 0x06, // 172:1524
0x05, 0xFF, 0x09, 0x06, // 173:1535
0x06, 0x08, 0x0B, 0x06, // 174:1544
0x06, 0x13, 0x09, 0x06, // 175:1555
0x06, 0x1C, 0x07, 0x06, // 176:1564
0x06, 0x23, 0x0C, 0x06, // 177:1571
0x06, 0x2F, 0x09, 0x06, // 178:1583
0x06, 0x38, 0x09, 0x06, // 179:1592
0x06, 0x41, 0x07, 0x06, // 180:1601
0x06, 0x48, 0x0C, 0x06, // 181:1608
0x06, 0x54, 0x0C, 0x06, // 182:1620
0x06, 0x60, 0x05, 0x06, // 183:1632
0x06, 0x65, 0x08, 0x06, // 184:1637
0x06, 0x6D, 0x09, 0x06, // 185:1645
0x06, 0x76, 0x0A, 0x06, // 186:1654
0x06, 0x80, 0x09, 0x06, // 187:1664
0x06, 0x89, 0x0C, 0x06, // 188:1673
0x06, 0x95, 0x0C, 0x06, // 189:1685
0x06, 0xA1, 0x0C, 0x06, // 190:1697
0x06, 0xAD, 0x0A, 0x06, // 191:1709
0x06, 0xB7, 0x0C, 0x06, // 192:1719
0x06, 0xC3, 0x0C, 0x06, // 193:1731
0x06, 0xCF, 0x0C, 0x06, // 194:1743
0x06, 0xDB, 0x0C, 0x06, // 195:1755
0x06, 0xE7, 0x0C, 0x06, // 196:1767
0x06, 0xF3, 0x0C, 0x06, // 197:1779
0x06, 0xFF, 0x0C, 0x06, // 198:1791
0x07, 0x0B, 0x0C, 0x06, // 199:1803
0x07, 0x17, 0x0C, 0x06, // 200:1815
0x07, 0x23, 0x0C, 0x06, // 201:1827
0x07, 0x2F, 0x0C, 0x06, // 202:1839
0x07, 0x3B, 0x0C, 0x06, // 203:1851
0x07, 0x47, 0x0C, 0x06, // 204:1863
0x07, 0x53, 0x0C, 0x06, // 205:1875
0x07, 0x5F, 0x0C, 0x06, // 206:1887
0x07, 0x6B, 0x0C, 0x06, // 207:1899
0x07, 0x77, 0x0C, 0x06, // 208:1911
0x07, 0x83, 0x0C, 0x06, // 209:1923
0x07, 0x8F, 0x0C, 0x06, // 210:1935
0x07, 0x9B, 0x0C, 0x06, // 211:1947
0x07, 0xA7, 0x0C, 0x06, // 212:1959
0x07, 0xB3, 0x0C, 0x06, // 213:1971
0x07, 0xBF, 0x0C, 0x06, // 214:1983
0x07, 0xCB, 0x0C, 0x06, // 215:1995
0x07, 0xD7, 0x0C, 0x06, // 216:2007
0x07, 0xE3, 0x0C, 0x06, // 217:2019
0x07, 0xEF, 0x0C, 0x06, // 218:2031
0x07, 0xFB, 0x0C, 0x06, // 219:2043
0x08, 0x07, 0x0C, 0x06, // 220:2055
0x08, 0x13, 0x0B, 0x06, // 221:2067
0x08, 0x1E, 0x0B, 0x06, // 222:2078
0x08, 0x29, 0x0C, 0x06, // 223:2089
0x08, 0x35, 0x0C, 0x06, // 224:2101
0x08, 0x41, 0x0C, 0x06, // 225:2113
0x08, 0x4D, 0x0C, 0x06, // 226:2125
0x08, 0x59, 0x0C, 0x06, // 227:2137
0x08, 0x65, 0x0C, 0x06, // 228:2149
0x08, 0x71, 0x0C, 0x06, // 229:2161
0x08, 0x7D, 0x0C, 0x06, // 230:2173
0x08, 0x89, 0x0A, 0x06, // 231:2185
0x08, 0x93, 0x0C, 0x06, // 232:2195
0x08, 0x9F, 0x0C, 0x06, // 233:2207
0x08, 0xAB, 0x0C, 0x06, // 234:2219
0x08, 0xB7, 0x0C, 0x06, // 235:2231
0x08, 0xC3, 0x0C, 0x06, // 236:2243
0x08, 0xCF, 0x0C, 0x06, // 237:2255
0x08, 0xDB, 0x0C, 0x06, // 238:2267
0x08, 0xE7, 0x0C, 0x06, // 239:2279
0x08, 0xF3, 0x0C, 0x06, // 240:2291
0x08, 0xFF, 0x0C, 0x06, // 241:2303
0x09, 0x0B, 0x0C, 0x06, // 242:2315
0x09, 0x17, 0x0C, 0x06, // 243:2327
0x09, 0x23, 0x0C, 0x06, // 244:2339
0x09, 0x2F, 0x0C, 0x06, // 245:2351
0x09, 0x3B, 0x0C, 0x06, // 246:2363
0x09, 0x47, 0x09, 0x06, // 247:2375
0x09, 0x50, 0x0C, 0x06, // 248:2384
0x09, 0x5C, 0x0C, 0x06, // 249:2396
0x09, 0x68, 0x0C, 0x06, // 250:2408
0x09, 0x74, 0x0C, 0x06, // 251:2420
0x09, 0x80, 0x0C, 0x06, // 252:2432
0x09, 0x8C, 0x0B, 0x06, // 253:2444
0x09, 0x97, 0x0C, 0x06, // 254:2455
0x09, 0xA3, 0x0B, 0x06, // 255:2467
// Font Data:
0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x02, // 33
0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38, // 34
0x80,0x00,0xE0,0x03,0xB8,0x00,0xE0,0x03,0xB8,0x00,0x20, // 35
0x00,0x00,0x60,0x02,0x50,0x02,0xF8,0x07,0x90,0x02,0x90,0x01, // 36
0x38,0x00,0xA8,0x00,0x78,0x00,0xC0,0x03,0xA0,0x02,0x80,0x03, // 37
0x00,0x00,0xC0,0x01,0x38,0x02,0x68,0x02,0x88,0x01,0xC0,0x02, // 38
0x00,0x00,0x00,0x00,0x00,0x00,0x38, // 39
0x00,0x00,0x00,0x00,0xF8,0x03,0x04,0x04, // 40
0x00,0x00,0x00,0x00,0x0C,0x06,0xF0,0x01, // 41
0x00,0x00,0x48,0x00,0x30,0x00,0x78,0x00,0x30,0x00,0x48, // 42
0x00,0x00,0x40,0x00,0x40,0x00,0xF0,0x01,0x40,0x00,0x40, // 43
0x00,0x00,0x00,0x00,0x00,0x0E, // 44
0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80, // 45
0x00,0x00,0x00,0x00,0x00,0x02, // 46
0x00,0x00,0x00,0x04,0x00,0x03,0xC0,0x00,0x30,0x00,0x08, // 47
0x00,0x00,0xF0,0x01,0x08,0x02,0x48,0x02,0x08,0x02,0xF0,0x01, // 48
0x00,0x00,0x08,0x02,0x08,0x02,0xF8,0x03,0x00,0x02,0x00,0x02, // 49
0x00,0x00,0x10,0x02,0x08,0x03,0x88,0x02,0xC8,0x02,0x70,0x02, // 50
0x00,0x00,0x10,0x01,0x48,0x02,0x48,0x02,0x48,0x02,0xB0,0x01, // 51
0x00,0x00,0xC0,0x00,0xE0,0x00,0x90,0x00,0xF8,0x03,0x80, // 52
0x00,0x00,0x38,0x02,0x28,0x02,0x28,0x02,0x28,0x02,0xC0,0x01, // 53
0x00,0x00,0xF0,0x01,0x58,0x02,0x48,0x02,0x48,0x02,0x88,0x01, // 54
0x00,0x00,0x08,0x00,0x08,0x02,0x88,0x01,0x78,0x00,0x18, // 55
0x00,0x00,0xB0,0x01,0x48,0x02,0x48,0x02,0x48,0x02,0xB0,0x01, // 56
0x00,0x00,0x30,0x02,0x48,0x02,0x48,0x02,0x48,0x03,0xF0,0x01, // 57
0x00,0x00,0x00,0x00,0x20,0x02, // 58
0x00,0x00,0x00,0x00,0x20,0x0E, // 59
0x00,0x00,0x40,0x00,0xA0,0x00,0xA0,0x00,0xA0,0x00,0x10,0x01, // 60
0xA0,0x00,0xA0,0x00,0xA0,0x00,0xA0,0x00,0xA0, // 61
0x00,0x00,0x10,0x01,0xA0,0x00,0xA0,0x00,0xA0,0x00,0x40, // 62
0x00,0x00,0x08,0x00,0xC8,0x02,0x28,0x00,0x18, // 63
0x00,0x00,0xE0,0x03,0x18,0x04,0xE8,0x0B,0x28,0x0A,0xF0,0x03, // 64
0x00,0x00,0x00,0x03,0xE0,0x00,0x98,0x00,0xE0,0x00,0x00,0x03, // 65
0x00,0x00,0xF8,0x03,0x48,0x02,0x48,0x02,0x48,0x02,0xB0,0x01, // 66
0x00,0x00,0xF0,0x01,0x18,0x03,0x08,0x02,0x08,0x02,0x18,0x03, // 67
0x00,0x00,0xF8,0x03,0x08,0x02,0x08,0x02,0x18,0x03,0xF0,0x01, // 68
0x00,0x00,0xF8,0x03,0x48,0x02,0x48,0x02,0x48,0x02,0x48,0x02, // 69
0x00,0x00,0xF8,0x03,0x48,0x00,0x48,0x00,0x48,0x00,0x48, // 70
0x00,0x00,0xF0,0x01,0x18,0x03,0x08,0x02,0x48,0x02,0xD0,0x03, // 71
0x00,0x00,0xF8,0x03,0x40,0x00,0x40,0x00,0x40,0x00,0xF8,0x03, // 72
0x00,0x00,0x08,0x02,0x08,0x02,0xF8,0x03,0x08,0x02,0x08,0x02, // 73
0x00,0x00,0x00,0x01,0x08,0x02,0x08,0x02,0xF8,0x01, // 74
0x00,0x00,0xF8,0x03,0x40,0x00,0xA0,0x00,0x10,0x01,0x08,0x02, // 75
0x00,0x00,0xF8,0x03,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02, // 76
0x00,0x00,0xF8,0x03,0x30,0x00,0x40,0x00,0x30,0x00,0xF8,0x03, // 77
0x00,0x00,0xF8,0x03,0x30,0x00,0x40,0x00,0x80,0x01,0xF8,0x03, // 78
0x00,0x00,0xF0,0x01,0x08,0x02,0x08,0x02,0x08,0x02,0xF0,0x01, // 79
0x00,0x00,0xF8,0x03,0x48,0x00,0x48,0x00,0x48,0x00,0x30, // 80
0x00,0x00,0xF0,0x01,0x08,0x02,0x08,0x02,0x08,0x06,0xF0,0x05, // 81
0x00,0x00,0xF8,0x03,0x48,0x00,0x48,0x00,0xC8,0x00,0xB0,0x01, // 82
0x00,0x00,0x30,0x01,0x48,0x02,0x48,0x02,0x48,0x02,0x90,0x01, // 83
0x00,0x00,0x08,0x00,0x08,0x00,0xF8,0x03,0x08,0x00,0x08, // 84
0x00,0x00,0xF8,0x01,0x00,0x02,0x00,0x02,0x00,0x02,0xF8,0x01, // 85
0x00,0x00,0x18,0x00,0xE0,0x00,0x00,0x03,0xE0,0x00,0x18, // 86
0x38,0x00,0xC0,0x03,0x70,0x00,0x70,0x00,0xC0,0x03,0x38, // 87
0x00,0x00,0x08,0x02,0xB0,0x01,0x40,0x00,0xB0,0x01,0x08,0x02, // 88
0x00,0x00,0x08,0x00,0x30,0x00,0xC0,0x03,0x30,0x00,0x08, // 89
0x00,0x00,0x08,0x02,0x88,0x03,0x48,0x02,0x38,0x02,0x08,0x02, // 90
0x00,0x00,0x00,0x00,0xFC,0x07,0x04,0x04, // 91
0x00,0x00,0x08,0x00,0x30,0x00,0xC0,0x00,0x00,0x03,0x00,0x04, // 92
0x00,0x00,0x00,0x00,0x04,0x04,0xFC,0x07, // 93
0x20,0x00,0x10,0x00,0x08,0x00,0x10,0x00,0x20, // 94
0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08, // 95
0x00,0x00,0x04,0x00,0x08, // 96
0x00,0x00,0x20,0x03,0xA0,0x02,0xA0,0x02,0xA0,0x02,0xC0,0x03, // 97
0x00,0x00,0xFC,0x03,0x20,0x02,0x20,0x02,0x20,0x02,0xC0,0x01, // 98
0x00,0x00,0xC0,0x01,0x20,0x02,0x20,0x02,0x20,0x02, // 99
0x00,0x00,0xC0,0x01,0x20,0x02,0x20,0x02,0x20,0x02,0xFC,0x03, // 100
0x00,0x00,0xC0,0x01,0xA0,0x02,0xA0,0x02,0xA0,0x02,0xC0,0x02, // 101
0x00,0x00,0x20,0x00,0xF8,0x03,0x24,0x00,0x24, // 102
0x00,0x00,0xC0,0x01,0x20,0x0A,0x20,0x0A,0x20,0x0A,0xE0,0x07, // 103
0x00,0x00,0xFC,0x03,0x40,0x00,0x20,0x00,0x20,0x00,0xC0,0x03, // 104
0x00,0x00,0x00,0x02,0x20,0x02,0xE4,0x03,0x00,0x02,0x00,0x02, // 105
0x00,0x00,0x20,0x08,0x20,0x08,0xE4,0x07, // 106
0x00,0x00,0xFC,0x03,0x80,0x00,0xC0,0x00,0x20,0x01,0x00,0x02, // 107
0x04,0x00,0x04,0x00,0xFC,0x01,0x00,0x02,0x00,0x02, // 108
0x00,0x00,0xE0,0x03,0x20,0x00,0xE0,0x03,0x20,0x00,0xE0,0x03, // 109
0x00,0x00,0xE0,0x03,0x40,0x00,0x20,0x00,0x20,0x00,0xC0,0x03, // 110
0x00,0x00,0xC0,0x01,0x20,0x02,0x20,0x02,0x20,0x02,0xC0,0x01, // 111
0x00,0x00,0xE0,0x0F,0x20,0x02,0x20,0x02,0x20,0x02,0xC0,0x01, // 112
0x00,0x00,0xC0,0x01,0x20,0x02,0x20,0x02,0x20,0x02,0xE0,0x0F, // 113
0x00,0x00,0x00,0x00,0xE0,0x03,0x20,0x00,0x20,0x00,0x60, // 114
0x00,0x00,0x40,0x02,0xA0,0x02,0xA0,0x02,0xA0,0x02,0xA0,0x01, // 115
0x00,0x00,0x20,0x00,0xF8,0x03,0x20,0x02,0x20,0x02, // 116
0x00,0x00,0xE0,0x01,0x00,0x02,0x00,0x02,0x00,0x02,0xE0,0x03, // 117
0x00,0x00,0x20,0x00,0xC0,0x01,0x00,0x02,0xC0,0x01,0x20, // 118
0x00,0x00,0x60,0x00,0x80,0x03,0x40,0x00,0x80,0x03,0x60, // 119
0x00,0x00,0x20,0x02,0x60,0x03,0x80,0x00,0x60,0x03,0x20,0x02, // 120
0x00,0x00,0x20,0x08,0xC0,0x08,0x00,0x07,0xC0,0x00,0x20, // 121
0x00,0x00,0x20,0x02,0x20,0x03,0xA0,0x02,0x60,0x02,0x20,0x02, // 122
0x00,0x00,0x40,0x00,0x40,0x00,0xBC,0x07,0x04,0x04, // 123
0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x0F, // 124
0x00,0x00,0x00,0x00,0x04,0x04,0xBC,0x07,0x40,0x00,0x40, // 125
0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x80,0x00,0x80, // 126
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 127
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 128
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 129
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 130
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 131
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 132
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 133
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 134
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 135
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 136
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 137
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 138
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 139
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 140
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 141
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 142
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 143
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 144
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 145
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 146
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 147
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 148
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 149
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 150
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 151
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 152
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 153
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 154
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 155
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 156
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 157
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 158
0x00,0x00,0xF8,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x0F, // 159
0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x0F, // 161
0x00,0x00,0xC0,0x01,0x20,0x02,0xF0,0x0F,0x20,0x02, // 162
0x00,0x00,0x40,0x02,0xF0,0x03,0x48,0x02,0x48,0x02,0x08,0x02, // 163
0x00,0x00,0x10,0x01,0xE0,0x00,0xA0,0x00,0xE0,0x00,0x10,0x01, // 164
0x00,0x00,0xA8,0x00,0xB0,0x00,0xC0,0x03,0xB0,0x00,0xA8, // 165
0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x0F, // 166
0x00,0x00,0xD8,0x04,0xA8,0x04,0x68,0x05,0xC8,0x06, // 167
0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04, // 168
0xE0,0x00,0x18,0x03,0x68,0x02,0x98,0x02,0x98,0x03,0xE0, // 169
0x00,0x00,0x78,0x01,0x58,0x01,0x58,0x01,0x78,0x01, // 170
0x00,0x00,0xC0,0x00,0x20,0x01,0xC0,0x00,0x20,0x01, // 171
0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0xC0, // 172
0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80, // 173
0xE0,0x00,0x18,0x03,0xF8,0x02,0x78,0x02,0xB8,0x03,0xE0, // 174
0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08, // 175
0x00,0x00,0x38,0x00,0x28,0x00,0x38, // 176
0x00,0x00,0x40,0x02,0x40,0x02,0xF0,0x03,0x40,0x02,0x40,0x02, // 177
0x00,0x00,0x00,0x00,0x48,0x00,0x68,0x00,0x58, // 178
0x00,0x00,0x00,0x00,0x48,0x00,0x58,0x00,0x68, // 179
0x00,0x00,0x00,0x00,0x08,0x00,0x04, // 180
0x00,0x00,0xE0,0x0F,0x00,0x02,0x00,0x02,0x00,0x02,0xE0,0x03, // 181
0x00,0x00,0x30,0x00,0x78,0x00,0xF8,0x07,0x08,0x00,0xF8,0x07, // 182
0x00,0x00,0x00,0x00,0xC0, // 183
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C, // 184
0x00,0x00,0x00,0x00,0x48,0x00,0x78,0x00,0x40, // 185
0x00,0x00,0x30,0x01,0x48,0x01,0x48,0x01,0x30,0x01, // 186
0x00,0x00,0x20,0x01,0xC0,0x00,0x20,0x01,0xC0, // 187
0x80,0x00,0xA4,0x00,0xFC,0x06,0x60,0x06,0x40,0x0F,0x00,0x04, // 188
0x80,0x00,0xA4,0x00,0xFC,0x00,0x60,0x09,0x40,0x0D,0x00,0x0B, // 189
0x80,0x00,0xA4,0x00,0xEC,0x06,0x74,0x06,0x40,0x0F,0x00,0x04, // 190
0x00,0x00,0x00,0x0C,0x00,0x0A,0xA0,0x09,0x00,0x08, // 191
0x00,0x00,0x00,0x03,0xE1,0x00,0x9A,0x00,0xE0,0x00,0x00,0x03, // 192
0x00,0x00,0x00,0x03,0xE0,0x00,0x9A,0x00,0xE1,0x00,0x00,0x03, // 193
0x00,0x00,0x00,0x03,0xE2,0x00,0x99,0x00,0xE2,0x00,0x00,0x03, // 194
0x00,0x00,0x00,0x03,0xE3,0x00,0x9A,0x00,0xE1,0x00,0x00,0x03, // 195
0x00,0x00,0x00,0x03,0xE2,0x00,0x98,0x00,0xE2,0x00,0x00,0x03, // 196
0x00,0x00,0x00,0x03,0xE6,0x00,0x9A,0x00,0xE6,0x00,0x00,0x03, // 197
0x00,0x03,0xE0,0x00,0x98,0x00,0xF8,0x03,0x48,0x02,0x48,0x02, // 198
0x00,0x00,0xF0,0x01,0x18,0x0B,0x08,0x0E,0x08,0x02,0x18,0x03, // 199
0x00,0x00,0xF8,0x03,0x49,0x02,0x4A,0x02,0x48,0x02,0x48,0x02, // 200
0x00,0x00,0xF8,0x03,0x48,0x02,0x4A,0x02,0x49,0x02,0x48,0x02, // 201
0x00,0x00,0xF8,0x03,0x4A,0x02,0x49,0x02,0x4A,0x02,0x48,0x02, // 202
0x00,0x00,0xF8,0x03,0x4A,0x02,0x48,0x02,0x4A,0x02,0x48,0x02, // 203
0x00,0x00,0x08,0x02,0x09,0x02,0xFA,0x03,0x08,0x02,0x08,0x02, // 204
0x00,0x00,0x08,0x02,0x08,0x02,0xFA,0x03,0x09,0x02,0x08,0x02, // 205
0x00,0x00,0x08,0x02,0x0A,0x02,0xF9,0x03,0x0A,0x02,0x08,0x02, // 206
0x00,0x00,0x08,0x02,0x0A,0x02,0xF8,0x03,0x0A,0x02,0x08,0x02, // 207
0x40,0x00,0xF8,0x03,0x48,0x02,0x08,0x02,0x18,0x03,0xF0,0x01, // 208
0x00,0x00,0xF8,0x03,0x33,0x00,0x42,0x00,0x81,0x01,0xF8,0x03, // 209
0x00,0x00,0xF0,0x01,0x09,0x02,0x0A,0x02,0x08,0x02,0xF0,0x01, // 210
0x00,0x00,0xF0,0x01,0x08,0x02,0x0A,0x02,0x09,0x02,0xF0,0x01, // 211
0x00,0x00,0xF0,0x01,0x0A,0x02,0x09,0x02,0x0A,0x02,0xF0,0x01, // 212
0x00,0x00,0xF0,0x01,0x0B,0x02,0x0A,0x02,0x09,0x02,0xF0,0x01, // 213
0x00,0x00,0xF0,0x01,0x0A,0x02,0x08,0x02,0x0A,0x02,0xF0,0x01, // 214
0x00,0x00,0x20,0x02,0x40,0x01,0x80,0x00,0x40,0x01,0x20,0x02, // 215
0x00,0x02,0xF0,0x01,0x88,0x02,0x48,0x02,0x28,0x02,0xF8,0x01, // 216
0x00,0x00,0xF8,0x01,0x01,0x02,0x02,0x02,0x00,0x02,0xF8,0x01, // 217
0x00,0x00,0xF8,0x01,0x00,0x02,0x02,0x02,0x01,0x02,0xF8,0x01, // 218
0x00,0x00,0xF8,0x01,0x02,0x02,0x01,0x02,0x02,0x02,0xF8,0x01, // 219
0x00,0x00,0xF8,0x01,0x02,0x02,0x00,0x02,0x02,0x02,0xF8,0x01, // 220
0x00,0x00,0x08,0x00,0x30,0x00,0xC2,0x03,0x31,0x00,0x08, // 221
0x00,0x00,0xF8,0x03,0x90,0x00,0x90,0x00,0x90,0x00,0x60, // 222
0x00,0x00,0xF8,0x03,0x04,0x00,0x74,0x02,0x98,0x02,0x80,0x03, // 223
0x00,0x00,0x24,0x03,0xA8,0x02,0xA0,0x02,0xA0,0x02,0xC0,0x03, // 224
0x00,0x00,0x20,0x03,0xA8,0x02,0xA4,0x02,0xA0,0x02,0xC0,0x03, // 225
0x00,0x00,0x28,0x03,0xA4,0x02,0xA8,0x02,0xA0,0x02,0xC0,0x03, // 226
0x00,0x00,0x28,0x03,0xA4,0x02,0xA8,0x02,0xA4,0x02,0xC0,0x03, // 227
0x00,0x00,0x20,0x03,0xA4,0x02,0xA0,0x02,0xA4,0x02,0xC0,0x03, // 228
0x00,0x00,0x20,0x03,0xAE,0x02,0xAA,0x02,0xAE,0x02,0xC0,0x03, // 229
0x00,0x00,0xA0,0x03,0xA0,0x02,0xC0,0x01,0xA0,0x02,0xE0,0x02, // 230
0x00,0x00,0xC0,0x01,0x20,0x02,0x20,0x0A,0x20,0x0E, // 231
0x00,0x00,0xC4,0x01,0xA8,0x02,0xA0,0x02,0xA0,0x02,0xC0,0x02, // 232
0x00,0x00,0xC0,0x01,0xA8,0x02,0xA4,0x02,0xA0,0x02,0xC0,0x02, // 233
0x00,0x00,0xC8,0x01,0xA4,0x02,0xA8,0x02,0xA0,0x02,0xC0,0x02, // 234
0x00,0x00,0xC0,0x01,0xA4,0x02,0xA0,0x02,0xA4,0x02,0xC0,0x02, // 235
0x00,0x00,0x04,0x02,0x28,0x02,0xE0,0x03,0x00,0x02,0x00,0x02, // 236
0x00,0x00,0x00,0x02,0x28,0x02,0xE4,0x03,0x00,0x02,0x00,0x02, // 237
0x00,0x00,0x08,0x02,0x24,0x02,0xE8,0x03,0x00,0x02,0x00,0x02, // 238
0x00,0x00,0x00,0x02,0x24,0x02,0xE0,0x03,0x04,0x02,0x00,0x02, // 239
0x00,0x00,0xC0,0x01,0x2C,0x02,0x28,0x02,0x38,0x02,0xE0,0x01, // 240
0x00,0x00,0xE8,0x03,0x44,0x00,0x28,0x00,0x24,0x00,0xC0,0x03, // 241
0x00,0x00,0xC4,0x01,0x28,0x02,0x20,0x02,0x20,0x02,0xC0,0x01, // 242
0x00,0x00,0xC0,0x01,0x28,0x02,0x24,0x02,0x20,0x02,0xC0,0x01, // 243
0x00,0x00,0xC0,0x01,0x28,0x02,0x24,0x02,0x28,0x02,0xC0,0x01, // 244
0x00,0x00,0xC8,0x01,0x24,0x02,0x2C,0x02,0x28,0x02,0xC4,0x01, // 245
0x00,0x00,0xC0,0x01,0x24,0x02,0x20,0x02,0x24,0x02,0xC0,0x01, // 246
0x40,0x00,0x40,0x00,0x50,0x01,0x40,0x00,0x40, // 247
0x00,0x00,0xC0,0x03,0x20,0x03,0xA0,0x02,0x60,0x02,0xE0,0x01, // 248
0x00,0x00,0xE4,0x01,0x08,0x02,0x00,0x02,0x00,0x02,0xE0,0x03, // 249
0x00,0x00,0xE0,0x01,0x08,0x02,0x04,0x02,0x00,0x02,0xE0,0x03, // 250
0x00,0x00,0xE0,0x01,0x08,0x02,0x04,0x02,0x08,0x02,0xE0,0x03, // 251
0x00,0x00,0xE0,0x01,0x04,0x02,0x00,0x02,0x04,0x02,0xE0,0x03, // 252
0x00,0x00,0x20,0x08,0xC8,0x08,0x04,0x07,0xC0,0x00,0x20, // 253
0x00,0x00,0xFC,0x0F,0x20,0x02,0x20,0x02,0x20,0x02,0xC0,0x01, // 254
0x00,0x00,0x20,0x08,0xC4,0x08,0x00,0x07,0xC4,0x00,0x20 // 255
};
#endif /* DIALOGINPUT_PLAIN_10_H_ */

154
Display.cpp Normal file
View File

@ -0,0 +1,154 @@
/*
* Display.cpp
*
* Created on: Mar 4, 2018
* Author: chris.l
*/
#include <stdarg.h>
#include <time.h>
#include "ESP8266WiFi.h"
#include "Display.h"
#include "Log.h"
#include "DialogInput_plain_10.h"
static const char* TAG = "Display";
Display::Display(GPS& gps, NTP& ntp, uint8_t sda, uint8_t scl) : _dsp(0x3c, sda, scl), _gps(gps), _ntp(ntp)
{
// TODO Auto-generated constructor stub
}
Display::~Display()
{
// TODO Auto-generated destructor stub
}
void Display::begin()
{
logger.info(TAG, "initializing display");
if (!_dsp.init())
{
logger.error(TAG, "display.init() failed!");
}
_dsp.flipScreenVertically();
font(ArialMT_Plain_10);
}
void Display::end()
{
_dsp.end();
}
void Display::process()
{
time_t secs = _gps.getSeconds();;
struct tm tm;
gmtime_r(&secs, &tm);
clear();
font(DialogInput_plain_10);
IPAddress ip = WiFi.localIP();
const char* wifi_status_str;
int wifi_status = WiFi.status();
switch (wifi_status)
{
case WL_CONNECTED:
wifi_status_str = "READY";
break;
case WL_NO_SSID_AVAIL:
wifi_status_str = "NSSID";
break;
case WL_CONNECT_FAILED:
wifi_status_str = "FAIL";
break;
case WL_IDLE_STATUS:
wifi_status_str = "IDLE";
break;
case WL_DISCONNECTED:
wifi_status_str = "DISCON";
break;
default:
wifi_status_str = "<UNK>";
break;
}
align(TEXT_ALIGN_CENTER);
print(64, 0, "%04d/%02d/%02d %02d:%02d:%02d",
tm.tm_year+1900,
tm.tm_mon+1,
tm.tm_mday,
tm.tm_hour,
tm.tm_min,
tm.tm_sec);
align(TEXT_ALIGN_LEFT);
print(0, 10, "Sats: %d", _gps.getSatelliteCount());
print(0, 20, "Reqs: %d", _ntp.getReqCount());
print(0, 30, "Rsps: %d", _ntp.getRspCount());
if (_gps.isValid())
{
uint32_t seconds = secs - _gps.getValidSince();
uint32_t days = seconds / 86400;
seconds -= days * 86400;
uint32_t hours = seconds /3600;
seconds -= hours * 3600;
uint32_t minutes = seconds / 60;
seconds -= minutes * 60;
align(TEXT_ALIGN_RIGHT);
print(127, 40, "%dd %02dh %02dm %02ds", days, hours, minutes, seconds);
}
else
{
if (_gps.isGPSValid())
{
align(TEXT_ALIGN_LEFT);
print(0, 40, "Valid in: %d", _gps.getValidDelay());
}
else
{
align(TEXT_ALIGN_CENTER);
print(64, 40, "GPS NOT VALID");
}
}
align(TEXT_ALIGN_RIGHT);
print(127, 50, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
align(TEXT_ALIGN_LEFT);
print(0, 50, "%s", wifi_status_str);
display();
}
void Display::clear()
{
_dsp.clear();
}
void Display::display()
{
_dsp.display();
}
void Display::font(const char* fontData)
{
_dsp.setFont(fontData);
}
void Display::align(OLEDDISPLAY_TEXT_ALIGNMENT alignment)
{
_dsp.setTextAlignment(alignment);
}
void Display::print(int16_t x, int16_t y, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsnprintf(_buffer, DISPLAY_BUFFER_LEN, fmt, ap);
_buffer[DISPLAY_BUFFER_LEN-1] = '\0';
va_end(ap);
_dsp.drawString(x, y, _buffer);
}

39
Display.h Normal file
View File

@ -0,0 +1,39 @@
/*
* Display.h
*
* Created on: Mar 4, 2018
* Author: chris.l
*/
#ifndef DISPLAY_H_
#define DISPLAY_H_
#include "SSD1306Wire.h"
#include "GPS.h"
#include "NTP.h"
#define DISPLAY_BUFFER_LEN 32
class Display
{
public:
Display(GPS& gps, NTP& ntp, uint8_t sda, uint8_t scl);
virtual ~Display();
void begin();
void end();
void process();
void clear();
void display();
void align(OLEDDISPLAY_TEXT_ALIGNMENT alignment);
void font(const char* fontData);
void print(int16_t x, int16_t y, const char* fmt, ...);
private:
SSD1306Wire _dsp;
GPS& _gps;
NTP& _ntp;
char _buffer[DISPLAY_BUFFER_LEN];
};
#endif /* DISPLAY_H_ */

View File

@ -21,20 +21,15 @@
*/
#include "ESPNTPServer.h"
#include <lwip/def.h> // htonl() & ntohl()
#include "Log.h"
#include "GPS.h"
#include "NTP.h"
//#include "Logger.h"
#include "Display.h"
GPS gps(Serial, SYNC_PIN);
NTP ntp(gps);
#if defined(USE_OLED_DISPLAY)
SSD1306Wire display(0x3c, SDA_PIN, SCL_PIN);
#endif
#include "Log.h"
Display display(gps, ntp, SDA_PIN, SCL_PIN);
const char* SETUP_TAG = "setup";
const char* LOOP_TAG = "loop";
@ -63,27 +58,10 @@ void setup()
logger.setSize(256);
logger.setPrint(&Serial1);
logger.setPreFunc(&logTimeFirst);
logger.info(SETUP_TAG, "\nStartup!");
logger.info(SETUP_TAG, "Startup!");
#if !defined(USE_NO_WIFI)
logger.info(SETUP_TAG, "initializing wifi");
WiFiManager wifi;
wifi.setDebugStream(Serial1);
//wifi.setDebugOutput(false);
String ssid = "SynchroClock" + String(ESP.getChipId());
wifi.autoConnect(ssid.c_str(), NULL);
#endif
#if defined(USE_OLED_DISPLAY)
logger.info(SETUP_TAG, "initializing display");
if (!display.init())
{
logger.info(SETUP_TAG, "display.init() failed!");
}
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
#endif
display.begin();
logger.info(SETUP_TAG, "initializing serial for GPS");
Serial.begin(9600);
@ -91,6 +69,24 @@ void setup()
logger.info(SETUP_TAG, "initializing GPS");
gps.begin();
display.process();
#if !defined(USE_NO_WIFI)
logger.info(SETUP_TAG, "initializing wifi");
#if 0
WiFiManager wifi;
wifi.setDebugStream(Serial1);
wifi.setDebugOutput(false);
#else
WiFiManager wifi(Serial1);
wifi.setDebugOutput(true);
#endif
wifi.setDebugOutput(true);
String ssid = "ESPNTPServer" + String(ESP.getChipId());
wifi.autoConnect(ssid.c_str(), NULL);
#endif
display.process();
logger.info(SETUP_TAG, "initializing NTP");
ntp.begin();
@ -98,10 +94,44 @@ void setup()
void loop()
{
static uint32_t min_loop;
static uint32_t max_loop;
static uint32_t last_loop;
uint32_t start_loop = millis();
static int last_wifi_status;
static IPAddress last_ip;
int wifi_status = WiFi.status();
if (wifi_status != last_wifi_status)
{
const char* status;
switch (wifi_status)
{
case WL_CONNECTED:
status = "CONNECTED";
break;
case WL_NO_SSID_AVAIL:
status = "NO_SSID";
break;
case WL_CONNECT_FAILED:
status = "FAILED";
break;
case WL_IDLE_STATUS:
status = "IDLE";
break;
case WL_DISCONNECTED:
status = "DISCONNECTED";
break;
default:
status = "<UNKNOWN>";
break;
}
logger.info(LOOP_TAG, "wifi status change %d -> %d '%s'", last_wifi_status, wifi_status, status);
last_wifi_status = wifi_status;
}
IPAddress ip = WiFi.localIP();
if (ip != last_ip)
{
logger.warning(LOOP_TAG, "ip address change %s -> %s", last_ip.toString().c_str(), ip.toString().c_str());
last_ip = ip;
}
gps.process();
@ -121,7 +151,7 @@ void loop()
tm.tm_min,
tm.tm_sec,
tv.tv_usec);
if (tv.tv_sec != last_seconds && ((tv.tv_sec % 60) == 0 || gps.getValidDelay()))
if (tv.tv_sec != last_seconds && ((tv.tv_sec % 300) == 0 || gps.getValidDelay()))
{
logger.info("loop", "jitter:%lu valid_count:%lu valid:%s gpsvalid:%s numsat:%d heap:%ld valid_delay:%d",
gps.getJitter(),
@ -138,33 +168,8 @@ void loop()
logger.warning(LOOP_TAG, "%s: OOPS: time went backwards: last:%lu now:%lu\n", ts, last_seconds, tv.tv_sec);
}
#if defined(USE_OLED_DISPLAY)
//
// Update the display
//
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
display.drawString(0, 0, ts);
display.drawString(0, 10, "Address: "+WiFi.localIP().toString());
display.drawString(0, 20, "Sat Count: " + String(gps.getSatelliteCount()));
display.drawString(0, 30, "Requests: " + String(ntp.getReqCount()));
display.drawString(0, 40, "Responses: " + String(ntp.getRspCount()));
snprintf(ts, 63, "loop: %d / %d / %d", last_loop, min_loop, max_loop);
display.drawString(0, 50, String(ts));
// write the buffer to the display
display.display();
#endif
display.process();
}
last_seconds = tv.tv_sec;
last_loop = millis() - start_loop;
if (min_loop == 0 || last_loop < min_loop)
{
min_loop = last_loop;
}
if (max_loop == 0 || last_loop > max_loop)
{
max_loop = last_loop;
}
}

View File

@ -20,7 +20,6 @@
* Author: liebman
*/
#define USE_OLED_DISPLAY
//#define USE_NO_WIFI
#ifndef _ESPNTPServer_H_
@ -32,8 +31,6 @@
#endif
#include <time.h>
#include "SSD1306Wire.h"
// pin definitions
#define SYNC_PIN 14 // (GPIO14) pin tied to 1hz square wave from GPS
#define SDA_PIN 4

25
GPS.cpp
View File

@ -152,7 +152,7 @@ void GPS::process()
}
else
{
logger.warning(TAG, "ignoring late NMEA time: '%s'",_nmea.getSentence());
logger.debug(TAG, "ignoring late NMEA time: '%s'",_nmea.getSentence());
}
}
@ -166,7 +166,7 @@ void GPS::process()
{
_valid_delay = VALID_DELAY;
_gps_valid = true;
logger.warning(TAG, "GPS valid!");
logger.info(TAG, "GPS valid!");
}
}
}
@ -235,6 +235,16 @@ void ICACHE_RAM_ATTR GPS::pps()
return;
}
//
// increment seconds
//
_seconds += 1;
//
// restart the validity timer, if it runs out we invalidate our data.
//
_pps_timer.attach_ms(VALID_TIMER_MS, &_timer_handler, &_invalidate);
//
// if we are still counting down then keep waiting
//
@ -247,20 +257,11 @@ void ICACHE_RAM_ATTR GPS::pps()
_min_micros = 0;
_max_micros = 0;
_valid = true;
_valid_since = _seconds;
++_valid_count;
}
}
//
// restart the validity timer, if it runs out we invalidate our data.
//
_pps_timer.attach_ms(VALID_TIMER_MS, &_timer_handler, &_invalidate);
//
// increment seconds
//
_seconds += 1;
//
// the first time around we just initialize the last value
//

2
GPS.h
View File

@ -65,6 +65,7 @@ public:
uint32_t getJitter() { return _max_micros - _min_micros; }
uint32_t getValidCount() { return _valid_count; }
uint32_t getValidDelay() { return _valid_delay; }
time_t getValidSince() { return _valid_since; }
uint8_t getSatelliteCount() { return _nmea.getNumSatellites(); }
time_t getSeconds() { return _seconds; }
void getTime(struct timeval* tv);
@ -85,6 +86,7 @@ private:
volatile time_t _seconds;
volatile uint32_t _valid_delay; // delay (seconds) from gps_valid until we thing we are valid
volatile uint32_t _valid_count; // number of times we have gone valid
volatile time_t _valid_since;
volatile uint32_t _min_micros;
volatile uint32_t _max_micros;
volatile uint32_t _last_micros;