Wed, 16 Dec 2015 22:06:11 +0100
Changed some prompt numbers. Added name editor.
442 | 1 | /***************************************************************************** |
2 | * Copyright (C) 2015 | |
3 | * | |
4 | * Michiel Broek <mbroek at mbse dot eu> | |
5 | * | |
6 | * This file is part of the mbsePi-apps | |
7 | * | |
8 | * This is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * mbsePi-apps is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
21 | *****************************************************************************/ | |
22 | ||
23 | #include "brewco.h" | |
24 | #include "slcd.h" | |
25 | #include "prompt.h" | |
26 | ||
27 | ||
28 | extern int debug; | |
29 | extern sys_config Config; | |
30 | extern int lcdHandle; | |
31 | extern int slcdHandle; | |
32 | ||
33 | ||
34 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
451
diff
changeset
|
35 | void prompt(int idx, char *text) |
442 | 36 | { |
37 | char message[81]; | |
38 | int line; | |
39 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
451
diff
changeset
|
40 | switch (idx) { |
442 | 41 | case 0: |
42 | #ifdef HAVE_WIRINGPI_H | |
43 | piLock(LOCK_LCD); | |
44 | lcdClear(lcdHandle); | |
45 | #endif | |
46 | slcdClear(slcdHandle); | |
47 | #ifdef HAVE_WIRINGPI_H | |
48 | piUnlock(LOCK_LCD); | |
49 | #endif | |
50 | return; | |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
51 | case 100: snprintf(message, Config.lcd_cols + 1, text); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
52 | break; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
53 | case 101: snprintf(message, Config.lcd_cols + 1, " Brewco %s \007", VERSION); |
442 | 54 | break; |
55 | case 102: snprintf(message, Config.lcd_cols + 1, " SETUP MENU "); | |
56 | break; | |
57 | case 103: snprintf(message, Config.lcd_cols + 1, " AUTOMATIC MODE "); | |
58 | break; | |
59 | case 104: snprintf(message, Config.lcd_cols + 1, " MANUAL MODE "); | |
60 | break; | |
61 | case 111: snprintf(message, Config.lcd_cols + 1, "AUTO --> Mash In "); | |
62 | break; | |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
63 | case 112: snprintf(message, Config.lcd_cols + 1, "AUTO --> Phytase "); |
442 | 64 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
65 | case 113: snprintf(message, Config.lcd_cols + 1, "AUTO --> Glucanase "); |
442 | 66 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
67 | case 114: snprintf(message, Config.lcd_cols + 1, "AUTO --> Protease "); |
442 | 68 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
69 | case 115: snprintf(message, Config.lcd_cols + 1, "AUTO --> \342-Amylase "); /* Beta */ |
442 | 70 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
71 | case 116: snprintf(message, Config.lcd_cols + 1, "AUTO --> \340-Amylase 1"); /* Alpha */ |
442 | 72 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
73 | case 117: snprintf(message, Config.lcd_cols + 1, "AUTO --> \340-Amylase 2"); |
442 | 74 | break; |
75 | case 118: snprintf(message, Config.lcd_cols + 1, "AUTO --> Mash Out "); | |
76 | break; | |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
77 | case 119: snprintf(message, Config.lcd_cols + 1, "AUTO --> Boil "); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
78 | break; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
79 | case 120: snprintf(message, Config.lcd_cols + 1, "AUTO --> Cooling "); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
80 | break; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
81 | case 121: snprintf(message, Config.lcd_cols + 1, "AUTO --> Whirlpool "); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
82 | break; |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
83 | case 122: snprintf(message, Config.lcd_cols + 1, "AUTO --> Hopstand 1 "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
84 | break; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
85 | case 123: snprintf(message, Config.lcd_cols + 1, "AUTO --> Hopstand 2 "); |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
86 | break; |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
87 | case 124: snprintf(message, Config.lcd_cols + 1, "AUTO --> Hopstand 3 "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
88 | break; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
89 | case 125: snprintf(message, Config.lcd_cols + 1, "AUTO --> Hop xx "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
90 | break; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
91 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
92 | case 131: snprintf(message, Config.lcd_cols + 1, " Change Name "); |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
93 | break; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
94 | case 132: snprintf(message, Config.lcd_cols + 1, " Toggle Yes/No "); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
95 | break; |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
96 | case 133: snprintf(message, Config.lcd_cols + 1, " Change temperature "); |
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
97 | break; |
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
98 | case 134: snprintf(message, Config.lcd_cols + 1, " Change time "); |
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
99 | break; |
448 | 100 | case 137: snprintf(message, Config.lcd_cols + 1, " Direct/Reverse "); |
101 | break; | |
102 | case 138: snprintf(message, Config.lcd_cols + 1, " Change parameter "); | |
103 | break; | |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
104 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
105 | case 191: snprintf(message, Config.lcd_cols + 1, " Edit recipe "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
106 | break; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
107 | case 192: snprintf(message, Config.lcd_cols + 1, " Edit PID "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
108 | break; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
109 | case 193: snprintf(message, Config.lcd_cols + 1, " Edit brewsystem "); |
459
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
110 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
111 | case 200: snprintf(message, Config.lcd_cols + 1, text); |
442 | 112 | break; |
113 | case 202: snprintf(message, Config.lcd_cols + 1, " Manage Recipes "); | |
114 | break; | |
115 | case 203: snprintf(message, Config.lcd_cols + 1, " Manage Brewsystems "); | |
116 | break; | |
117 | case 204: snprintf(message, Config.lcd_cols + 1, " Manage Devices "); | |
118 | break; | |
119 | case 205: snprintf(message, Config.lcd_cols + 1, " Manage Simulators "); | |
120 | break; | |
121 | case 206: snprintf(message, Config.lcd_cols + 1, " Set Automation "); | |
122 | break; | |
123 | case 207: snprintf(message, Config.lcd_cols + 1, " Delay start? "); | |
124 | break; | |
125 | case 208: snprintf(message, Config.lcd_cols + 1, " Resume Process "); | |
126 | break; | |
127 | case 209: snprintf(message, Config.lcd_cols + 1, " Water Added? "); | |
128 | break; | |
129 | case 210: snprintf(message, Config.lcd_cols + 1, " Pump Prime "); | |
130 | break; | |
131 | case 211: snprintf(message, Config.lcd_cols + 1, " Setting Delay "); | |
132 | break; | |
133 | case 212: snprintf(message, Config.lcd_cols + 1, " To be started in "); | |
134 | break; | |
135 | case 213: snprintf(message, Config.lcd_cols + 1, " Iodine test "); | |
136 | break; | |
137 | case 214: snprintf(message, Config.lcd_cols + 1, " START COOLING "); | |
138 | break; | |
139 | case 215: snprintf(message, Config.lcd_cols + 1, " WHIRLPOOL "); | |
140 | break; | |
141 | case 216: snprintf(message, Config.lcd_cols + 1, " Timing Whirlpool "); | |
142 | break; | |
143 | case 217: snprintf(message, Config.lcd_cols + 1, " Brewing Process "); | |
144 | break; | |
145 | case 218: snprintf(message, Config.lcd_cols + 1, " Add Brewsystem? "); | |
146 | break; | |
451 | 147 | case 219: snprintf(message, Config.lcd_cols + 1, " Manual HLT "); |
148 | break; | |
149 | case 220: snprintf(message, Config.lcd_cols + 1, " Manual MLT "); | |
150 | break; | |
459
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
151 | case 221: snprintf(message, Config.lcd_cols + 1, " Select Recipe "); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
152 | break; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
153 | case 222: snprintf(message, Config.lcd_cols + 1, " Select Brewsystem "); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
154 | break; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
155 | case 223: snprintf(message, Config.lcd_cols + 1, " Select Device "); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
156 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
157 | case 300: snprintf(message, Config.lcd_cols + 1, text); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
158 | break; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
159 | case 301: snprintf(message, Config.lcd_cols + 1, " Finished "); |
442 | 160 | break; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
161 | case 302: snprintf(message, Config.lcd_cols + 1, " Shutting down "); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
162 | break; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
442
diff
changeset
|
163 | case 400: snprintf(message, Config.lcd_cols + 1, text); |
442 | 164 | break; |
165 | case 401: snprintf(message, Config.lcd_cols + 1, "--- MAN AUTO SETUP"); | |
166 | break; | |
167 | case 402: snprintf(message, Config.lcd_cols + 1, "--- dwn quit ok "); | |
168 | break; | |
169 | case 403: snprintf(message, Config.lcd_cols + 1, " up dwn quit ok "); | |
170 | break; | |
171 | case 404: snprintf(message, Config.lcd_cols + 1, " up --- quit ok "); | |
172 | break; | |
173 | case 405: snprintf(message, Config.lcd_cols + 1, "--- --- quit ok "); | |
174 | break; | |
175 | case 406: snprintf(message, Config.lcd_cols + 1, "UP* *DWN heat pmp "); | |
176 | break; | |
177 | case 407: snprintf(message, Config.lcd_cols + 1, "--- --- No Yes "); | |
178 | break; | |
179 | case 408: snprintf(message, Config.lcd_cols + 1, "--- --- Ok --- "); | |
180 | break; | |
181 | case 409: snprintf(message, Config.lcd_cols + 1, "UP* *DWN Pause --- "); | |
182 | break; | |
183 | case 410: snprintf(message, Config.lcd_cols + 1, " Continue: Yes No "); | |
184 | break; | |
185 | case 411: snprintf(message, Config.lcd_cols + 1, "UP* *DWN --- pmp "); | |
186 | break; | |
187 | case 412: snprintf(message, Config.lcd_cols + 1, "Up Dwn Exit Ok "); | |
188 | break; | |
451 | 189 | case 413: snprintf(message, Config.lcd_cols + 1, "UP* *DWN heat --- "); |
190 | break; | |
459
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
191 | case 414: snprintf(message, Config.lcd_cols + 1, "add dwn quit ok "); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
192 | break; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
193 | case 415: snprintf(message, Config.lcd_cols + 1, "add --- quit ok "); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
194 | break; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
195 | case 416: snprintf(message, Config.lcd_cols + 1, "add --- quit --- "); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
196 | break; |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
197 | case 417: snprintf(message, Config.lcd_cols + 1, " up dwn next ok "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
198 | break; |
442 | 199 | // 12345678901234567890 |
200 | default: snprintf(message, Config.lcd_cols + 1, " N/A N/A"); | |
201 | } | |
202 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
451
diff
changeset
|
203 | if (idx < 200) |
442 | 204 | line = 0; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
451
diff
changeset
|
205 | else if (idx < 300) |
442 | 206 | line = 1; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
451
diff
changeset
|
207 | else if (idx < 400) |
442 | 208 | line = 2; |
209 | else | |
210 | line = 3; | |
211 | ||
212 | fprintf(stdout, "%d %d '%s'\n", line, Config.lcd_cols, message); | |
213 | ||
214 | #ifdef HAVE_WIRINGPI_H | |
215 | piLock(LOCK_LCD); | |
216 | lcdPosition(lcdHandle, 0, line); | |
217 | lcdPuts(lcdHandle, message); | |
218 | ||
219 | #endif | |
220 | slcdPosition(slcdHandle, 0, line); | |
221 | slcdPuts(slcdHandle, message); | |
222 | #ifdef HAVE_WIRINGPI_H | |
223 | piUnlock(LOCK_LCD); | |
224 | #endif | |
225 | } | |
226 | ||
227 |