Sun, 27 Dec 2015 17:52:26 +0100
Renamed Mash-in step to Prepare on the display. Don't run the pump when the mash is added. When preparing the mash, first heat the HLT, and then the MLT so that both have the chance to reach their target temperatures.
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2015 |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * mbsePi-apps is distributed in the hope that it will be useful, but |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include "brewco.h" |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
24 | #include "util.h" |
471
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
25 | #include "slcd.h" |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
26 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
27 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
28 | extern int slcdHandle; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | * Make directory tree, the name must end with a / |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | int mkdirs(char *name, mode_t mode) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | char buf[PATH_MAX], *p, *q; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | int last = 0, oldmask; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | memset(&buf, 0, sizeof(buf)); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | strncpy(buf, name, sizeof(buf)-1); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | buf[sizeof(buf)-1] = '\0'; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | p = buf+1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | oldmask = umask(000); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | while ((q = strchr(p, '/'))) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | *q = '\0'; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | mkdir(buf, mode); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | last = errno; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | *q = '/'; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | p = q+1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | umask(oldmask); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | if ((last == 0) || (last == EEXIST)) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | return TRUE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | } else { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | syslog(LOG_NOTICE, "mkdirs(%s)", name); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | return FALSE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | |
441 | 65 | |
66 | /* | |
67 | * Test if the given file exists. The second option is: | |
68 | * R_OK - test for Read rights | |
69 | * W_OK - test for Write rights | |
70 | * X_OK - test for eXecute rights | |
71 | * F_OK - test file presence only | |
72 | */ | |
73 | int file_exist(char *path, int mode) | |
74 | { | |
75 | if (access(path, mode) != 0) | |
76 | return errno; | |
77 | ||
78 | return 0; | |
79 | } | |
80 | ||
81 | ||
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
82 | |
464
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
83 | /* |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
84 | * Buffered filecopy, filetime is preserved. |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
85 | */ |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
86 | int file_cp(char *from, char *to) |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
87 | { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
88 | char *line; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
89 | FILE *stfrom, *stto; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
90 | int dummy, bread; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
91 | static int error; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
92 | struct stat sb; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
93 | struct utimbuf ut; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
94 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
95 | stfrom = fopen(from, "r"); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
96 | if (stfrom == NULL) |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
97 | return errno; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
98 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
99 | stto = fopen(to, "w"); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
100 | if (stto == NULL) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
101 | error = errno; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
102 | fclose(stfrom); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
103 | return error; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
104 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
105 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
106 | line = malloc(16384); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
107 | do { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
108 | bread = fread(line, 1, 16384, stfrom); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
109 | dummy = fwrite(line, 1, bread, stto); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
110 | if (bread != dummy) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
111 | error = errno; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
112 | fclose(stfrom); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
113 | fclose(stto); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
114 | unlink(to); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
115 | free(line); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
116 | return error; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
117 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
118 | } while (bread != 0); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
119 | free(line); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
120 | fclose(stfrom); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
121 | if (fclose(stto) != 0) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
122 | error = errno; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
123 | unlink(to); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
124 | return error; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
125 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
126 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
127 | /* |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
128 | * copy successfull, now copy file- and modification-time |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
129 | */ |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
130 | if (stat(from, &sb) == 0) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
131 | ut.actime = mktime(localtime(&sb.st_atime)); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
132 | ut.modtime = mktime(localtime(&sb.st_mtime)); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
133 | if (utime(to, &ut) != 0) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
134 | error = errno; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
135 | unlink(to); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
136 | return error; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
137 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
138 | chmod(to, sb.st_mode); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
139 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
140 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
141 | return 0; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
142 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
143 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
144 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
145 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
146 | long millis(void) |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
147 | { |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
148 | struct timespec now; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
149 | |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
150 | clock_gettime(CLOCK_REALTIME , &now); |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
151 | return ((now.tv_sec * 1000000000) + now.tv_nsec) / 1000000; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
152 | } |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
153 | |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
154 | |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
155 | |
471
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
156 | void hlt_status(int value) |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
157 | { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
158 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
159 | piLock(LOCK_LCD); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
160 | lcdPosition(lcdHandle, 0, 1); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
161 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
162 | slcdPosition(slcdHandle, 0, 1); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
163 | if (value) { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
164 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
165 | lcdPutchar(lcdHandle, 5); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
166 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
167 | slcdPutchar(slcdHandle, 5); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
168 | } else { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
169 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
170 | lcdPutchar(lcdHandle, 6); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
171 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
172 | slcdPutchar(slcdHandle, 6); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
173 | } |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
174 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
175 | piUnlock(LOCK_LCD); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
176 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
177 | } |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
178 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
179 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
180 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
181 | void mlt_status(int value) |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
182 | { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
183 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
184 | piLock(LOCK_LCD); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
185 | lcdPosition(lcdHandle, 18, 1); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
186 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
187 | slcdPosition(slcdHandle, 18, 1); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
188 | if (value) { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
189 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
190 | lcdPutchar(lcdHandle, 5); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
191 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
192 | slcdPutchar(slcdHandle, 5); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
193 | } else { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
194 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
195 | lcdPutchar(lcdHandle, 6); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
196 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
197 | slcdPutchar(slcdHandle, 6); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
198 | } |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
199 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
200 | piUnlock(LOCK_LCD); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
201 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
202 | } |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
203 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
204 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
205 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
206 | void pump_status(int value) |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
207 | { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
208 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
209 | piLock(LOCK_LCD); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
210 | lcdPosition(lcdHandle, 19, 1); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
211 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
212 | slcdPosition(slcdHandle, 19, 1); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
213 | if (value) { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
214 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
215 | lcdPutchar(lcdHandle, 3); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
216 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
217 | slcdPutchar(slcdHandle, 3); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
218 | } else { |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
219 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
220 | lcdPutchar(lcdHandle, 4); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
221 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
222 | slcdPutchar(slcdHandle, 4); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
223 | } |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
224 | #ifdef HAVE_WIRINGPI_H |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
225 | piUnlock(LOCK_LCD); |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
226 | #endif |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
227 | } |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
228 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
229 | |
1564b60558b1
Manual mode now uses the PID's. The display shows heating percentage and the setpoints alternated very 2 seconds.
Michiel Broek <mbroek@mbse.eu>
parents:
464
diff
changeset
|
230 | |
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:
441
diff
changeset
|
231 | /* From ArdBir */ |
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:
441
diff
changeset
|
232 | float Arrotonda025(float Num){ |
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:
441
diff
changeset
|
233 | // Appoggio la parte intera |
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:
441
diff
changeset
|
234 | int Appoggio= (int)Num; |
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:
441
diff
changeset
|
235 | |
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:
441
diff
changeset
|
236 | // Arrotondo il valore con peso 0.25 |
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:
441
diff
changeset
|
237 | return Appoggio+(int)((Num-Appoggio)*1000/225)*0.25; |
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:
441
diff
changeset
|
238 | } |
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:
441
diff
changeset
|
239 | |
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:
441
diff
changeset
|
240 | float ConvertiCtoF(float Num){ |
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:
441
diff
changeset
|
241 | Num = Num/16; // Recupero il valore |
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:
441
diff
changeset
|
242 | Num = (Num*1.8)+32; // Converto in °F |
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:
441
diff
changeset
|
243 | Num = Arrotonda025(Num); |
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:
441
diff
changeset
|
244 | return Num*16; // Preparo il valore per la registrazione |
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:
441
diff
changeset
|
245 | } |
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:
441
diff
changeset
|
246 | float ConvertiFtoC(float Num){ |
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:
441
diff
changeset
|
247 | Num = Num/16; // Recupero il valore |
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:
441
diff
changeset
|
248 | Num = (Num-32)/1.8; // Converto in °C |
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:
441
diff
changeset
|
249 | Num = Arrotonda025(Num); |
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:
441
diff
changeset
|
250 | return Num*16; // Preparo il valore per la registrazione |
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:
441
diff
changeset
|
251 | } |
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:
441
diff
changeset
|
252 |