Sun, 27 Dec 2015 17:52:26 +0100
Renamed Mash-in step to Prepare on the display. Don't run the pump when the mash is added. When preparing the mash, first heat the HLT, and then the MLT so that both have the chance to reach their target temperatures.
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 "setup.h" | |
26 | #include "prompt.h" | |
27 | #include "xutil.h" | |
28 | #include "keyboard.h" | |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
29 | #include "rdconfig.h" |
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
|
30 | #include "rdrecipes.h" |
442 | 31 | |
32 | ||
33 | extern int my_shutdown; | |
34 | extern int debug; | |
35 | extern sys_config Config; | |
36 | extern int lcdHandle; | |
37 | extern int slcdHandle; | |
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
|
38 | extern a_recipe *recipes; |
442 | 39 | |
40 | ||
41 | ||
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
|
42 | void editFloat(float *value, float low, float high, char *text) |
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
|
43 | { |
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
|
44 | int key; |
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
|
45 | float new = *value; |
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
|
46 | char pmpt[81]; |
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
|
47 | |
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
|
48 | prompt(0, NULL); |
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
|
49 | prompt(133, NULL); |
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
|
50 | |
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
|
51 | for (;;) { |
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
|
52 | snprintf(pmpt, Config.lcd_cols + 1, "%s: %5.1f\001", text, new); |
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
|
53 | prompt(200, pmpt); |
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
|
54 | if (new == low) |
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
|
55 | prompt(404, NULL); |
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
|
56 | else if (new == high) |
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
|
57 | prompt(402, NULL); |
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
|
58 | else |
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
|
59 | prompt(403, NULL); |
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
|
60 | |
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
|
61 | key = keywait(); |
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
|
62 | if ((key == KEY_RETURN) || my_shutdown) |
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
|
63 | return; |
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
|
64 | if (key == KEY_UP) { |
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
|
65 | new = new + 0.5; |
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
|
66 | if (new > high) |
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
|
67 | new = high; |
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
|
68 | } |
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
|
69 | if (key == KEY_DOWN) { |
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
|
70 | new = new - 0.5; |
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
|
71 | if (new < low) |
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
|
72 | new = low; |
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
|
73 | } |
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
|
74 | if (key == KEY_ENTER) { |
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
|
75 | *value = new; |
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
|
76 | return; |
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
|
77 | } |
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
|
78 | } |
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
|
79 | } |
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
|
80 | |
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
|
81 | |
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
|
82 | |
448 | 83 | void editDouble(double *value, double low, double high, char *text) |
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
|
84 | { |
448 | 85 | int key; |
86 | double new = *value; | |
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
|
87 | char pmpt[81]; |
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
|
88 | |
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
|
89 | prompt(0, NULL); |
448 | 90 | prompt(138, NULL); |
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
|
91 | |
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
|
92 | for (;;) { |
448 | 93 | snprintf(pmpt, Config.lcd_cols + 1, "%s: %5.2lf", text, new); |
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
|
94 | prompt(200, pmpt); |
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
|
95 | if (new == low) |
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 | prompt(404, NULL); |
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 | else if (new == high) |
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 | prompt(402, NULL); |
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 | else |
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
|
100 | prompt(403, NULL); |
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
|
101 | |
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
|
102 | key = keywait(); |
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
|
103 | if ((key == KEY_RETURN) || my_shutdown) |
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
|
104 | return; |
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
|
105 | if (key == KEY_UP) { |
448 | 106 | new = new + 0.5; |
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
|
107 | if (new > high) |
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
|
108 | new = high; |
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
|
109 | } |
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
|
110 | if (key == KEY_DOWN) { |
448 | 111 | new = new - 0.5; |
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
|
112 | if (new < low) |
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
|
113 | new = low; |
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
|
114 | } |
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
|
115 | if (key == KEY_ENTER) { |
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
|
116 | *value = new; |
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
|
117 | return; |
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
|
118 | } |
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
|
119 | } |
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
|
120 | } |
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
|
121 | |
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
|
122 | |
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
|
123 | |
448 | 124 | void editInteger(int *value, int low, int high, int step, char *text, char *text2) |
125 | { | |
126 | int key, new = *value; | |
127 | char pmpt[81]; | |
128 | ||
129 | prompt(0, NULL); | |
130 | prompt(134, NULL); | |
131 | ||
132 | for (;;) { | |
133 | snprintf(pmpt, Config.lcd_cols + 1, "%s: %3d %s", text, new, text2); | |
134 | prompt(200, pmpt); | |
135 | if (new == low) | |
136 | prompt(404, NULL); | |
137 | else if (new == high) | |
138 | prompt(402, NULL); | |
139 | else | |
140 | prompt(403, NULL); | |
141 | ||
142 | key = keywait(); | |
143 | if ((key == KEY_RETURN) || my_shutdown) | |
144 | return; | |
145 | if (key == KEY_UP) { | |
146 | new += step; | |
147 | if (new > high) | |
148 | new = high; | |
149 | } | |
150 | if (key == KEY_DOWN) { | |
151 | new -= step; | |
152 | if (new < low) | |
153 | new = low; | |
154 | } | |
155 | if (key == KEY_ENTER) { | |
156 | *value = new; | |
157 | return; | |
158 | } | |
159 | } | |
160 | } | |
161 | ||
162 | ||
163 | ||
164 | void togglePmpts(int *value, char *text, int pno, char *pmpt1, char *pmpt2) | |
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
|
165 | { |
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
|
166 | int key, new = *value; |
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
|
167 | char pmpt[81]; |
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
|
168 | |
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
|
169 | prompt(0, NULL); |
448 | 170 | prompt(pno, NULL); |
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
|
171 | |
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
|
172 | for (;;) { |
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
|
173 | |
448 | 174 | snprintf(pmpt, Config.lcd_cols + 1, "%s: %s", text, new ? pmpt1:pmpt2); |
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
|
175 | prompt(200, pmpt); |
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
|
176 | if (new) { |
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
|
177 | prompt(404, NULL); |
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
|
178 | } else { |
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
|
179 | prompt(402, NULL); |
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
|
180 | } |
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
|
181 | |
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
|
182 | key = keywait(); |
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
|
183 | if ((key == KEY_RETURN) || my_shutdown) |
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
|
184 | 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
|
185 | if ((key == KEY_UP) && new) |
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
|
186 | new = 0; |
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
|
187 | else if ((key == KEY_DOWN) && (new == 0)) |
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
|
188 | new = 1; |
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
|
189 | if (key == KEY_ENTER) { |
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
|
190 | *value = new; |
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
|
191 | return; |
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
|
192 | } |
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
|
193 | } |
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
|
194 | } |
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
|
195 | |
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
|
196 | |
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
|
197 | |
448 | 198 | void toggleYesNo(int *value, char *text) |
199 | { | |
200 | togglePmpts(value, text, 132, (char *)"Yes", (char *)"No "); | |
201 | } | |
202 | ||
203 | ||
204 | ||
205 | void toggleDirection(int *value, char *text) | |
206 | { | |
207 | togglePmpts(value, text, 137, (char *)"Reverse", (char *)"Direct "); | |
208 | } | |
209 | ||
210 | ||
211 | ||
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
212 | void editName(char *name, char *text) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
213 | { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
214 | char pmpt[81]; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
215 | int i, x = 0, key, val; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
216 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
217 | if (debug) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
218 | fprintf(stdout, "editName(%s)\n", name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
219 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
220 | prompt(0, NULL); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
221 | prompt(131, NULL); /* " Change Name " */ |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
222 | prompt(417, NULL); /* " up dwn next ok " */ |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
223 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
224 | for (;;) { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
225 | snprintf(pmpt, Config.lcd_cols + 1, " "); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
226 | prompt(200, pmpt); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
227 | #ifdef HAVE_WIRINGPI_H |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
228 | lcdPosition(lcdHandle, x, 1); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
229 | lcdPutchar(lcdHandle, '*'); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
230 | #endif |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
231 | slcdPosition(slcdHandle, x, 1); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
232 | slcdPutchar(slcdHandle, '*'); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
233 | snprintf(pmpt, Config.lcd_cols + 1, "%s", name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
234 | prompt(300, pmpt); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
235 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
236 | key = keywait(); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
237 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
238 | if ((key == KEY_ENTER) || my_shutdown) { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
239 | if (debug) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
240 | fprintf(stdout, "End editName(%s)\n", name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
241 | for (i = strlen(name) -1; i > 1; i--) { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
242 | if (name[i] != ' ') |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
243 | break; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
244 | name[i] = '\0'; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
245 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
246 | if (debug) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
247 | fprintf(stdout, "End editName(%s)\n", name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
248 | return; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
249 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
250 | if (key == KEY_RETURN) { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
251 | if (x < 19) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
252 | x++; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
253 | else |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
254 | x = 0; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
255 | if (debug) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
256 | fprintf(stdout, "editName: strlen=%d x=%d\n", (int)strlen(name) - 1, x); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
257 | if (x > ((int)strlen(name) - 1)) { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
258 | name[x + 1] = '\0'; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
259 | name[x] = ' '; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
260 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
261 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
262 | if (key == KEY_UP || key == KEY_DOWN) { |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
263 | val = name[x]; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
264 | if ((key == KEY_UP) && (val < 126)) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
265 | val++; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
266 | if ((key == KEY_DOWN) && (val > 32)) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
267 | val--; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
268 | name[x] = val; |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
269 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
270 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
271 | } |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
272 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
273 | |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
274 | |
448 | 275 | void editPID(pid_var *pid) |
276 | { | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
277 | int idx = 1, key, val; |
448 | 278 | char pmpt[81]; |
279 | double Kp, Ki, Kd; | |
280 | ||
281 | if (debug) | |
282 | fprintf(stdout, "editPID()\n"); | |
283 | ||
284 | for (;;) { | |
285 | prompt(0, NULL); | |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
286 | prompt(192, NULL); |
448 | 287 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
288 | if (idx == 1) |
448 | 289 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
290 | else if (idx == 5) |
448 | 291 | prompt(404, NULL); |
292 | else | |
293 | prompt(403, NULL); | |
294 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
295 | switch (idx) { |
448 | 296 | case 1: snprintf(pmpt, Config.lcd_cols + 1, "PID Kp: %5.2f", PID_getKp(pid)); |
297 | break; | |
298 | case 2: snprintf(pmpt, Config.lcd_cols + 1, "PID Ki: %5.2f", PID_getKi(pid)); | |
299 | break; | |
300 | case 3: snprintf(pmpt, Config.lcd_cols + 1, "PID Kd: %5.2f", PID_getKd(pid)); | |
301 | break; | |
302 | case 4: snprintf(pmpt, Config.lcd_cols + 1, "SampleTime: %3d mSec", PID_getSampleTime(pid)); | |
303 | break; | |
304 | case 5: snprintf(pmpt, Config.lcd_cols + 1, "Direction: %s", PID_getDirection(pid) ? (char *)"Reverse" : (char *)"Direct"); | |
305 | break; | |
306 | } | |
307 | prompt(200, pmpt); | |
308 | ||
309 | key = keywait(); | |
310 | if ((key == KEY_RETURN) || my_shutdown) { | |
311 | if (debug) | |
312 | fprintf(stdout, "End editPID\n"); | |
313 | return; | |
314 | } | |
315 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
316 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
317 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
318 | if ((key == KEY_DOWN) && (idx < 5)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
319 | idx++; |
448 | 320 | |
321 | if (key == KEY_ENTER) { | |
322 | ||
323 | Kp = PID_getKp(pid); | |
324 | Ki = PID_getKi(pid); | |
325 | Kd = PID_getKd(pid); | |
326 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
327 | switch(idx) { |
448 | 328 | case 1: editDouble(&Kp, 0.5, 50, (char *)"PID Kp"); |
329 | PID_setTunings(pid, Kp, Ki, Kd); | |
330 | break; | |
331 | case 2: editDouble(&Ki, 0.5, 50, (char *)"PID Ki"); | |
332 | PID_setTunings(pid, Kp, Ki, Kd); | |
333 | break; | |
334 | case 3: editDouble(&Kd, 0.5, 50, (char *)"PID Kd"); | |
335 | PID_setTunings(pid, Kp, Ki, Kd); | |
336 | break; | |
337 | case 4: val = PID_getSampleTime(pid); | |
338 | editInteger(&val, 50, 500, 10, (char *)"SampleTime", (char *)"mSec"); | |
339 | PID_setSampleTime(pid, val); | |
340 | break; | |
341 | case 5: val = PID_getDirection(pid); | |
342 | toggleDirection(&val, (char *)"Direction"); | |
343 | PID_setDirection(pid, val); | |
344 | break; | |
345 | } | |
346 | } | |
347 | } | |
348 | } | |
349 | ||
350 | ||
351 | ||
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
352 | void editMash(mash_step *mash) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
353 | { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
354 | int key, idx = 1, lo, hi; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
355 | char pmpt[81]; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
356 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
357 | for (;;) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
358 | prompt(0, NULL); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
359 | prompt(194, NULL); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
360 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
361 | if (mash->canskip) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
362 | lo = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
363 | if (mash->skip) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
364 | hi = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
365 | else |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
366 | hi = 3; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
367 | } else { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
368 | lo = 2; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
369 | hi = 3; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
370 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
371 | if (idx < lo) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
372 | idx = lo; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
373 | if (idx > hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
374 | idx = hi; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
375 | if (debug) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
376 | fprintf(stdout, "editMash canskip=%d skip=%d lo=%d hi=%d idx=%d\n", mash->canskip, mash->skip, lo, hi, idx); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
377 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
378 | switch (idx) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
379 | case 1: snprintf(pmpt, Config.lcd_cols + 1, " Mashstep skip: %s", mash->skip ? (char *)"Yes":(char *)"No"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
380 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
381 | case 2: snprintf(pmpt, Config.lcd_cols + 1, " Setpoint: %5.1f\001", mash->setpoint); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
382 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
383 | case 3: snprintf(pmpt, Config.lcd_cols + 1, " Duration: %3d mins", mash->duration); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
384 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
385 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
386 | prompt(200, pmpt); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
387 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
388 | if (lo == hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
389 | prompt(405, NULL); /* "--- --- quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
390 | else if (idx == lo) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
391 | prompt(402, NULL); /* "--- dwn quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
392 | else if (idx == hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
393 | prompt(404, NULL); /* " up --- quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
394 | else |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
395 | prompt(403, NULL); /* " up dwn quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
396 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
397 | key = keywait(); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
398 | if ((key == KEY_RETURN) || my_shutdown) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
399 | return; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
400 | if ((key == KEY_UP) && (idx > lo)) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
401 | idx--; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
402 | if ((key == KEY_DOWN) && (idx < hi)) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
403 | idx++; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
404 | if (key == KEY_ENTER) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
405 | switch(idx) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
406 | case 1: toggleYesNo(&mash->skip, (char *)" Mashstep skip"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
407 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
408 | case 2: editFloat(&mash->setpoint, mash->min, mash->max, (char *)" Setpoint"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
409 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
410 | case 3: editInteger(&mash->duration, 1, 120, 1, (char *)" Duration", (char *)"mins"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
411 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
412 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
413 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
414 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
415 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
416 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
417 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
418 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
419 | void editHopaddition(hop_addition *hops, int boiltime) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
420 | { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
421 | int key, idx = 1, hi; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
422 | char pmpt[81]; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
423 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
424 | for (;;) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
425 | prompt(0, NULL); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
426 | prompt(195, NULL); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
427 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
428 | if (hops->skip) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
429 | hi = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
430 | else |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
431 | hi = 2; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
432 | if (idx > hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
433 | idx = hi; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
434 | if (debug) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
435 | fprintf(stdout, "editHopaddition skip=%d hi=%d idx=%d\n", hops->skip, hi, idx); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
436 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
437 | switch (idx) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
438 | case 1: snprintf(pmpt, Config.lcd_cols + 1, "Addition skip: %s", hops->skip ? (char *)"Yes":(char *)"No"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
439 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
440 | case 2: snprintf(pmpt, Config.lcd_cols + 1, " Boil for: %3d mins", hops->boiltime); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
441 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
442 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
443 | prompt(200, pmpt); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
444 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
445 | if (hi == 1) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
446 | prompt(405, NULL); /* "--- --- quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
447 | else if (idx == 1) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
448 | prompt(402, NULL); /* "--- dwn quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
449 | else if (idx == hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
450 | prompt(404, NULL); /* " up --- quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
451 | else |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
452 | prompt(403, NULL); /* " up dwn quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
453 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
454 | key = keywait(); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
455 | if ((key == KEY_RETURN) || my_shutdown) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
456 | return; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
457 | if ((key == KEY_UP) && (idx > 1)) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
458 | idx--; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
459 | if ((key == KEY_DOWN) && (idx < hi)) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
460 | idx++; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
461 | if (key == KEY_ENTER) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
462 | switch (idx) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
463 | case 1: toggleYesNo(&hops->skip, (char *)"Addition skip"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
464 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
465 | case 2: editInteger(&hops->boiltime, -1, boiltime, 1, (char *)" Boil for", (char *)"mins"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
466 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
467 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
468 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
469 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
470 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
471 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
472 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
473 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
474 | void editHopstand(hop_stand *hops) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
475 | { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
476 | int key, idx = 1, hi; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
477 | char pmpt[81]; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
478 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
479 | for (;;) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
480 | prompt(0, NULL); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
481 | prompt(196, NULL); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
482 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
483 | if (hops->skip) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
484 | hi = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
485 | else |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
486 | hi = 4; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
487 | if (idx < 1) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
488 | idx = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
489 | if (idx > hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
490 | idx = hi; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
491 | if (debug) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
492 | fprintf(stdout, "editHopstand skip=%d hi=%d idx=%d\n", hops->skip, hi, idx); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
493 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
494 | switch (idx) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
495 | case 1: snprintf(pmpt, Config.lcd_cols + 1, "Hopstand skip: %s", hops->skip ? (char *)"Yes":(char *)"No"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
496 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
497 | case 2: snprintf(pmpt, Config.lcd_cols + 1, "Hold temperature: %s", hops->hold ? (char *)"Yes":(char *)"No"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
498 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
499 | case 3: snprintf(pmpt, Config.lcd_cols + 1, " Setpoint: %5.1f\001", hops->setpoint); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
500 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
501 | case 4: snprintf(pmpt, Config.lcd_cols + 1, " Duration: %3d mins", hops->duration); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
502 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
503 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
504 | prompt(200, pmpt); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
505 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
506 | if (hi == 1) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
507 | prompt(405, NULL); /* "--- --- quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
508 | else if (idx == 1) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
509 | prompt(402, NULL); /* "--- dwn quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
510 | else if (idx == hi) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
511 | prompt(404, NULL); /* " up --- quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
512 | else |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
513 | prompt(403, NULL); /* " up dwn quit ok " */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
514 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
515 | key = keywait(); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
516 | if ((key == KEY_RETURN) || my_shutdown) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
517 | return; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
518 | if ((key == KEY_UP) && (idx > 1)) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
519 | idx--; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
520 | if ((key == KEY_DOWN) && (idx < hi)) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
521 | idx++; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
522 | if (key == KEY_ENTER) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
523 | switch(idx) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
524 | case 1: toggleYesNo(&hops->skip, (char *)"Hopstand skip"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
525 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
526 | case 2: toggleYesNo(&hops->hold, (char *)"Hold temperature"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
527 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
528 | case 3: editFloat(&hops->setpoint, hops->min, hops->max, (char *)" Setpoint"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
529 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
530 | case 4: editInteger(&hops->duration, 10, 240, 10, (char *)" Duration", (char *)"mins"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
531 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
532 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
533 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
534 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
535 | } |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
536 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
537 | |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
538 | |
449 | 539 | void editSensor(char *uuid, char *text) |
540 | { | |
541 | char pmpt[81]; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
542 | int i, old, choices, idx = 1, key; |
449 | 543 | devices_list *device; |
544 | ||
545 | if (debug) | |
546 | fprintf(stdout, "editSensor(%s, %s)\n", uuid, text); | |
547 | ||
548 | old = 1; // 1d0e5bb8-7408-48b9-abb4-e9041d7b99fe | |
549 | if ((i = strcmp((char *)"00000000-0000-0000-0000-000000000000", uuid))) { | |
550 | for (device = Config.devices; device; device = device->next) { | |
551 | if (device->direction == DEVDIR_IN_ANALOG) { | |
552 | old++; | |
553 | if (strcmp(device->uuid, uuid) == 0) | |
554 | break; | |
555 | } | |
556 | } | |
557 | } | |
558 | ||
559 | if (debug) | |
560 | fprintf(stdout, "editSensor(%s) old sensor index=%d\n", text, old); | |
561 | ||
562 | for (;;) { | |
563 | prompt(0, NULL); | |
564 | snprintf(pmpt, Config.lcd_cols + 1, "Edit %s", text); | |
565 | prompt(100, pmpt); | |
566 | ||
567 | /* | |
568 | * Count valid sensors | |
569 | */ | |
570 | choices = 1; | |
571 | if (old == 1) { | |
572 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); | |
573 | } | |
574 | for (device = Config.devices; device; device = device->next) { | |
575 | if (device->direction == DEVDIR_IN_ANALOG) { | |
576 | choices++; | |
577 | if (choices == old) { | |
578 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); | |
579 | } | |
580 | } | |
581 | } | |
582 | prompt(200, pmpt); /* Display current sensor */ | |
583 | i = 1; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
584 | if (idx == 1) { |
449 | 585 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); |
586 | } else { | |
587 | for (device = Config.devices; device; device = device->next) { | |
588 | if (device->direction == DEVDIR_IN_ANALOG) { | |
589 | i++; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
590 | if (i == idx) { |
449 | 591 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); |
592 | } | |
593 | } | |
594 | } | |
595 | } | |
596 | prompt(300, pmpt); /* Display possible new sensor */ | |
597 | ||
598 | ||
599 | if (choices == 1) | |
600 | prompt(405, NULL); | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
601 | else if (idx == 1) |
449 | 602 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
603 | else if (idx == choices) |
449 | 604 | prompt(404, NULL); |
605 | else | |
606 | prompt(403, NULL); | |
607 | ||
608 | key = keywait(); | |
609 | if ((key == KEY_RETURN) || my_shutdown) { | |
610 | if (debug) | |
611 | fprintf(stdout, "End editSensor\n"); | |
612 | return; | |
613 | } | |
614 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
615 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
616 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
617 | if ((key == KEY_DOWN) && (idx < choices)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
618 | idx++; |
449 | 619 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
620 | if ((key == KEY_ENTER) && (idx != old)) { |
449 | 621 | /* |
622 | * Select new sensor. | |
623 | */ | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
624 | if (idx == 1) { |
449 | 625 | /* |
626 | * Disable the sensor | |
627 | */ | |
628 | strncpy(uuid, (char *)"00000000-0000-0000-0000-000000000000", 36); | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
629 | old = idx; |
449 | 630 | } else { |
631 | i = 1; | |
632 | for (device = Config.devices; device; device = device->next) { | |
633 | if (device->direction == DEVDIR_IN_ANALOG) { | |
634 | i++; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
635 | if (i == idx) { |
449 | 636 | strncpy(uuid, device->uuid, 36); |
637 | break; | |
638 | } | |
639 | } | |
640 | } | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
641 | old = idx; |
449 | 642 | } |
643 | } | |
644 | } | |
645 | } | |
646 | ||
647 | ||
648 | ||
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
649 | void editRelay(char *uuid, char *text) |
449 | 650 | { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
651 | char pmpt[81]; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
652 | int i, old, choices, idx = 1, key; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
653 | devices_list *device; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
654 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
655 | if (debug) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
656 | fprintf(stdout, "editRelay(%s, %s)\n", uuid, text); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
657 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
658 | old = 1; // 1d0e5bb8-7408-48b9-abb4-e9041d7b99fe |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
659 | if ((i = strcmp((char *)"00000000-0000-0000-0000-000000000000", uuid))) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
660 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
661 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
662 | old++; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
663 | if (strcmp(device->uuid, uuid) == 0) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
664 | break; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
665 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
666 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
667 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
668 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
669 | if (debug) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
670 | fprintf(stdout, "editRelay(%s) old sensor index=%d\n", text, old); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
671 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
672 | for (;;) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
673 | prompt(0, NULL); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
674 | snprintf(pmpt, Config.lcd_cols + 1, "Edit %s", text); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
675 | prompt(100, pmpt); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
676 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
677 | /* |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
678 | * Count valid sensors |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
679 | */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
680 | choices = 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
681 | if (old == 1) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
682 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
683 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
684 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
685 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
686 | choices++; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
687 | if (choices == old) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
688 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
689 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
690 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
691 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
692 | prompt(200, pmpt); /* Display current relay */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
693 | i = 1; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
694 | if (idx == 1) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
695 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
696 | } else { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
697 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
698 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
699 | i++; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
700 | if (i == idx) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
701 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
702 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
703 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
704 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
705 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
706 | prompt(300, pmpt); /* Display possible new relay */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
707 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
708 | if (choices == 1) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
709 | prompt(405, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
710 | else if (idx == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
711 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
712 | else if (idx == choices) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
713 | prompt(404, NULL); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
714 | else |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
715 | prompt(403, NULL); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
716 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
717 | key = keywait(); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
718 | if ((key == KEY_RETURN) || my_shutdown) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
719 | if (debug) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
720 | fprintf(stdout, "End editRelay\n"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
721 | return; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
722 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
723 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
724 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
725 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
726 | if ((key == KEY_DOWN) && (idx < choices)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
727 | idx++; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
728 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
729 | if ((key == KEY_ENTER) && (idx != old)) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
730 | /* |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
731 | * Select new output. |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
732 | */ |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
733 | if (idx == 1) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
734 | /* |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
735 | * Disable the output |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
736 | */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
737 | strncpy(uuid, (char *)"00000000-0000-0000-0000-000000000000", 36); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
738 | old = idx; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
739 | } else { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
740 | i = 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
741 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
742 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
743 | i++; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
744 | if (i == idx) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
745 | strncpy(uuid, device->uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
746 | break; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
747 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
748 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
749 | } |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
750 | old = idx; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
751 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
752 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
753 | } |
449 | 754 | } |
755 | ||
756 | ||
757 | ||
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
758 | /* |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
759 | * Edit a single unit |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
760 | */ |
442 | 761 | void editUnit(units_list *unit) |
762 | { | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
763 | int idx = 1, key; |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
764 | char pmpt[81], *uuid, *name; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
765 | uLong ocrc, ncrc; |
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
|
766 | |
442 | 767 | if (debug) |
768 | fprintf(stdout, "Start edit brewsystem %d %s\n", unit->number, unit->uuid); | |
769 | ||
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
|
770 | prompt(0, NULL); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
771 | ncrc = ocrc = crc32(0L, Z_NULL, 0); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
772 | ocrc = crc32(ocrc, (const Bytef *) unit, sizeof(units_list)); |
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
|
773 | |
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
|
774 | for (;;) { |
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
|
775 | |
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
|
776 | prompt(0, NULL); |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
777 | prompt(193, NULL); |
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
|
778 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
779 | if (idx == 1) |
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
|
780 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
781 | else if (idx == 21) |
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
|
782 | prompt(404, NULL); |
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
|
783 | else |
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
|
784 | prompt(403, NULL); |
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
|
785 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
786 | switch (idx) { // 12345678901234567890 |
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
|
787 | case 1: snprintf(pmpt, Config.lcd_cols + 1, "Unit name:"); |
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
|
788 | prompt(200, pmpt); |
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
|
789 | snprintf(pmpt, Config.lcd_cols + 1, "%s", unit->name); |
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
|
790 | prompt(300, pmpt); |
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
|
791 | 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
|
792 | case 2: snprintf(pmpt, Config.lcd_cols + 1, " HLT sensor setup"); |
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
|
793 | prompt(200, pmpt); |
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
|
794 | 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
|
795 | case 3: snprintf(pmpt, Config.lcd_cols + 1, " HLT heater setup"); |
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
|
796 | prompt(200, pmpt); |
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
|
797 | 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
|
798 | case 4: snprintf(pmpt, Config.lcd_cols + 1, " MLT sensor setup"); |
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
|
799 | prompt(200, pmpt); |
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
|
800 | 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
|
801 | case 5: snprintf(pmpt, Config.lcd_cols + 1, " MLT heater setup"); |
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
|
802 | prompt(200, pmpt); |
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
|
803 | 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
|
804 | case 6: snprintf(pmpt, Config.lcd_cols + 1, " MLT pump setup"); |
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
|
805 | prompt(200, pmpt); |
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
|
806 | 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
|
807 | case 7: snprintf(pmpt, Config.lcd_cols + 1, "MLT heat b4 HLT: %s", unit->hlt_heater_mltfirst ? (char *)"Yes":(char *)"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
|
808 | prompt(200, pmpt); |
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
|
809 | break; |
448 | 810 | case 8: snprintf(pmpt, Config.lcd_cols + 1, "Pump cycle: %3d mins", unit->pump_cycle); |
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
|
811 | prompt(200, pmpt); |
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
|
812 | break; |
448 | 813 | case 9: snprintf(pmpt, Config.lcd_cols + 1, "Pump rest : %3d mins", unit->pump_rest); |
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
|
814 | prompt(200, pmpt); |
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
|
815 | 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
|
816 | case 10: snprintf(pmpt, Config.lcd_cols + 1, " Pump pre-mash: %s", unit->pump_premash ? (char *)"Yes":(char *)"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
|
817 | prompt(200, pmpt); |
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
|
818 | 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
|
819 | case 11: snprintf(pmpt, Config.lcd_cols + 1, " Pump on-mash: %s", unit->pump_onmash ? (char *)"Yes":(char *)"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
|
820 | prompt(200, pmpt); |
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
|
821 | 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
|
822 | case 12: snprintf(pmpt, Config.lcd_cols + 1, " Pump mashout: %s", unit->pump_mashout ? (char *)"Yes":(char *)"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
|
823 | prompt(200, pmpt); |
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
|
824 | 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
|
825 | case 13: snprintf(pmpt, Config.lcd_cols + 1, " Pump on-boil: %s", unit->pump_onboil ? (char *)"Yes":(char *)"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
|
826 | prompt(200, pmpt); |
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
|
827 | 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
|
828 | case 14: snprintf(pmpt, Config.lcd_cols + 1, " Pump stop: %5.1f\001", unit->pump_stop); |
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
|
829 | prompt(200, pmpt); |
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
|
830 | 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
|
831 | case 15: snprintf(pmpt, Config.lcd_cols + 1, " Skip Add: %s", unit->skip_add ? (char *)"Yes":(char *)"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
|
832 | prompt(200, pmpt); |
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
|
833 | 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
|
834 | case 16: snprintf(pmpt, Config.lcd_cols + 1, " Skip Remove: %s", unit->skip_remove ? (char *)"Yes":(char *)"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
|
835 | prompt(200, pmpt); |
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
|
836 | 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
|
837 | case 17: snprintf(pmpt, Config.lcd_cols + 1, " Skip Iodine: %s", unit->skip_iodine ? (char *)"Yes":(char *)"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
|
838 | prompt(200, pmpt); |
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
|
839 | 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
|
840 | case 18: snprintf(pmpt, Config.lcd_cols + 1, "Iodine time: %3d min", unit->iodine_time); |
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
|
841 | prompt(200, pmpt); |
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
|
842 | 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
|
843 | case 19: snprintf(pmpt, Config.lcd_cols + 1, " Whirlpool: %s", unit->whirlpool ? (char *)"Yes":(char *)"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
|
844 | prompt(200, pmpt); |
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
|
845 | 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
|
846 | case 20: snprintf(pmpt, Config.lcd_cols + 1, " HLT PID setup"); |
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
|
847 | prompt(200, pmpt); |
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
|
848 | 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
|
849 | case 21: snprintf(pmpt, Config.lcd_cols + 1, " MLT PID setup"); |
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
|
850 | prompt(200, pmpt); |
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
|
851 | 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
|
852 | } |
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
|
853 | |
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
|
854 | key = keywait(); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
855 | if ((key == KEY_RETURN) || my_shutdown) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
856 | ncrc = crc32(ncrc, (const Bytef *)unit, sizeof(units_list)); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
857 | if (ocrc != ncrc) |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
858 | wrconfig(); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
859 | if (debug) |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
860 | fprintf(stdout, "End edit brewsystem %d %s\n", unit->number, unit->uuid); |
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
|
861 | return; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
862 | } |
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
|
863 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
864 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
865 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
866 | if ((key == KEY_DOWN) && (idx < 21)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
867 | idx++; |
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
|
868 | |
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
|
869 | if (key == KEY_ENTER) { |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
870 | switch(idx) { |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
871 | case 1: name = calloc(sizeof(char), 21); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
872 | snprintf(name, 21, unit->name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
873 | editName(name, (char *)"Unit name"); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
874 | if (unit->name) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
875 | free(unit->name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
876 | unit->name = xstrcpy(name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
877 | free(name); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
878 | break; |
449 | 879 | case 2: uuid = xstrcpy(unit->hlt_sensor.uuid); |
880 | editSensor(uuid, (char *)"HLT sensor"); | |
881 | strncpy(unit->hlt_sensor.uuid, uuid, 36); | |
882 | free(uuid); | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
883 | break; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
884 | case 3: uuid = xstrcpy(unit->hlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
885 | editRelay(uuid, (char *)"HLT heater"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
886 | strncpy(unit->hlt_heater.uuid, uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
887 | free(uuid); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
888 | break; |
449 | 889 | case 4: uuid = xstrcpy(unit->mlt_sensor.uuid); |
890 | editSensor(uuid, (char *)"MLT sensor"); | |
891 | strncpy(unit->mlt_sensor.uuid, uuid, 36); | |
892 | free(uuid); | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
893 | break; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
894 | case 5: uuid = xstrcpy(unit->mlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
895 | editRelay(uuid, (char *)"MLT heater"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
896 | strncpy(unit->mlt_heater.uuid, uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
897 | free(uuid); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
898 | break; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
899 | case 6: uuid = xstrcpy(unit->mlt_pump.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
900 | editRelay(uuid, (char *)"MLT pump"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
901 | strncpy(unit->mlt_pump.uuid, uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
902 | free(uuid); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
903 | 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
|
904 | case 7: toggleYesNo(&unit->hlt_heater_mltfirst, (char *)"MLT heat b4 HLT"); |
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
|
905 | break; |
448 | 906 | case 8: editInteger(&unit->pump_cycle, 5, 15, 1, (char *)"Pump cycle", (char *)"mins"); |
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
|
907 | break; |
448 | 908 | case 9: editInteger(&unit->pump_rest, 1, 5, 1, (char *)"Pump rest ", (char *)"mins"); |
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
|
909 | 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
|
910 | case 10: toggleYesNo(&unit->pump_premash, (char *)" Pump pre-mash"); |
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
|
911 | 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
|
912 | case 11: toggleYesNo(&unit->pump_onmash, (char *)" Pump on-mash"); |
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
|
913 | 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
|
914 | case 12: toggleYesNo(&unit->pump_mashout, (char *)" Pump mashout"); |
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
|
915 | 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
|
916 | case 13: toggleYesNo(&unit->pump_onboil, (char *)" Pump on-boil"); |
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
|
917 | 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
|
918 | case 14: editFloat(&unit->pump_stop, 80.0, 110.0, (char *)" Pump stop"); |
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
|
919 | 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
|
920 | case 15: toggleYesNo(&unit->skip_add, (char *)"Skip add water"); |
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
|
921 | 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
|
922 | case 16: toggleYesNo(&unit->skip_remove, (char *)"Skip remove Mash"); |
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
|
923 | 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
|
924 | case 17: toggleYesNo(&unit->skip_iodine, (char *)"Skip iodine test"); |
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
|
925 | break; |
448 | 926 | case 18: editInteger(&unit->iodine_time, 10, 240, 10, (char *)"Iodine time", (char *)"min"); |
927 | 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
|
928 | case 19: toggleYesNo(&unit->whirlpool, (char *)"Do a whirlpool"); |
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
|
929 | break; |
448 | 930 | case 20: editPID(unit->PID_hlt); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
931 | break; |
448 | 932 | case 21: editPID(unit->PID_mlt); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
933 | 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
|
934 | } |
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
|
935 | } |
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
|
936 | } |
442 | 937 | } |
938 | ||
939 | ||
940 | ||
941 | void addUnit(int number) | |
942 | { | |
943 | units_list *tmpu, *unit = (units_list *)malloc(sizeof(units_list)); | |
944 | char name[81]; | |
945 | uuid_t uu; | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
946 | double Input, Output, Setpoint; |
442 | 947 | |
948 | if (debug) | |
949 | fprintf(stdout, "Adding new brewsystem %d\n", number); | |
950 | unit->next = NULL; | |
951 | unit->version = 1; | |
952 | unit->uuid = malloc(37); | |
953 | uuid_generate(uu); | |
954 | uuid_unparse(uu, unit->uuid); | |
955 | snprintf(name, 20, "System %d", number); | |
956 | unit->name = xstrcpy(name); | |
957 | unit->number = number; | |
958 | if (number == 1) | |
959 | unit->active = 1; | |
960 | else | |
961 | unit->active = 0; | |
449 | 962 | unit->hlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
963 | unit->hlt_sensor.state = DEVPRESENT_UNDEF; | |
964 | unit->hlt_sensor.value = 0; | |
965 | unit->mlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); | |
966 | unit->mlt_sensor.state = DEVPRESENT_UNDEF; | |
967 | unit->mlt_sensor.value = 0; | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
968 | unit->hlt_heater.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
969 | unit->hlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
970 | unit->hlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
971 | unit->mlt_heater.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
972 | unit->mlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
973 | unit->mlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
974 | unit->mlt_pump.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
975 | unit->mlt_pump.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
976 | unit->mlt_pump.delay = 0; |
442 | 977 | unit->hlt_heater_mltfirst = 1; |
978 | unit->pump_cycle = 7; | |
979 | unit->pump_rest = 2; | |
980 | unit->pump_premash = 1; | |
981 | unit->pump_onmash = 1; | |
982 | unit->pump_mashout = 0; | |
983 | unit->pump_onboil = 0; | |
984 | unit->pump_stop = 90; | |
985 | unit->skip_add = 0; | |
986 | unit->skip_remove = 0; | |
987 | unit->skip_iodine = 0; | |
988 | unit->iodine_time = 90; | |
989 | unit->whirlpool = 1; | |
990 | unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); | |
991 | unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
992 | Input = Setpoint = 20.0; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
993 | Output = 0; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
994 | PID_init(unit->PID_hlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT); |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
995 | PID_init(unit->PID_mlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT); |
442 | 996 | |
997 | editUnit(unit); | |
998 | ||
999 | if (Config.units == NULL) { | |
1000 | Config.units = unit; | |
1001 | } else { | |
1002 | for (tmpu = Config.units; tmpu; tmpu = tmpu->next) { | |
1003 | if (tmpu->next == NULL) { | |
1004 | tmpu->next = unit; | |
1005 | break; | |
1006 | } | |
1007 | } | |
1008 | } | |
1009 | syslog(LOG_NOTICE, "Brewsystem %d added to the configuration", number); | |
1010 | if (debug) | |
1011 | fprintf(stdout, "Brewsystem %d added to the configuration\n", number); | |
1012 | } | |
1013 | ||
1014 | ||
1015 | ||
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
|
1016 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1017 | * Edit a single 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
|
1018 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1019 | void editRecipe(a_recipe *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
|
1020 | { |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1021 | int idx = 1, i, key; |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1022 | char pmpt[81], *name; |
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
|
1023 | uLong ocrc, ncrc; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1024 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1025 | if (debug) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1026 | fprintf(stdout, "Start edit recipe `%s' %s\n", recipe->name, recipe->uuid); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1027 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1028 | prompt(0, NULL); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1029 | ncrc = ocrc = crc32(0L, Z_NULL, 0); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1030 | ocrc = crc32(ocrc, (const Bytef *) recipe, sizeof(a_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
|
1031 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1032 | for (;;) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1033 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1034 | prompt(0, NULL); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1035 | prompt(191, NULL); /* " Edit recipe " */ |
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
|
1036 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1037 | if (idx == 1) |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1038 | prompt(402, NULL); /* "--- dwn quit ok " */ |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1039 | else if (idx == 24) |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1040 | prompt(404, NULL); /* " up --- quit ok " */ |
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
|
1041 | else |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1042 | prompt(403, NULL); /* " up dwn quit ok " */ |
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
|
1043 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1044 | switch (idx) { // 12345678901234567890 |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1045 | case 1: snprintf(pmpt, Config.lcd_cols + 1, "Recipe name:"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1046 | prompt(200, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1047 | snprintf(pmpt, Config.lcd_cols + 1, "%s", recipe->name); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1048 | prompt(300, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1049 | 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
|
1050 | case 2: snprintf(pmpt, Config.lcd_cols + 1, "Recipe code:"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1051 | prompt(200, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1052 | snprintf(pmpt, Config.lcd_cols + 1, "%s", recipe->code); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1053 | prompt(300, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1054 | 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
|
1055 | case 3: snprintf(pmpt, Config.lcd_cols + 1, "Boil time: %3d mins", recipe->boiltime); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1056 | prompt(200, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1057 | break; |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1058 | case 4: snprintf(pmpt, Config.lcd_cols + 1, " Cool to: %5.1f\001", recipe->coolto); |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1059 | prompt(200, pmpt); |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1060 | break; |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1061 | case 5: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1062 | case 6: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1063 | case 7: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1064 | case 8: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1065 | case 9: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1066 | case 10: |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1067 | case 11: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1068 | case 12: snprintf(pmpt, Config.lcd_cols + 1, "Mash: %s", recipe->mash[idx - 5].name); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1069 | prompt(200, pmpt); |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1070 | if (recipe->mash[idx - 5].skip) |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1071 | snprintf(pmpt, Config.lcd_cols + 1, " Skipped"); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1072 | else |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1073 | snprintf(pmpt, Config.lcd_cols + 1, " Sv %4.1f\001 %3d mins", recipe->mash[idx - 5].setpoint, recipe->mash[idx - 5].duration); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1074 | prompt(300, pmpt); |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1075 | break; |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1076 | case 13: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1077 | case 14: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1078 | case 15: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1079 | case 16: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1080 | case 17: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1081 | case 18: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1082 | case 19: |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1083 | case 20: |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1084 | case 21: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1085 | case 22: snprintf(pmpt, Config.lcd_cols + 1, "Add: %s", recipe->hops[idx - 13].name); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1086 | prompt(200, pmpt); |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1087 | if (recipe->hops[idx - 13].skip) |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1088 | snprintf(pmpt, Config.lcd_cols + 1, " Skipped"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1089 | else { |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1090 | if (recipe->hops[idx - 13].boiltime == -1) |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1091 | snprintf(pmpt, Config.lcd_cols + 1, " First Wort Hop"); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1092 | else |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1093 | snprintf(pmpt, Config.lcd_cols + 1, " Boil for %3d mins", recipe->hops[idx - 13].boiltime); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1094 | } |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1095 | prompt(300, pmpt); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1096 | break; |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1097 | case 23: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1098 | case 24: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1099 | case 25: snprintf(pmpt, Config.lcd_cols + 1, "Hopstand: %s", recipe->hopstand[idx - 23].name); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1100 | prompt(200, pmpt); |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1101 | if (recipe->hopstand[idx - 23].skip) |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1102 | snprintf(pmpt, Config.lcd_cols + 1, " Skipped"); |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1103 | else if (recipe->hopstand[idx - 23].hold) |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1104 | snprintf(pmpt, Config.lcd_cols + 1, "Hold at %4.1f %3d mins", recipe->hopstand[idx - 23].setpoint, recipe->hopstand[idx - 23].duration); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1105 | else |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1106 | snprintf(pmpt, Config.lcd_cols + 1, "Hold for %3d mins", recipe->hopstand[idx - 23].duration); |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1107 | prompt(300, pmpt); |
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1108 | 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
|
1109 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1110 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1111 | key = keywait(); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1112 | if ((key == KEY_RETURN) || my_shutdown) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1113 | ncrc = crc32(ncrc, (const Bytef *)recipe, sizeof(a_recipe)); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1114 | if (ocrc != ncrc) { |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1115 | /* |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1116 | * Fix some user errors |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1117 | */ |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1118 | for (i = 0; i < 8; i++) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1119 | if (recipe->hops[i].boiltime > recipe->boiltime) |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1120 | recipe->hops[i].boiltime = recipe->boiltime; |
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
|
1121 | wrrecipes(); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1122 | } |
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
|
1123 | if (debug) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1124 | fprintf(stdout, "End edit recipe `%s' %s\n", recipe->name, recipe->uuid); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1125 | return; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1126 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1127 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1128 | if ((key == KEY_UP) && (idx > 1)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1129 | idx--; |
462
830ae3c3ef98
Added recipe setup display menu.
Michiel Broek <mbroek@mbse.eu>
parents:
461
diff
changeset
|
1130 | if ((key == KEY_DOWN) && (idx < 24)) |
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
|
1131 | idx++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1132 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1133 | if (key == KEY_ENTER) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1134 | switch(idx) { |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1135 | case 1: name = calloc(sizeof(char), 21); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1136 | snprintf(name, 21, recipe->name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1137 | editName(name, (char *)"Recipe name"); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1138 | if (recipe->name) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1139 | free(recipe->name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1140 | recipe->name = xstrcpy(name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1141 | free(name); |
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
|
1142 | break; |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1143 | case 2: name = calloc(sizeof(char), 21); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1144 | snprintf(name, 21, recipe->code); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1145 | editName(name, (char *)"Recipe code"); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1146 | if (recipe->code) |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1147 | free(recipe->code); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1148 | recipe->code = xstrcpy(name); |
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1149 | free(name); |
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
|
1150 | 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
|
1151 | case 3: editInteger(&recipe->boiltime, 60, 240, 5, (char *)"Boil time:", (char *)"mins"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1152 | break; |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1153 | case 4: editFloat(&recipe->coolto, 10.0, 30.0, (char *)" Cool to"); |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1154 | |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1155 | case 5: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1156 | case 6: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1157 | case 7: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1158 | case 8: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1159 | case 9: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1160 | case 10: |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1161 | case 11: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1162 | case 12: editMash(&recipe->mash[idx-5]); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1163 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1164 | case 13: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1165 | case 14: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1166 | case 15: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1167 | case 16: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1168 | case 17: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1169 | case 18: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1170 | case 19: |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1171 | case 20: |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1172 | case 21: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1173 | case 22: editHopaddition(&recipe->hops[idx-13], recipe->boiltime); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1174 | break; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1175 | case 23: |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1176 | case 24: |
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1177 | case 25: editHopstand(&recipe->hopstand[idx-23]); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1178 | 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
|
1179 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1180 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1181 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1182 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1183 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1184 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1185 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1186 | void addRecipe(int number) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1187 | { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1188 | a_recipe *tmpu, *recipe = (a_recipe *)malloc(sizeof(a_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
|
1189 | char name[81]; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1190 | uuid_t uu; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1191 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1192 | if (debug) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1193 | fprintf(stdout, "Adding new recipe %d\n", number); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1194 | recipe->next = NULL; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1195 | recipe->uuid = malloc(37); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1196 | uuid_generate(uu); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1197 | uuid_unparse(uu, recipe->uuid); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1198 | snprintf(name, 21, "New recipe %d", number); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1199 | recipe->name = xstrcpy(name); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1200 | snprintf(name, 21, "%04d", number); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1201 | recipe->code = xstrcpy(name); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1202 | recipe->boiltime = 90; |
473
fdd30e935079
The brew state machine is complete, works but is not bugfree
Michiel Broek <mbroek@mbse.eu>
parents:
463
diff
changeset
|
1203 | recipe->coolto = 20.0; |
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
|
1204 | recipe->starttime = recipe->endtime = (time_t)0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1205 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1206 | * Initial mash schedule, set a single-step 67 degr. mash |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1207 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1208 | recipe->mash[0].name = xstrcpy((char *)"Mash-in"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1209 | recipe->mash[0].min = 20; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1210 | recipe->mash[0].max = 80; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1211 | recipe->mash[0].canskip = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1212 | recipe->mash[0].setpoint = 68.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1213 | recipe->mash[0].skip = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1214 | recipe->mash[0].duration = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1215 | recipe->mash[1].name = xstrcpy((char *)"Phytase"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1216 | recipe->mash[1].min = 25; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1217 | recipe->mash[1].max = 55; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1218 | recipe->mash[1].canskip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1219 | recipe->mash[1].setpoint = 40.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1220 | recipe->mash[1].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1221 | recipe->mash[1].duration = 10; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1222 | recipe->mash[2].name = xstrcpy((char *)"Glucanase"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1223 | recipe->mash[2].min = 35; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1224 | recipe->mash[2].max = 50; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1225 | recipe->mash[2].canskip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1226 | recipe->mash[2].setpoint = 45.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1227 | recipe->mash[2].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1228 | recipe->mash[2].duration = 10; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1229 | recipe->mash[3].name = xstrcpy((char *)"Protease"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1230 | recipe->mash[3].min = 45; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1231 | recipe->mash[3].max = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1232 | recipe->mash[3].canskip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1233 | recipe->mash[3].setpoint = 55.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1234 | recipe->mash[3].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1235 | recipe->mash[3].duration = 10; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1236 | recipe->mash[4].name = xstrcpy((char *)"B-Amylase"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1237 | recipe->mash[4].min = 50; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1238 | recipe->mash[4].max = 70; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1239 | recipe->mash[4].canskip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1240 | recipe->mash[4].setpoint = 62.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1241 | recipe->mash[4].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1242 | recipe->mash[4].duration = 30; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1243 | recipe->mash[5].name = xstrcpy((char *)"A-Amylase 1"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1244 | recipe->mash[5].min = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1245 | recipe->mash[5].max = 76; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1246 | recipe->mash[5].canskip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1247 | recipe->mash[5].setpoint = 67.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1248 | recipe->mash[5].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1249 | recipe->mash[5].duration = 30; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1250 | recipe->mash[6].name = xstrcpy((char *)"A-Amylase 2"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1251 | recipe->mash[6].min = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1252 | recipe->mash[6].max = 76; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1253 | recipe->mash[6].canskip = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1254 | recipe->mash[6].setpoint = 67.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1255 | recipe->mash[6].skip = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1256 | recipe->mash[6].duration = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1257 | recipe->mash[7].name = xstrcpy((char *)"Mash-out"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1258 | recipe->mash[7].min = 75; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1259 | recipe->mash[7].max = 80; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1260 | recipe->mash[7].canskip = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1261 | recipe->mash[7].setpoint = 78.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1262 | recipe->mash[7].skip = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1263 | recipe->mash[7].duration = 10; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1264 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1265 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1266 | * Add 2 hop additions, maximum 10 |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1267 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1268 | recipe->hops[0].name = xstrcpy((char *)"Hops 1"); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1269 | recipe->hops[0].skip = 0; |
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
|
1270 | recipe->hops[0].boiltime = 90; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1271 | recipe->hops[1].name = xstrcpy((char *)"Hops 2"); |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1272 | recipe->hops[1].skip = 0; |
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
|
1273 | recipe->hops[1].boiltime = 5; |
463
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1274 | recipe->hops[2].name = xstrcpy((char *)"Hops 3"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1275 | recipe->hops[2].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1276 | recipe->hops[2].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1277 | recipe->hops[3].name = xstrcpy((char *)"Hops 4"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1278 | recipe->hops[3].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1279 | recipe->hops[3].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1280 | recipe->hops[4].name = xstrcpy((char *)"Hops 5"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1281 | recipe->hops[4].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1282 | recipe->hops[4].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1283 | recipe->hops[5].name = xstrcpy((char *)"Hops 6"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1284 | recipe->hops[5].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1285 | recipe->hops[5].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1286 | recipe->hops[6].name = xstrcpy((char *)"Hops 7"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1287 | recipe->hops[6].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1288 | recipe->hops[6].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1289 | recipe->hops[7].name = xstrcpy((char *)"Hops 8"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1290 | recipe->hops[7].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1291 | recipe->hops[7].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1292 | recipe->hops[8].name = xstrcpy((char *)"Hops 9"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1293 | recipe->hops[8].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1294 | recipe->hops[8].boiltime = 0; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1295 | recipe->hops[9].name = xstrcpy((char *)"Hops 10"); |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1296 | recipe->hops[9].skip = 1; |
a1da58215b65
Completed the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
462
diff
changeset
|
1297 | recipe->hops[9].boiltime = 0; |
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
|
1298 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1299 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1300 | * Add 3 hopstands, disabled by default. |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1301 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1302 | recipe->hopstand[0].name = xstrcpy((char *)"Hopstand hot"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1303 | recipe->hopstand[0].min = 88; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1304 | recipe->hopstand[0].max = 100; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1305 | recipe->hopstand[0].hold = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1306 | recipe->hopstand[0].setpoint = 93.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1307 | recipe->hopstand[0].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1308 | recipe->hopstand[0].duration = 30; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1309 | recipe->hopstand[1].name = xstrcpy((char *)"Hopstand default"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1310 | recipe->hopstand[1].min = 72; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1311 | recipe->hopstand[1].max = 77; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1312 | recipe->hopstand[1].hold = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1313 | recipe->hopstand[1].setpoint = 75.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1314 | recipe->hopstand[1].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1315 | recipe->hopstand[1].duration = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1316 | recipe->hopstand[2].name = xstrcpy((char *)"Hopstand cool"); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1317 | recipe->hopstand[2].min = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1318 | recipe->hopstand[2].max = 66; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1319 | recipe->hopstand[2].hold = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1320 | recipe->hopstand[2].setpoint = 63.0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1321 | recipe->hopstand[2].skip = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1322 | recipe->hopstand[2].duration = 60; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1323 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1324 | editRecipe(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
|
1325 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1326 | if (recipes == NULL) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1327 | recipes = 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
|
1328 | } else { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1329 | for (tmpu = recipes; tmpu; tmpu = tmpu->next) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1330 | if (tmpu->next == NULL) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1331 | tmpu->next = 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
|
1332 | 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
|
1333 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1334 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1335 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1336 | syslog(LOG_NOTICE, "Recipe %d added", number); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1337 | if (debug) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1338 | fprintf(stdout, "Recipe %d added\n", number); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1339 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1340 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1341 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1342 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1343 | void editRecipes(void) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1344 | { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1345 | int total, i, key, choice = 1;; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1346 | a_recipe *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
|
1347 | char pmpt[81]; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1348 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1349 | prompt(0, NULL); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1350 | for (;;) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1351 | total = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1352 | for (recipe = recipes; recipe; recipe = recipe->next) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1353 | total++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1354 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1355 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1356 | if (debug) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1357 | fprintf(stdout, "editRecipes total=%d choice=%d\n", total, choice); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1358 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1359 | i = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1360 | if (total) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1361 | for (recipe = recipes; recipe; recipe = recipe->next) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1362 | i++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1363 | if (i == choice) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1364 | 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
|
1365 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1366 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1367 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1368 | prompt(102, NULL); /* " SETUP MENU " */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1369 | prompt(221, NULL); /* " 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
|
1370 | if (total) { |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1371 | snprintf(pmpt, Config.lcd_cols + 1, "%s %s ", recipe->code, recipe->name); |
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
|
1372 | prompt(300, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1373 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1374 | if (total == 0) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1375 | prompt(416, NULL); /* "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
|
1376 | else if (total == 1) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1377 | prompt(415, NULL); /* "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
|
1378 | else if (total && (choice == 1)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1379 | prompt(414, NULL); /* "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
|
1380 | else if (total && (choice == total)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1381 | prompt(404, NULL); /* " up --- 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
|
1382 | else |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1383 | prompt(403, NULL); /* " up 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
|
1384 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1385 | key = keywait(); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1386 | if ((key == KEY_RETURN) || my_shutdown) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1387 | return; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1388 | if (total && (key == KEY_ENTER)) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1389 | editRecipe(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
|
1390 | prompt(0, NULL); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1391 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1392 | if (key == KEY_UP) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1393 | if ((total == 1) || (choice == 1)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1394 | addRecipe(total + 1); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1395 | else if (choice > 1) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1396 | choice--; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1397 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1398 | if ((key == KEY_DOWN) && (total > 1) && (choice < total)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1399 | choice++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1400 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1401 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1402 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1403 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1404 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1405 | void editUnits(void) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1406 | { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1407 | int total, i, key, choice = 1;; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1408 | units_list *unit; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1409 | char pmpt[81]; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1410 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1411 | prompt(0, NULL); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1412 | for (;;) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1413 | total = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1414 | for (unit = Config.units; unit; unit = unit->next) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1415 | total++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1416 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1417 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1418 | if (debug) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1419 | fprintf(stdout, "editUnits total=%d choice=%d\n", total, choice); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1420 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1421 | if (total == 0) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1422 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1423 | * Impossible unless first setup was skipped |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1424 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1425 | addUnit(1); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1426 | total = 1; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1427 | } else { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1428 | i = 0; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1429 | for (unit = Config.units; unit; unit = unit->next) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1430 | i++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1431 | if (i == choice) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1432 | 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
|
1433 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1434 | prompt(102, NULL); /* " SETUP MENU " */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1435 | prompt(222, NULL); /* " Select Brewsystem " */ |
461
482bab226340
Changed some prompt numbers. Added name editor.
Michiel Broek <mbroek@mbse.eu>
parents:
459
diff
changeset
|
1436 | snprintf(pmpt, Config.lcd_cols + 1, "%s ", unit->name); |
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
|
1437 | prompt(300, pmpt); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1438 | if (total == 1) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1439 | prompt(415, NULL); /* "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
|
1440 | else if (choice == 1) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1441 | prompt(414, NULL); /* "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
|
1442 | else if (choice == total) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1443 | prompt(404, NULL); /* " up --- 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
|
1444 | else |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1445 | prompt(403, NULL); /* " up 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
|
1446 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1447 | key = keywait(); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1448 | if ((key == KEY_RETURN) || my_shutdown) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1449 | return; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1450 | if (key == KEY_ENTER) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1451 | editUnit(unit); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1452 | prompt(0, NULL); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1453 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1454 | if (key == KEY_UP) { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1455 | if ((total == 1) || (choice == 1)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1456 | addUnit(total + 1); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1457 | else if (choice > 1) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1458 | choice--; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1459 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1460 | if ((key == KEY_DOWN) && (total > 1) && (choice < total)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1461 | choice++; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1462 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1463 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1464 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1465 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1466 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1467 | |
442 | 1468 | void setup(void) |
1469 | { | |
1470 | int key, option = 202; | |
1471 | ||
1472 | for (;;) { | |
1473 | if (debug) | |
1474 | fprintf(stdout, "setup() option=%d\n", option); | |
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
|
1475 | prompt(0, NULL); |
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
|
1476 | prompt(102, NULL); /* " SETUP MENU " */ |
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
|
1477 | prompt(option, NULL); |
442 | 1478 | if (option == 202) |
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
|
1479 | prompt(402, NULL); /* "--- dwn quit ok " */ |
442 | 1480 | #ifdef USE_SIMULATOR |
1481 | else if (option == 205) | |
1482 | #else | |
1483 | else if (option == 204) | |
1484 | #endif | |
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
|
1485 | prompt(404, NULL); /* " up --- quit ok " */ |
442 | 1486 | else |
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
|
1487 | prompt(403, NULL); /* " up dwn quit ok " */ |
442 | 1488 | |
1489 | key = keywait(); | |
1490 | ||
1491 | if ((key == KEY_RETURN) || my_shutdown) | |
1492 | return; | |
1493 | if ((key == KEY_UP) && (option > 202)) { | |
1494 | option--; | |
1495 | } | |
1496 | #ifdef USE_SIMULATOR | |
1497 | if ((key == KEY_DOWN) && (option < 205)) { | |
1498 | #else | |
1499 | if ((key == KEY_DOWN) && (option < 204)) { | |
1500 | #endif | |
1501 | option++; | |
1502 | } | |
1503 | ||
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
|
1504 | if (key == KEY_ENTER) { |
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
|
1505 | switch(option) { |
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
|
1506 | case 202: editRecipes(); |
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
|
1507 | 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
|
1508 | case 203: editUnits(); |
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
|
1509 | 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
|
1510 | case 204: // devices |
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
|
1511 | 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
|
1512 | #ifdef USE_SIMULATOR |
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
|
1513 | case 205: // simulator |
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
|
1514 | 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
|
1515 | #endif |
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
|
1516 | } |
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
|
1517 | if (my_shutdown) |
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
|
1518 | return; |
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
|
1519 | } |
442 | 1520 | } |
1521 | } | |
1522 | ||
1523 |