Wed, 02 Dec 2015 17:16:41 +0100
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit 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 | ||
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
|
35 | void prompt(int index, char *text) |
442 | 36 | { |
37 | char message[81]; | |
38 | int line; | |
39 | ||
40 | switch (index) { | |
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; |
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
|
83 | case 122: snprintf(message, Config.lcd_cols + 1, "AUTO --> Hop xx "); |
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
|
84 | 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
|
85 | case 131: snprintf(message, Config.lcd_cols + 1, " Edit brewsystem "); |
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; |
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
|
87 | 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
|
88 | 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
|
89 | case 200: snprintf(message, Config.lcd_cols + 1, text); |
442 | 90 | break; |
91 | case 202: snprintf(message, Config.lcd_cols + 1, " Manage Recipes "); | |
92 | break; | |
93 | case 203: snprintf(message, Config.lcd_cols + 1, " Manage Brewsystems "); | |
94 | break; | |
95 | case 204: snprintf(message, Config.lcd_cols + 1, " Manage Devices "); | |
96 | break; | |
97 | case 205: snprintf(message, Config.lcd_cols + 1, " Manage Simulators "); | |
98 | break; | |
99 | case 206: snprintf(message, Config.lcd_cols + 1, " Set Automation "); | |
100 | break; | |
101 | case 207: snprintf(message, Config.lcd_cols + 1, " Delay start? "); | |
102 | break; | |
103 | case 208: snprintf(message, Config.lcd_cols + 1, " Resume Process "); | |
104 | break; | |
105 | case 209: snprintf(message, Config.lcd_cols + 1, " Water Added? "); | |
106 | break; | |
107 | case 210: snprintf(message, Config.lcd_cols + 1, " Pump Prime "); | |
108 | break; | |
109 | case 211: snprintf(message, Config.lcd_cols + 1, " Setting Delay "); | |
110 | break; | |
111 | case 212: snprintf(message, Config.lcd_cols + 1, " To be started in "); | |
112 | break; | |
113 | case 213: snprintf(message, Config.lcd_cols + 1, " Iodine test "); | |
114 | break; | |
115 | case 214: snprintf(message, Config.lcd_cols + 1, " START COOLING "); | |
116 | break; | |
117 | case 215: snprintf(message, Config.lcd_cols + 1, " WHIRLPOOL "); | |
118 | break; | |
119 | case 216: snprintf(message, Config.lcd_cols + 1, " Timing Whirlpool "); | |
120 | break; | |
121 | case 217: snprintf(message, Config.lcd_cols + 1, " Brewing Process "); | |
122 | break; | |
123 | case 218: snprintf(message, Config.lcd_cols + 1, " Add Brewsystem? "); | |
124 | 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
|
125 | 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
|
126 | 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
|
127 | case 301: snprintf(message, Config.lcd_cols + 1, " Finished "); |
442 | 128 | 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
|
129 | 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
|
130 | 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
|
131 | case 400: snprintf(message, Config.lcd_cols + 1, text); |
442 | 132 | break; |
133 | case 401: snprintf(message, Config.lcd_cols + 1, "--- MAN AUTO SETUP"); | |
134 | break; | |
135 | case 402: snprintf(message, Config.lcd_cols + 1, "--- dwn quit ok "); | |
136 | break; | |
137 | case 403: snprintf(message, Config.lcd_cols + 1, " up dwn quit ok "); | |
138 | break; | |
139 | case 404: snprintf(message, Config.lcd_cols + 1, " up --- quit ok "); | |
140 | break; | |
141 | case 405: snprintf(message, Config.lcd_cols + 1, "--- --- quit ok "); | |
142 | break; | |
143 | case 406: snprintf(message, Config.lcd_cols + 1, "UP* *DWN heat pmp "); | |
144 | break; | |
145 | case 407: snprintf(message, Config.lcd_cols + 1, "--- --- No Yes "); | |
146 | break; | |
147 | case 408: snprintf(message, Config.lcd_cols + 1, "--- --- Ok --- "); | |
148 | break; | |
149 | case 409: snprintf(message, Config.lcd_cols + 1, "UP* *DWN Pause --- "); | |
150 | break; | |
151 | case 410: snprintf(message, Config.lcd_cols + 1, " Continue: Yes No "); | |
152 | break; | |
153 | case 411: snprintf(message, Config.lcd_cols + 1, "UP* *DWN --- pmp "); | |
154 | break; | |
155 | case 412: snprintf(message, Config.lcd_cols + 1, "Up Dwn Exit Ok "); | |
156 | break; | |
157 | // 12345678901234567890 | |
158 | default: snprintf(message, Config.lcd_cols + 1, " N/A N/A"); | |
159 | } | |
160 | ||
161 | if (index < 200) | |
162 | line = 0; | |
163 | else if (index < 300) | |
164 | line = 1; | |
165 | else if (index < 400) | |
166 | line = 2; | |
167 | else | |
168 | line = 3; | |
169 | ||
170 | fprintf(stdout, "%d %d '%s'\n", line, Config.lcd_cols, message); | |
171 | ||
172 | #ifdef HAVE_WIRINGPI_H | |
173 | piLock(LOCK_LCD); | |
174 | lcdPosition(lcdHandle, 0, line); | |
175 | lcdPuts(lcdHandle, message); | |
176 | ||
177 | #endif | |
178 | slcdPosition(slcdHandle, 0, line); | |
179 | slcdPuts(slcdHandle, message); | |
180 | #ifdef HAVE_WIRINGPI_H | |
181 | piUnlock(LOCK_LCD); | |
182 | #endif | |
183 | } | |
184 | ||
185 |