Tue, 15 Dec 2015 23:11:42 +0100
Added the beginning of the recipes editor. Added load and save of recipes file.
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 | ||
212 | void editPID(pid_var *pid) | |
213 | { | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
214 | int idx = 1, key, val; |
448 | 215 | char pmpt[81]; |
216 | double Kp, Ki, Kd; | |
217 | ||
218 | if (debug) | |
219 | fprintf(stdout, "editPID()\n"); | |
220 | ||
221 | for (;;) { | |
222 | prompt(0, NULL); | |
223 | prompt(135, NULL); | |
224 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
225 | if (idx == 1) |
448 | 226 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
227 | else if (idx == 5) |
448 | 228 | prompt(404, NULL); |
229 | else | |
230 | prompt(403, NULL); | |
231 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
232 | switch (idx) { |
448 | 233 | case 1: snprintf(pmpt, Config.lcd_cols + 1, "PID Kp: %5.2f", PID_getKp(pid)); |
234 | break; | |
235 | case 2: snprintf(pmpt, Config.lcd_cols + 1, "PID Ki: %5.2f", PID_getKi(pid)); | |
236 | break; | |
237 | case 3: snprintf(pmpt, Config.lcd_cols + 1, "PID Kd: %5.2f", PID_getKd(pid)); | |
238 | break; | |
239 | case 4: snprintf(pmpt, Config.lcd_cols + 1, "SampleTime: %3d mSec", PID_getSampleTime(pid)); | |
240 | break; | |
241 | case 5: snprintf(pmpt, Config.lcd_cols + 1, "Direction: %s", PID_getDirection(pid) ? (char *)"Reverse" : (char *)"Direct"); | |
242 | break; | |
243 | } | |
244 | prompt(200, pmpt); | |
245 | ||
246 | key = keywait(); | |
247 | if ((key == KEY_RETURN) || my_shutdown) { | |
248 | if (debug) | |
249 | fprintf(stdout, "End editPID\n"); | |
250 | return; | |
251 | } | |
252 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
253 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
254 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
255 | if ((key == KEY_DOWN) && (idx < 5)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
256 | idx++; |
448 | 257 | |
258 | if (key == KEY_ENTER) { | |
259 | ||
260 | Kp = PID_getKp(pid); | |
261 | Ki = PID_getKi(pid); | |
262 | Kd = PID_getKd(pid); | |
263 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
264 | switch(idx) { |
448 | 265 | case 1: editDouble(&Kp, 0.5, 50, (char *)"PID Kp"); |
266 | PID_setTunings(pid, Kp, Ki, Kd); | |
267 | break; | |
268 | case 2: editDouble(&Ki, 0.5, 50, (char *)"PID Ki"); | |
269 | PID_setTunings(pid, Kp, Ki, Kd); | |
270 | break; | |
271 | case 3: editDouble(&Kd, 0.5, 50, (char *)"PID Kd"); | |
272 | PID_setTunings(pid, Kp, Ki, Kd); | |
273 | break; | |
274 | case 4: val = PID_getSampleTime(pid); | |
275 | editInteger(&val, 50, 500, 10, (char *)"SampleTime", (char *)"mSec"); | |
276 | PID_setSampleTime(pid, val); | |
277 | break; | |
278 | case 5: val = PID_getDirection(pid); | |
279 | toggleDirection(&val, (char *)"Direction"); | |
280 | PID_setDirection(pid, val); | |
281 | break; | |
282 | } | |
283 | } | |
284 | } | |
285 | } | |
286 | ||
287 | ||
288 | ||
449 | 289 | void editSensor(char *uuid, char *text) |
290 | { | |
291 | char pmpt[81]; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
292 | int i, old, choices, idx = 1, key; |
449 | 293 | devices_list *device; |
294 | ||
295 | if (debug) | |
296 | fprintf(stdout, "editSensor(%s, %s)\n", uuid, text); | |
297 | ||
298 | old = 1; // 1d0e5bb8-7408-48b9-abb4-e9041d7b99fe | |
299 | if ((i = strcmp((char *)"00000000-0000-0000-0000-000000000000", uuid))) { | |
300 | for (device = Config.devices; device; device = device->next) { | |
301 | if (device->direction == DEVDIR_IN_ANALOG) { | |
302 | old++; | |
303 | if (strcmp(device->uuid, uuid) == 0) | |
304 | break; | |
305 | } | |
306 | } | |
307 | } | |
308 | ||
309 | if (debug) | |
310 | fprintf(stdout, "editSensor(%s) old sensor index=%d\n", text, old); | |
311 | ||
312 | for (;;) { | |
313 | prompt(0, NULL); | |
314 | snprintf(pmpt, Config.lcd_cols + 1, "Edit %s", text); | |
315 | prompt(100, pmpt); | |
316 | ||
317 | /* | |
318 | * Count valid sensors | |
319 | */ | |
320 | choices = 1; | |
321 | if (old == 1) { | |
322 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); | |
323 | } | |
324 | for (device = Config.devices; device; device = device->next) { | |
325 | if (device->direction == DEVDIR_IN_ANALOG) { | |
326 | choices++; | |
327 | if (choices == old) { | |
328 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); | |
329 | } | |
330 | } | |
331 | } | |
332 | prompt(200, pmpt); /* Display current sensor */ | |
333 | i = 1; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
334 | if (idx == 1) { |
449 | 335 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); |
336 | } else { | |
337 | for (device = Config.devices; device; device = device->next) { | |
338 | if (device->direction == DEVDIR_IN_ANALOG) { | |
339 | i++; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
340 | if (i == idx) { |
449 | 341 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); |
342 | } | |
343 | } | |
344 | } | |
345 | } | |
346 | prompt(300, pmpt); /* Display possible new sensor */ | |
347 | ||
348 | ||
349 | if (choices == 1) | |
350 | prompt(405, NULL); | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
351 | else if (idx == 1) |
449 | 352 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
353 | else if (idx == choices) |
449 | 354 | prompt(404, NULL); |
355 | else | |
356 | prompt(403, NULL); | |
357 | ||
358 | key = keywait(); | |
359 | if ((key == KEY_RETURN) || my_shutdown) { | |
360 | if (debug) | |
361 | fprintf(stdout, "End editSensor\n"); | |
362 | return; | |
363 | } | |
364 | ||
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
365 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
366 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
367 | if ((key == KEY_DOWN) && (idx < choices)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
368 | idx++; |
449 | 369 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
370 | if ((key == KEY_ENTER) && (idx != old)) { |
449 | 371 | /* |
372 | * Select new sensor. | |
373 | */ | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
374 | if (idx == 1) { |
449 | 375 | /* |
376 | * Disable the sensor | |
377 | */ | |
378 | 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
|
379 | old = idx; |
449 | 380 | } else { |
381 | i = 1; | |
382 | for (device = Config.devices; device; device = device->next) { | |
383 | if (device->direction == DEVDIR_IN_ANALOG) { | |
384 | i++; | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
385 | if (i == idx) { |
449 | 386 | strncpy(uuid, device->uuid, 36); |
387 | break; | |
388 | } | |
389 | } | |
390 | } | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
391 | old = idx; |
449 | 392 | } |
393 | } | |
394 | } | |
395 | } | |
396 | ||
397 | ||
398 | ||
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
399 | void editRelay(char *uuid, char *text) |
449 | 400 | { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
401 | char pmpt[81]; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
402 | int i, old, choices, idx = 1, key; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
403 | devices_list *device; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
404 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
405 | if (debug) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
406 | fprintf(stdout, "editRelay(%s, %s)\n", uuid, text); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
407 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
408 | old = 1; // 1d0e5bb8-7408-48b9-abb4-e9041d7b99fe |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
409 | if ((i = strcmp((char *)"00000000-0000-0000-0000-000000000000", uuid))) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
410 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
411 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
412 | old++; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
413 | if (strcmp(device->uuid, uuid) == 0) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
414 | break; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
415 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
416 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
417 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
418 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
419 | if (debug) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
420 | 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
|
421 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
422 | for (;;) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
423 | prompt(0, NULL); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
424 | snprintf(pmpt, Config.lcd_cols + 1, "Edit %s", text); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
425 | prompt(100, pmpt); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
426 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
427 | /* |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
428 | * Count valid sensors |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
429 | */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
430 | choices = 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
431 | if (old == 1) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
432 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
433 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
434 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
435 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
436 | choices++; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
437 | if (choices == old) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
438 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
439 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
440 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
441 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
442 | prompt(200, pmpt); /* Display current relay */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
443 | i = 1; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
444 | if (idx == 1) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
445 | snprintf(pmpt, Config.lcd_cols + 1, "N/A"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
446 | } else { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
447 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
448 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
449 | i++; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
450 | if (i == idx) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
451 | snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
452 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
453 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
454 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
455 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
456 | prompt(300, pmpt); /* Display possible new relay */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
457 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
458 | if (choices == 1) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
459 | prompt(405, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
460 | else if (idx == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
461 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
462 | else if (idx == choices) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
463 | prompt(404, NULL); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
464 | else |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
465 | prompt(403, NULL); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
466 | |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
467 | key = keywait(); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
468 | if ((key == KEY_RETURN) || my_shutdown) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
469 | if (debug) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
470 | fprintf(stdout, "End editRelay\n"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
471 | return; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
472 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
473 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
474 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
475 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
476 | if ((key == KEY_DOWN) && (idx < choices)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
477 | idx++; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
478 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
479 | if ((key == KEY_ENTER) && (idx != old)) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
480 | /* |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
481 | * Select new output. |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
482 | */ |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
483 | if (idx == 1) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
484 | /* |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
485 | * Disable the output |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
486 | */ |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
487 | 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
|
488 | old = idx; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
489 | } else { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
490 | i = 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
491 | for (device = Config.devices; device; device = device->next) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
492 | if (device->direction == DEVDIR_OUT_ANALOG) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
493 | i++; |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
494 | if (i == idx) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
495 | strncpy(uuid, device->uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
496 | break; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
497 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
498 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
499 | } |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
500 | old = idx; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
501 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
502 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
503 | } |
449 | 504 | } |
505 | ||
506 | ||
507 | ||
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
508 | /* |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
509 | * Edit a single unit |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
510 | */ |
442 | 511 | void editUnit(units_list *unit) |
512 | { | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
513 | int idx = 1, key; |
449 | 514 | char pmpt[81], *uuid; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
515 | 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
|
516 | |
442 | 517 | if (debug) |
518 | fprintf(stdout, "Start edit brewsystem %d %s\n", unit->number, unit->uuid); | |
519 | ||
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
|
520 | prompt(0, NULL); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
521 | ncrc = ocrc = crc32(0L, Z_NULL, 0); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
522 | 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
|
523 | |
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
|
524 | 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
|
525 | |
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
|
526 | prompt(0, 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
|
527 | prompt(131, 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
|
528 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
529 | 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
|
530 | prompt(402, NULL); |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
531 | 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
|
532 | 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
|
533 | 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
|
534 | 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
|
535 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
536 | 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
|
537 | 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
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | 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
|
544 | 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
|
545 | 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
|
546 | 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
|
547 | 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
|
548 | 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
|
549 | 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
|
550 | 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
|
551 | 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
|
552 | 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
|
553 | 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
|
554 | 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
|
555 | 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
|
556 | 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
|
557 | 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
|
558 | 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
|
559 | break; |
448 | 560 | 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
|
561 | 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
|
562 | break; |
448 | 563 | 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
|
564 | 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
|
565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | 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
|
571 | 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
|
572 | 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
|
573 | 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
|
574 | 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
|
575 | 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
|
576 | 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
|
577 | 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
|
578 | 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
|
579 | 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
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | 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
|
588 | 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
|
589 | 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
|
590 | 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
|
591 | 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
|
592 | 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
|
593 | 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
|
594 | 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
|
595 | 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
|
596 | 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
|
597 | 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
|
598 | 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
|
599 | 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
|
600 | 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
|
601 | 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
|
602 | } |
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
|
603 | |
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
|
604 | key = keywait(); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
605 | if ((key == KEY_RETURN) || my_shutdown) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
606 | 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
|
607 | if (ocrc != ncrc) |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
608 | wrconfig(); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
609 | if (debug) |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
610 | 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
|
611 | return; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
612 | } |
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
|
613 | |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
614 | if ((key == KEY_UP) && (idx > 1)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
615 | idx--; |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
616 | if ((key == KEY_DOWN) && (idx < 21)) |
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
617 | 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
|
618 | |
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
|
619 | if (key == KEY_ENTER) { |
458
43a8ecb53637
Fixes for compiling on Raspberry.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
620 | switch(idx) { |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
621 | case 1: // name |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
622 | break; |
449 | 623 | case 2: uuid = xstrcpy(unit->hlt_sensor.uuid); |
624 | editSensor(uuid, (char *)"HLT sensor"); | |
625 | strncpy(unit->hlt_sensor.uuid, uuid, 36); | |
626 | free(uuid); | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
627 | break; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
628 | case 3: uuid = xstrcpy(unit->hlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
629 | editRelay(uuid, (char *)"HLT heater"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
630 | strncpy(unit->hlt_heater.uuid, uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
631 | free(uuid); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
632 | break; |
449 | 633 | case 4: uuid = xstrcpy(unit->mlt_sensor.uuid); |
634 | editSensor(uuid, (char *)"MLT sensor"); | |
635 | strncpy(unit->mlt_sensor.uuid, uuid, 36); | |
636 | free(uuid); | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
637 | break; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
638 | case 5: uuid = xstrcpy(unit->mlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
639 | editRelay(uuid, (char *)"MLT heater"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
640 | strncpy(unit->mlt_heater.uuid, uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
641 | free(uuid); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
642 | break; |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
643 | case 6: uuid = xstrcpy(unit->mlt_pump.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
644 | editRelay(uuid, (char *)"MLT pump"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
645 | strncpy(unit->mlt_pump.uuid, uuid, 36); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
646 | free(uuid); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
647 | 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
|
648 | 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
|
649 | break; |
448 | 650 | 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
|
651 | break; |
448 | 652 | 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
|
653 | 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
|
654 | 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
|
655 | 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
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | 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
|
661 | 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
|
662 | 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
|
663 | 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
|
664 | 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
|
665 | 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
|
666 | 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
|
667 | 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
|
668 | 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
|
669 | break; |
448 | 670 | case 18: editInteger(&unit->iodine_time, 10, 240, 10, (char *)"Iodine time", (char *)"min"); |
671 | 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
|
672 | 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
|
673 | break; |
448 | 674 | case 20: editPID(unit->PID_hlt); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
675 | break; |
448 | 676 | case 21: editPID(unit->PID_mlt); |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
677 | 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
|
678 | } |
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
|
679 | } |
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
|
680 | } |
442 | 681 | } |
682 | ||
683 | ||
684 | ||
685 | void addUnit(int number) | |
686 | { | |
687 | units_list *tmpu, *unit = (units_list *)malloc(sizeof(units_list)); | |
688 | char name[81]; | |
689 | uuid_t uu; | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
690 | double Input, Output, Setpoint; |
442 | 691 | |
692 | if (debug) | |
693 | fprintf(stdout, "Adding new brewsystem %d\n", number); | |
694 | unit->next = NULL; | |
695 | unit->version = 1; | |
696 | unit->uuid = malloc(37); | |
697 | uuid_generate(uu); | |
698 | uuid_unparse(uu, unit->uuid); | |
699 | snprintf(name, 20, "System %d", number); | |
700 | unit->name = xstrcpy(name); | |
701 | unit->number = number; | |
702 | if (number == 1) | |
703 | unit->active = 1; | |
704 | else | |
705 | unit->active = 0; | |
449 | 706 | unit->hlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
707 | unit->hlt_sensor.state = DEVPRESENT_UNDEF; | |
708 | unit->hlt_sensor.value = 0; | |
709 | unit->mlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); | |
710 | unit->mlt_sensor.state = DEVPRESENT_UNDEF; | |
711 | unit->mlt_sensor.value = 0; | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
712 | 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
|
713 | unit->hlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
714 | unit->hlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
715 | 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
|
716 | unit->mlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
717 | unit->mlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
718 | 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
|
719 | unit->mlt_pump.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
720 | unit->mlt_pump.delay = 0; |
442 | 721 | unit->hlt_heater_mltfirst = 1; |
722 | unit->pump_cycle = 7; | |
723 | unit->pump_rest = 2; | |
724 | unit->pump_premash = 1; | |
725 | unit->pump_onmash = 1; | |
726 | unit->pump_mashout = 0; | |
727 | unit->pump_onboil = 0; | |
728 | unit->pump_stop = 90; | |
729 | unit->skip_add = 0; | |
730 | unit->skip_remove = 0; | |
731 | unit->skip_iodine = 0; | |
732 | unit->iodine_time = 90; | |
733 | unit->whirlpool = 1; | |
734 | unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); | |
735 | 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
|
736 | Input = Setpoint = 20.0; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
737 | Output = 0; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
738 | 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
|
739 | PID_init(unit->PID_mlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT); |
442 | 740 | |
741 | editUnit(unit); | |
742 | ||
743 | if (Config.units == NULL) { | |
744 | Config.units = unit; | |
745 | } else { | |
746 | for (tmpu = Config.units; tmpu; tmpu = tmpu->next) { | |
747 | if (tmpu->next == NULL) { | |
748 | tmpu->next = unit; | |
749 | break; | |
750 | } | |
751 | } | |
752 | } | |
753 | syslog(LOG_NOTICE, "Brewsystem %d added to the configuration", number); | |
754 | if (debug) | |
755 | fprintf(stdout, "Brewsystem %d added to the configuration\n", number); | |
756 | } | |
757 | ||
758 | ||
759 | ||
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
|
760 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
761 | * 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
|
762 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
763 | 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
|
764 | { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
765 | int idx = 1, key; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
766 | 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
|
767 | 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
|
768 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
769 | 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
|
770 | 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
|
771 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
772 | 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
|
773 | 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
|
774 | 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
|
775 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
776 | 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
|
777 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
778 | 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
|
779 | prompt(139, 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
|
780 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
781 | if (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
|
782 | prompt(402, 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
|
783 | else if (idx == 21) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
784 | prompt(404, 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
|
785 | 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
|
786 | prompt(403, 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
|
787 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
788 | 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
|
789 | 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
|
790 | 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
|
791 | 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
|
792 | 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
|
793 | 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
|
794 | 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
|
795 | 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
|
796 | 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
|
797 | 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
|
798 | 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
|
799 | 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
|
800 | 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
|
801 | 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
|
802 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
803 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
804 | 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
|
805 | 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
|
806 | ncrc = crc32(ncrc, (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
|
807 | if (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
|
808 | wrrecipes(); |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
809 | 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
|
810 | 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
|
811 | 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
|
812 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
813 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
814 | 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
|
815 | 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
|
816 | if ((key == KEY_DOWN) && (idx < 6)) |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
817 | 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
|
818 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
819 | 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
|
820 | switch(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
|
821 | case 1: // 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
|
822 | 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
|
823 | case 2: // 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
|
824 | 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
|
825 | 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
|
826 | 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
|
827 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
828 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
829 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
830 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
831 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
832 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
833 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
834 | 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
|
835 | { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
836 | 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
|
837 | 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
|
838 | 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
|
839 | int 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
|
840 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
841 | 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
|
842 | 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
|
843 | 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
|
844 | 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
|
845 | 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
|
846 | 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
|
847 | 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
|
848 | 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
|
849 | 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
|
850 | 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
|
851 | recipe->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
|
852 | 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
|
853 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
854 | * 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
|
855 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
856 | 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
|
857 | 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
|
858 | 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
|
859 | 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
|
860 | 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
|
861 | 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
|
862 | 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
|
863 | 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
|
864 | 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
|
865 | 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
|
866 | 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
|
867 | 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
|
868 | 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
|
869 | 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
|
870 | 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
|
871 | 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
|
872 | 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
|
873 | 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
|
874 | 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
|
875 | 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
|
876 | 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
|
877 | 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
|
878 | 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
|
879 | 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
|
880 | 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
|
881 | 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
|
882 | 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
|
883 | 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
|
884 | 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
|
885 | 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
|
886 | 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
|
887 | 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
|
888 | 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
|
889 | 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
|
890 | 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
|
891 | 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
|
892 | 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
|
893 | 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
|
894 | 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
|
895 | 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
|
896 | 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
|
897 | 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
|
898 | 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
|
899 | 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
|
900 | 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
|
901 | 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
|
902 | 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
|
903 | 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
|
904 | 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
|
905 | 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
|
906 | 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
|
907 | 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
|
908 | 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
|
909 | 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
|
910 | 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
|
911 | 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
|
912 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
913 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
914 | * 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
|
915 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
916 | recipe->hops[0].name = xstrcpy((char *)"Hops 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
|
917 | 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
|
918 | recipe->hops[1].name = xstrcpy((char *)"Hops 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
|
919 | recipe->hops[1].boiltime = 5; |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
920 | for (i = 2; i < 10; 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
|
921 | recipe->hops[i].name = 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
|
922 | recipe->hops[i].boiltime = 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
|
923 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
924 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
925 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
926 | /* |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
927 | * 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
|
928 | */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
929 | 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
|
930 | 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
|
931 | 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
|
932 | 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
|
933 | 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
|
934 | 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
|
935 | 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
|
936 | 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
|
937 | 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
|
938 | 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
|
939 | 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
|
940 | 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
|
941 | 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
|
942 | 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
|
943 | 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
|
944 | 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
|
945 | 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
|
946 | 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
|
947 | 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
|
948 | 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
|
949 | 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
|
950 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
951 | 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
|
952 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
953 | 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
|
954 | 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
|
955 | } 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
|
956 | 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
|
957 | 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
|
958 | 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
|
959 | 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
|
960 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
961 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
962 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
963 | 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
|
964 | 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
|
965 | 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
|
966 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
967 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
968 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
969 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
970 | 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
|
971 | { |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
972 | 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
|
973 | 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
|
974 | 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
|
975 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
976 | 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
|
977 | 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
|
978 | 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
|
979 | 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
|
980 | 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
|
981 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
982 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
983 | 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
|
984 | 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
|
985 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
986 | 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
|
987 | 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
|
988 | 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
|
989 | 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
|
990 | 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
|
991 | 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
|
992 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
993 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
994 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
995 | 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
|
996 | 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
|
997 | 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
|
998 | 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
|
999 | 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
|
1000 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1001 | 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
|
1002 | 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
|
1003 | 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
|
1004 | 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
|
1005 | 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
|
1006 | 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
|
1007 | 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
|
1008 | 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
|
1009 | 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
|
1010 | 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
|
1011 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1012 | 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
|
1013 | 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
|
1014 | 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
|
1015 | 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
|
1016 | 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
|
1017 | 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
|
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 | 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
|
1020 | 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
|
1021 | 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
|
1022 | 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
|
1023 | 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
|
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 ((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
|
1026 | 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
|
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 | } |
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 | |
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 | |
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 | 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
|
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 | 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
|
1035 | 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
|
1036 | 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
|
1037 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1038 | 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
|
1039 | 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
|
1040 | 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
|
1041 | 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
|
1042 | 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
|
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 | |
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 | 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
|
1046 | 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
|
1047 | |
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 | 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
|
1049 | /* |
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 | * 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
|
1051 | */ |
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 | 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
|
1053 | 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
|
1054 | } 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
|
1055 | 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
|
1056 | 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
|
1057 | 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
|
1058 | 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
|
1059 | 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
|
1060 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1061 | 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
|
1062 | prompt(222, NULL); /* " Select Brewsystem " */ |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1063 | snprintf(pmpt, Config.lcd_cols + 1, "%s", unit->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
|
1064 | 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
|
1065 | 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
|
1066 | 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
|
1067 | 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
|
1068 | 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
|
1069 | 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
|
1070 | 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
|
1071 | 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
|
1072 | 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
|
1073 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1074 | 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
|
1075 | 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
|
1076 | 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
|
1077 | 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
|
1078 | 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
|
1079 | 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
|
1080 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1081 | 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
|
1082 | 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
|
1083 | 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
|
1084 | 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
|
1085 | 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
|
1086 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1087 | 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
|
1088 | 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
|
1089 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1090 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1091 | } |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1092 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1093 | |
1f88be70f253
Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1094 | |
442 | 1095 | void setup(void) |
1096 | { | |
1097 | int key, option = 202; | |
1098 | ||
1099 | for (;;) { | |
1100 | if (debug) | |
1101 | 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
|
1102 | 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
|
1103 | 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
|
1104 | prompt(option, NULL); |
442 | 1105 | 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
|
1106 | prompt(402, NULL); /* "--- dwn quit ok " */ |
442 | 1107 | #ifdef USE_SIMULATOR |
1108 | else if (option == 205) | |
1109 | #else | |
1110 | else if (option == 204) | |
1111 | #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
|
1112 | prompt(404, NULL); /* " up --- quit ok " */ |
442 | 1113 | 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
|
1114 | prompt(403, NULL); /* " up dwn quit ok " */ |
442 | 1115 | |
1116 | key = keywait(); | |
1117 | ||
1118 | if ((key == KEY_RETURN) || my_shutdown) | |
1119 | return; | |
1120 | if ((key == KEY_UP) && (option > 202)) { | |
1121 | option--; | |
1122 | } | |
1123 | #ifdef USE_SIMULATOR | |
1124 | if ((key == KEY_DOWN) && (option < 205)) { | |
1125 | #else | |
1126 | if ((key == KEY_DOWN) && (option < 204)) { | |
1127 | #endif | |
1128 | option++; | |
1129 | } | |
1130 | ||
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
|
1131 | 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
|
1132 | 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
|
1133 | 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
|
1134 | 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
|
1135 | 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
|
1136 | 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
|
1137 | 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
|
1138 | 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
|
1139 | #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
|
1140 | 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
|
1141 | 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
|
1142 | #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
|
1143 | } |
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
|
1144 | 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
|
1145 | 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
|
1146 | } |
442 | 1147 | } |
1148 | } | |
1149 | ||
1150 |