brewco/setup.c

Wed, 02 Dec 2015 17:16:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 02 Dec 2015 17:16:41 +0100
changeset 443
6b80a37fdf8d
parent 442
1193bd7d460f
child 445
3ec477cda546
permissions
-rw-r--r--

Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.

442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Copyright (C) 2015
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of the mbsePi-apps
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * mbsePi-apps is distributed in the hope that it will be useful, but
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include "brewco.h"
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "slcd.h"
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 #include "setup.h"
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include "prompt.h"
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 #include "xutil.h"
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 #include "keyboard.h"
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 extern int my_shutdown;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 extern int debug;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 extern sys_config Config;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 extern int lcdHandle;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 extern int slcdHandle;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
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
39 int toggleYesNo(int value, char *text)
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
40 {
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
41 int key, new = value;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
42 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
43
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
44 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
45 prompt(132, 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
46
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
47 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
48
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
49 snprintf(pmpt, Config.lcd_cols + 1, "%s: %s", text, new ? (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
50 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
51 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
52 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
53 } 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
54 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
55 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
56
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
57 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
58 if ((key == KEY_RETURN) || 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
59 return value;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
60 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
61 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
62 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
63 new = 1;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
64 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
65 return 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
66 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
67 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
68
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
69
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
70
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 void editUnit(units_list *unit)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 {
443
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
73 int index = 1, key;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
74 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
75
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 if (debug)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 fprintf(stdout, "Start edit brewsystem %d %s\n", unit->number, unit->uuid);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78
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
79 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
80
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
81 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
82
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
83 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
84 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
85
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
86 if (index == 1)
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
87 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
88 else if (index == 21)
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
89 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
90 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
91 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
92
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
93 switch (index) { // 12345678901234567890
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
94 case 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115 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
116 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
117 case 8: snprintf(pmpt, Config.lcd_cols + 1, "Pump cycle: %2d mins", unit->pump_cycle);
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
118 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
119 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
120 case 9: snprintf(pmpt, Config.lcd_cols + 1, "Pump rest : %2d mins", unit->pump_rest);
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135 case 14: snprintf(pmpt, Config.lcd_cols + 1, " Pump stop: %3d\337C", unit->pump_stop);
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
136 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
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 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
155 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
156 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
157 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
158 break;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
159 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
160
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
161 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
162 if ((key == KEY_RETURN) || 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
163 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
164
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
165 if ((key == KEY_UP) && (index > 1))
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
166 index--;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 if ((key == KEY_DOWN) && (index < 21))
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 index++;
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
170 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
171 switch(index) {
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 case 7: unit->hlt_heater_mltfirst = toggleYesNo(unit->hlt_heater_mltfirst , (char *)"MLT heat b4 HLT");
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 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
174 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // 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
177 // hlt_sensor picklist
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // hlt_heater picklist + value range
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // mlt_sensor picklist
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // mlt_heater picklist + value range
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // mlt_pump picklist + value range
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // hlt_heater_mltfirst 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // pump_cycle 5..15
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
184 // pump_rest 1..5
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // pump_premash 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // pump_onmash 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // pump_mashout 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // pump_onboil 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
189 // pump_stop 80..110
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
190 // skip_add 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
191 // skip_remove 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
192 // skip_iodine 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // iodine_time 0..90
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // whirlpool 0/1
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // PID_hlt
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 // PID_mlt
6b80a37fdf8d Added programming display CGRAM. Added display of characters from 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 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
198
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 if (debug)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 fprintf(stdout, "End edit brewsystem %d %s\n", unit->number, unit->uuid);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 void addUnit(int number)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 units_list *tmpu, *unit = (units_list *)malloc(sizeof(units_list));
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 char name[81];
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 uuid_t uu;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 if (debug)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 fprintf(stdout, "Adding new brewsystem %d\n", number);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 unit->next = NULL;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 unit->version = 1;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 unit->uuid = malloc(37);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 uuid_generate(uu);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 uuid_unparse(uu, unit->uuid);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 snprintf(name, 20, "System %d", number);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 unit->name = xstrcpy(name);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 unit->number = number;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 if (number == 1)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 unit->active = 1;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 else
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 unit->active = 0;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 unit->hlt_sensor = unit->mlt_sensor = NULL;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 unit->hlt_heater = unit->mlt_heater = unit->mlt_pump = NULL;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 unit->hlt_heater_mltfirst = 1;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 unit->pump_cycle = 7;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 unit->pump_rest = 2;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 unit->pump_premash = 1;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 unit->pump_onmash = 1;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 unit->pump_mashout = 0;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 unit->pump_onboil = 0;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 unit->pump_stop = 90;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 unit->skip_add = 0;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 unit->skip_remove = 0;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 unit->skip_iodine = 0;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 unit->iodine_time = 90;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 unit->whirlpool = 1;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var));
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var));
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 InitPID(unit->PID_hlt);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 InitPID(unit->PID_mlt);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 editUnit(unit);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 if (Config.units == NULL) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 Config.units = unit;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 } else {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 for (tmpu = Config.units; tmpu; tmpu = tmpu->next) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 if (tmpu->next == NULL) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 tmpu->next = unit;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 break;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 syslog(LOG_NOTICE, "Brewsystem %d added to the configuration", number);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 if (debug)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 fprintf(stdout, "Brewsystem %d added to the configuration\n", number);
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 void setup(void)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 int key, option = 202;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 for (;;) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 if (debug)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 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
271 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
272 prompt(102, 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
273 prompt(option, NULL);
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 if (option == 202)
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
275 prompt(402, NULL);
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 #ifdef USE_SIMULATOR
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 else if (option == 205)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 #else
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 else if (option == 204)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 #endif
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
281 prompt(404, NULL);
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 else
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
283 prompt(403, NULL);
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 key = keywait();
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 if ((key == KEY_RETURN) || my_shutdown)
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 return;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 if ((key == KEY_UP) && (option > 202)) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 option--;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 #ifdef USE_SIMULATOR
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 if ((key == KEY_DOWN) && (option < 205)) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 #else
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 if ((key == KEY_DOWN) && (option < 204)) {
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 #endif
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 option++;
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299
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
300 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
301 switch(option) {
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
302 case 202: // recipes
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
303 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
304 case 203: editUnit(Config.units); /* If more units, via a selector */
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
305 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
306 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
307 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
308 #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
309 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
310 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
311 #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
312 }
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
313 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
314 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
315 }
442
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 }
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318
1193bd7d460f Split some sources
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319

mercurial