-
Notifications
You must be signed in to change notification settings - Fork 38
/
iron_tips.cpp
127 lines (122 loc) · 3.96 KB
/
iron_tips.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include <string.h>
#include "iron_tips.h"
static const char tip_names[][tip_name_sz] PROGMEM = {
{'B', '\0', '\0', '\0', '\0'},
{'B', '1', '\0', '\0', '\0'},
{'B', '2', '\0', '\0', '\0'},
{'B', '3', '\0', '\0', '\0'},
{'B', '4', '\0', '\0', '\0'},
{'B', '2', 'Z', '\0', '\0'},
{'B', 'C', '1', '\0', '\0'},
{'B', 'C', '1', '.' , '5'},
{'B', 'C', '2', '\0', '\0'},
{'B', 'C', '3', '\0', '\0'},
{'B', 'C', '1', 'Z', '\0'},
{'B', 'C', '2', 'Z', '\0'},
{'B', 'C', '4', 'Z', '\0'},
{'B', 'C', 'F', '1', '\0'},
{'B', 'C', 'F', '2', '\0'},
{'B', 'C', 'F', '3', '\0'},
{'B', 'C', 'F', '4', '\0'},
{'B', 'C', 'F', '1', 'Z'},
{'B', 'C', 'F', '2', 'Z'},
{'B', 'C', 'F', '3', 'Z'},
{'B', 'C', 'M', '2', '\0'},
{'B', 'C', 'M', '3', '\0'},
{'B', 'L', '\0', '\0', '\0'},
{'B', 'Z', '\0', '\0', '\0'},
{'C', '1', '\0', '\0', '\0'},
{'C', '2', '\0', '\0', '\0'},
{'C', '3', '\0', '\0', '\0'},
{'C', '4', '\0', '\0', '\0'},
{'D', '0', '8', '\0', '\0'},
{'D', '1', '2', '\0', '\0'},
{'D', '1', '6', '\0', '\0'},
{'D', '2', '4', '\0', '\0'},
{'D', '5', '2', '\0', '\0'},
{'D', '4', '\0', '\0', '\0'},
{'D', 'L', '1', '2', '\0'},
{'D', 'L', '3', '2', '\0'},
{'D', 'L', '5', '2', '\0'},
{'D', '1', '2', 'Z', '\0'},
{'D', '2', '4', 'Z', '\0'},
{'D', '4', 'Z', '\0', '\0'},
{'I', '\0', '\0', '\0', '\0'},
{'I', 'L', '\0', '\0', '\0'},
{'I', 'L', 'S', '\0', '\0'},
{'J', '0', '2', '\0', '\0'},
{'J', 'L', '0', '2', '\0'},
{'J', 'S', '0', '2', '\0'},
{'K', '\0', '\0', '\0', '\0'},
{'K', 'F', '\0', '\0', '\0'},
{'K', 'L', '\0', '\0', '\0'},
{'K', 'R', '\0', '\0', '\0'},
{'K', 'F', 'Z', '\0', '\0'},
{'K', 'R', 'Z', '\0', '\0'},
{'K', 'U', '\0', '\0', '\0'},
{'W', 'B', '2', '\0', '\0'},
{'W', 'D', '0', '8', '\0'},
{'W', 'D', '1', '2', '\0'},
{'W', 'D', '1', '6', '\0'},
{'W', 'D', '5', '2', '\0'},
{'W', 'I', '\0', '\0', '\0'},
{'N', '1', '-', '0', '6'},
{'N', '1', '-', '0', '8'},
{'N', '1', '-', '1', '0'},
{'N', '1', '-', '1', '3'},
{'N', '1', '-', '1', '6'},
{'N', '1', '-', '2', '0'},
{'N', '1', '-', '2', '3'},
{'N', '1', '-', 'L', '1'},
{'1', '0', '0', '1', '\0'},
{'1', '0', '0', '2', '\0'},
{'1', '0', '0', '3', '\0'},
{'1', '0', '0', '4', '\0'},
{'1', '0', '0', '5', '\0'},
{'1', '0', '0', '6', '\0'},
{'1', '0', '0', '7', '\0'},
{'1', '0', '0', '8', '\0'},
{'1', '0', '0', '9', '\0'},
{'1', '0', '1', '0', '\0'},
{'1', '2', '0', '1', '\0'},
{'1', '2', '0', '2', '\0'},
{'1', '2', '0', '3', '\0'},
{'1', '2', '0', '4', '\0'},
{'1', '2', '0', '5', '\0'},
{'1', '2', '0', '6', '\0'},
{'1', '2', '0', '7', '\0'},
{'1', '2', '0', '8', '\0'},
{'1', '2', '0', '9', '\0'},
{'1', '4', '0', '1', '\0'},
{'1', '4', '0', '2', '\0'},
{'1', '4', '0', '3', '\0'},
{'1', '4', '0', '4', '\0'},
{'1', '4', '0', '5', '\0'},
{'1', '4', '0', '6', '\0'}
};
static uint16_t tip_number = sizeof(tip_names) / tip_name_sz;
uint16_t TIPS::tipsLoaded(void) {
return tip_number;
}
bool TIPS::name(char tip_n[tip_name_sz], uint8_t index) {
if (index < tip_number) {
for (uint8_t c = 0; c < tip_name_sz; ++c)
tip_n[c] = pgm_read_byte(&tip_names[index][c]);
return true;
} else {
for (uint8_t c = 0; c < tip_name_sz; ++c)
tip_n[c] = '?';
}
return false;
}
int8_t TIPS::index(const char name[tip_name_sz]) {
for (uint16_t i = 0; i < tip_number; ++i) {
char tip_n[tip_name_sz];
for (uint8_t c = 0; c < tip_name_sz; ++c)
tip_n[c] = pgm_read_byte(&tip_names[i][c]);
if (strncmp(name, tip_n, tip_name_sz) == 0) {
return i;
}
}
return -1;
}