Thu, 14 Mar 2024 19:37:53 +0100
Create installation directories
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
614
389097dc665d
Version 0.9.11. Removed lcd debug message after 7 years. Added setup for alternative beer sensor. If the main sensor is gone, the alternative will be used.
Michiel Broek <mbroek@mbse.eu>
parents:
611
diff
changeset
|
2 | * Copyright (C) 2014-2022 |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * mbsePi-apps is distributed in the hope that it will be useful, but |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
213
2317b8d644fa
Code cleanup, streamlined error messages.
Michiel Broek <mbroek@mbse.eu>
parents:
209
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
106 | 23 | #include "lock.h" |
24 | #include "rdconfig.h" | |
160 | 25 | #include "devices.h" |
106 | 26 | #include "server.h" |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
27 | #include "thermferm.h" |
259
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
28 | #include "simulator.h" |
106 | 29 | #include "lcd-pcf8574.h" |
30 | #include "lcd-buffer.h" | |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
31 | #include "slcd.h" |
198
20716bcff2b0
Added dependencies for panel
Michiel Broek <mbroek@mbse.eu>
parents:
195
diff
changeset
|
32 | #include "panel.h" |
106 | 33 | #include "futil.h" |
34 | #include "xutil.h" | |
316
73cd31dc6ce1
Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
315
diff
changeset
|
35 | #include "pid.h" |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
36 | #include "mqtt.h" |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
75
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
39 | int my_shutdown = FALSE; |
550
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
40 | int my_reboot = FALSE; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | static pid_t pgrp, mypid; |
245
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
42 | int run_pause = FALSE; |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
43 | int run_hold = FALSE; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | |
75
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
45 | extern int debug; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | extern sys_config Config; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | extern int lcdHandle; |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
48 | extern int slcdHandle; |
205 | 49 | int setupmenu = MENU_NONE; |
238 | 50 | units_list *current_unit = NULL; /* In panel editor this points to the current unit. */ |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
51 | float temp_temp = 20.0; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
52 | |
74 | 53 | #ifndef HAVE_WIRINGPI_H |
259
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
54 | pthread_t threads[5]; |
74 | 55 | #endif |
104 | 56 | extern const char UNITMODE[5][8]; |
195
b34a1b2421fb
Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
57 | extern const char PROFSTATE[4][6]; |
104 | 58 | |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
59 | extern int sock; |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
60 | |
40
dafbbd5e9922
Prepared unix socket communication
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
61 | |
484
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
62 | unsigned char degC[8] = { 0b01000, 0b10100, 0b01000, 0b00111, 0b01000, 0b01000, 0b01000, 0b00111 }; // [1] degree c sybmol |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
63 | unsigned char SP_Symbol[8] = { 0b11100, 0b10000, 0b11100, 0b00111, 0b11101, 0b00111, 0b00100, 0b00100 }; // [2] SP Symbol |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
64 | unsigned char CoolONOFF[8] = { 0b00000, 0b01110, 0b01000, 0b01000, 0b01000, 0b01000, 0b01110, 0b00000 }; // [3] Cool Symbol |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
65 | unsigned char RevCoolONOFF[8] = { 0b11111, 0b10001, 0b10111, 0b10111, 0b10111, 0b10111, 0b10001, 0b11111 }; // [4] Reverse Cool Symbol |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
66 | unsigned char HeatONOFF[8] = { 0b00000, 0b01010, 0b01010, 0b01110, 0b01110, 0b01010, 0b01010, 0b00000 }; // [5] HEAT symbol |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
67 | unsigned char RevHeatONOFF[8] = { 0b11111, 0b10101, 0b10101, 0b10001, 0b10001, 0b10101, 0b10101, 0b11111 }; // [6] reverse HEAT symbol |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
68 | |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
69 | |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
70 | int server(void); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | void help(void); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | void die(int); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
73 | void stopLCD(void); |
66
805f1d285acd
Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents:
64
diff
changeset
|
74 | #ifdef HAVE_WIRINGPI_H |
46
000399c64d3f
More client/server communications
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
75 | void sendRCswitch(char *, int); |
000399c64d3f
More client/server communications
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
76 | void stopRCswitch(void); |
66
805f1d285acd
Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents:
64
diff
changeset
|
77 | #endif |
46
000399c64d3f
More client/server communications
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
78 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
80 | |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
81 | extern int mqtt_qos; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
82 | extern int mqtt_last_mid; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
83 | extern int mqtt_last_mid_sent; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
84 | extern int mqtt_mid_sent; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
85 | extern int mqtt_disconnect_sent; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
86 | extern int mqtt_connected; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
87 | extern int mqtt_status; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
88 | extern int mqtt_use; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
89 | extern struct mosquitto *mosq; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
90 | extern char *state; |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
91 | |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
92 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | void help(void) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | { |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
96 | fprintf(stdout, "mbsePi-apps thermferm v%s starting\n\n", VERSION); |
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
97 | fprintf(stdout, "Usage: thermferm [-d] [-h]\n"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | fprintf(stdout, " -d --debug Debug and run in foreground\n"); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | fprintf(stdout, " -h --help Display this help\n"); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | void die(int onsig) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | switch (onsig) { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | case SIGHUP: syslog(LOG_NOTICE, "Got SIGHUP, shutting down"); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | break; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | case SIGINT: syslog(LOG_NOTICE, "Keyboard interrupt, shutting down"); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | break; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | case SIGTERM: syslog(LOG_NOTICE, "Got SIGTERM, shutting down"); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | break; |
326 | 113 | case SIGSEGV: syslog(LOG_NOTICE, "Got SIGSEGV, shutting down"); |
114 | my_shutdown = TRUE; | |
115 | exit(SIGSEGV); | |
116 | break; | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | default: syslog(LOG_NOTICE, "die() on signal %d", onsig); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | |
75
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
120 | my_shutdown = TRUE; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | |
238 | 124 | |
125 | void show_mode(void) | |
126 | { | |
127 | char buf[21]; | |
128 | ||
328 | 129 | snprintf(buf, 20, "Old mode %s", UNITMODE[current_unit->mode]); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
130 | #ifdef HAVE_WIRINGPI_H |
238 | 131 | lcdPuts(lcdHandle, buf); |
132 | lcdPosition(lcdHandle, 0, 1); | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
133 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
134 | slcdPuts(slcdHandle, buf); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
135 | slcdPosition(slcdHandle, 0, 1); |
238 | 136 | } |
137 | ||
138 | ||
139 | ||
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
140 | void go_menu(int menu) |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
141 | { |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
142 | char buf[21]; |
238 | 143 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
144 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
145 | piLock(LOCK_LCD); |
244
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
146 | piLock(LOCK_MENU); |
223
14700edd2a67
Removed LCD shadow copy buffer.
Michiel Broek <mbroek@mbse.eu>
parents:
221
diff
changeset
|
147 | lcdClear(lcdHandle); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
148 | lcdPosition(lcdHandle, 0, 0); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
149 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
150 | slcdClear(slcdHandle); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
151 | slcdPosition(slcdHandle, 0, 0); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
152 | setupmenu = menu; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
153 | |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
154 | switch (menu) { |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
155 | case MENU_NONE: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
156 | lcd_buf_show(); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
157 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
158 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
159 | case MENU_TOP_DEFAULT: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
160 | #ifdef HAVE_WIRINGPI_H |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
161 | lcdPuts(lcdHandle, "Setup mode."); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
162 | lcdPosition(lcdHandle, 0, 1); |
223
14700edd2a67
Removed LCD shadow copy buffer.
Michiel Broek <mbroek@mbse.eu>
parents:
221
diff
changeset
|
163 | lcdPuts(lcdHandle, "Up&Down = Escape"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
164 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
165 | slcdPuts(slcdHandle, "Setup mode."); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
166 | slcdPosition(slcdHandle, 0, 1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
167 | slcdPuts(slcdHandle, "Up&Down = Escape"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
168 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
169 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
170 | case MENU_TOP_UNITS: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
171 | #ifdef HAVE_WIRINGPI_H |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
172 | lcdPuts(lcdHandle, "Select units"); |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
173 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
174 | slcdPuts(slcdHandle, "Select units"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
175 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
176 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
177 | case MENU_UNITS: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
178 | #ifdef HAVE_WIRINGPI_H |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
179 | lcdPuts(lcdHandle, "Choose unit:"); |
244
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
180 | lcdPosition(lcdHandle, 0, 1); |
556
c2ee7f9a069e
Fixed compile for LCD display
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
181 | lcdPuts(lcdHandle, current_unit->alias); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
182 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
183 | slcdPuts(slcdHandle, "Choose unit:"); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
184 | slcdPosition(slcdHandle, 0, 1); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
185 | slcdPuts(slcdHandle, current_unit->alias); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
186 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
187 | |
238 | 188 | case MENU_MODE_OFF: show_mode(); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
189 | #ifdef HAVE_WIRINGPI_H |
238 | 190 | lcdPuts(lcdHandle, "New mode OFF"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
191 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
192 | slcdPuts(slcdHandle, "New mode OFF"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
193 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
194 | |
238 | 195 | case MENU_MODE_NONE: show_mode(); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
196 | #ifdef HAVE_WIRINGPI_H |
238 | 197 | lcdPuts(lcdHandle, "New mode NONE"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
198 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
199 | slcdPuts(slcdHandle, "New mode NONE"); |
238 | 200 | break; |
201 | ||
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
202 | case MENU_NONE_HEAT: snprintf(buf, Config.lcd_cols, "Set heater %s", current_unit->heater_state ? "OFF":"ON"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
203 | #ifdef HAVE_WIRINGPI_H |
238 | 204 | lcdPuts(lcdHandle, buf); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
205 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
206 | slcdPuts(slcdHandle, buf); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
207 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
208 | |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
209 | case MENU_NONE_COOL: snprintf(buf, Config.lcd_cols, "Set cooler %s", current_unit->cooler_state ? "OFF":"ON"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
210 | #ifdef HAVE_WIRINGPI_H |
238 | 211 | lcdPuts(lcdHandle, buf); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
212 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
213 | slcdPuts(slcdHandle, buf); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
214 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
215 | |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
216 | case MENU_NONE_FAN: snprintf(buf, Config.lcd_cols, "Set fan %s", current_unit->fan_state ? "OFF":"ON"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
217 | #ifdef HAVE_WIRINGPI_H |
238 | 218 | lcdPuts(lcdHandle, buf); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
219 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
220 | slcdPuts(slcdHandle, buf); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
221 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
222 | |
238 | 223 | case MENU_MODE_BEER: show_mode(); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
224 | #ifdef HAVE_WIRINGPI_H |
238 | 225 | lcdPuts(lcdHandle, "New mode BEER"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
226 | #endif |
488
bee1f70fb42b
Small brewpanel display error fix, did not affect real hardware.
Michiel Broek <mbroek@mbse.eu>
parents:
486
diff
changeset
|
227 | slcdPuts(slcdHandle, "New mode BEER"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
228 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
229 | |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
230 | case MENU_BEER_TEMP_LO: |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
231 | #ifdef HAVE_WIRINGPI_H |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
232 | lcdPuts(lcdHandle, "Set beer low"); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
233 | lcdPosition(lcdHandle, 0, 1); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
234 | #endif |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
235 | slcdPuts(slcdHandle, "Set beer low"); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
236 | slcdPosition(slcdHandle, 0, 1); |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
237 | snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
238 | #ifdef HAVE_WIRINGPI_H |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
239 | lcdPuts(lcdHandle, buf); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
240 | #endif |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
241 | slcdPuts(slcdHandle, buf); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
242 | break; |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
243 | |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
244 | case MENU_BEER_TEMP_HI: |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
245 | #ifdef HAVE_WIRINGPI_H |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
246 | lcdPuts(lcdHandle, "Set beer high"); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
247 | lcdPosition(lcdHandle, 0, 1); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
248 | #endif |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
249 | slcdPuts(slcdHandle, "Set beer high"); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
250 | slcdPosition(slcdHandle, 0, 1); |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
251 | snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
252 | #ifdef HAVE_WIRINGPI_H |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
253 | lcdPuts(lcdHandle, buf); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
254 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
255 | slcdPuts(slcdHandle, buf); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
256 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
257 | |
238 | 258 | case MENU_MODE_FRIDGE: show_mode(); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
259 | #ifdef HAVE_WIRINGPI_H |
238 | 260 | lcdPuts(lcdHandle, "New mode FRIDGE"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
261 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
262 | slcdPuts(slcdHandle, "New mode FRIDGE"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
263 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
264 | |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
265 | case MENU_FRIDGE_TEMP_LO: |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
266 | #ifdef HAVE_WIRINGPI_H |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
267 | lcdPuts(lcdHandle, "Set fridge low"); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
268 | lcdPosition(lcdHandle, 0, 1); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
269 | #endif |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
270 | slcdPuts(slcdHandle, "Set fridge low"); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
271 | slcdPosition(slcdHandle, 0, 1); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
272 | snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
273 | #ifdef HAVE_WIRINGPI_H |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
274 | lcdPuts(lcdHandle, buf); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
275 | #endif |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
276 | slcdPuts(slcdHandle, buf); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
277 | break; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
278 | |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
279 | case MENU_FRIDGE_TEMP_HI: |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
280 | #ifdef HAVE_WIRINGPI_H |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
281 | lcdPuts(lcdHandle, "Set fridge high"); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
282 | lcdPosition(lcdHandle, 0, 1); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
283 | #endif |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
284 | slcdPuts(slcdHandle, "Set fridge high"); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
285 | slcdPosition(slcdHandle, 0, 1); |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
286 | snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
287 | #ifdef HAVE_WIRINGPI_H |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
288 | lcdPuts(lcdHandle, buf); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
289 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
290 | slcdPuts(slcdHandle, buf); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
291 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
292 | |
238 | 293 | case MENU_MODE_PROFILE: show_mode(); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
294 | #ifdef HAVE_WIRINGPI_H |
238 | 295 | lcdPuts(lcdHandle, "New mode PROFILE"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
296 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
297 | slcdPuts(slcdHandle, "New mode PROFILE"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
298 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
299 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
300 | case MENU_PROFILE_START: snprintf(buf, Config.lcd_cols, "%s", current_unit->profile_name); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
301 | #ifdef HAVE_WIRINGPI_H |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
302 | lcdPuts(lcdHandle, buf); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
303 | lcdPosition(lcdHandle, 0, 1); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
304 | lcdPuts(lcdHandle, "Start profile"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
305 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
306 | slcdPuts(slcdHandle, buf); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
307 | slcdPosition(slcdHandle, 0, 1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
308 | slcdPuts(slcdHandle, "Start profile"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
309 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
310 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
311 | case MENU_PROFILE_PAUSE: snprintf(buf, Config.lcd_cols, "%s", current_unit->profile_name); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
312 | #ifdef HAVE_WIRINGPI_H |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
313 | lcdPuts(lcdHandle, buf); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
314 | lcdPosition(lcdHandle, 0, 1); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
315 | lcdPuts(lcdHandle, "Pause profile"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
316 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
317 | slcdPuts(slcdHandle, buf); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
318 | slcdPosition(slcdHandle, 0, 1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
319 | slcdPuts(slcdHandle, "Pause profile"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
320 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
321 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
322 | case MENU_PROFILE_ABORT: snprintf(buf, Config.lcd_cols, "%s", current_unit->profile_name); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
323 | #ifdef HAVE_WIRINGPI_H |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
324 | lcdPuts(lcdHandle, buf); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
325 | lcdPosition(lcdHandle, 0, 1); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
326 | lcdPuts(lcdHandle, "Abort profile"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
327 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
328 | slcdPuts(slcdHandle, buf); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
329 | slcdPosition(slcdHandle, 0, 1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
330 | slcdPuts(slcdHandle, "Abort profile"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
331 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
332 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
333 | case MENU_PROFILE_RESUME: snprintf(buf, Config.lcd_cols, "%s", current_unit->profile_name); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
334 | #ifdef HAVE_WIRINGPI_H |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
335 | lcdPuts(lcdHandle, buf); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
336 | lcdPosition(lcdHandle, 0, 1); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
337 | lcdPuts(lcdHandle, "Resume profile"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
338 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
339 | slcdPuts(slcdHandle, buf); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
340 | slcdPosition(slcdHandle, 0, 1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
341 | slcdPuts(slcdHandle, "Resume profile"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
342 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
343 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
344 | case MENU_PROFILE_GOOFF: snprintf(buf, Config.lcd_cols, "%s", current_unit->profile_name); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
345 | #ifdef HAVE_WIRINGPI_H |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
346 | lcdPuts(lcdHandle, buf); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
347 | lcdPosition(lcdHandle, 0, 1); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
348 | lcdPuts(lcdHandle, "Set profile OFF"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
349 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
350 | slcdPuts(slcdHandle, buf); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
351 | slcdPosition(slcdHandle, 0, 1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
352 | slcdPuts(slcdHandle, "Set profile OFF"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
353 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
354 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
355 | case MENU_TOP_SYS: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
356 | #ifdef HAVE_WIRINGPI_H |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
357 | lcdPuts(lcdHandle, "System menu"); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
358 | #endif |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
359 | slcdPuts(slcdHandle, "System menu"); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
360 | break; |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
361 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
362 | case MENU_SYS_HALT: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
363 | #ifdef HAVE_WIRINGPI_H |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
364 | lcdPuts(lcdHandle, "Halt system"); |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
365 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
366 | slcdPuts(slcdHandle, "Halt system"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
367 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
368 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
369 | case MENU_SYS_REBOOT: |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
370 | #ifdef HAVE_WIRINGPI_H |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
371 | lcdPuts(lcdHandle, "Reboot system"); |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
372 | #endif |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
373 | slcdPuts(slcdHandle, "Reboot system"); |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
374 | break; |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
375 | } |
244
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
376 | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
377 | #ifdef HAVE_WIRINGPI_H |
244
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
378 | piUnlock(LOCK_MENU); |
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
379 | piUnlock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
380 | #endif |
214
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
381 | } |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
382 | |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
383 | |
37d1eb0e1d66
Added a bunch of panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
213
diff
changeset
|
384 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
385 | void stopLCD(void) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
386 | { |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
387 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
388 | piLock(LOCK_LCD); |
223
14700edd2a67
Removed LCD shadow copy buffer.
Michiel Broek <mbroek@mbse.eu>
parents:
221
diff
changeset
|
389 | lcdClear(lcdHandle); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
390 | #endif |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
391 | slcdClear(slcdHandle); |
426
e54611453d29
Moved global bit defines to config.h
Michiel Broek <mbroek@mbse.eu>
parents:
423
diff
changeset
|
392 | setBacklight(0); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
393 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
394 | piUnlock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
395 | #endif |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
396 | } |
238 | 397 | |
398 | ||
399 | ||
400 | /* | |
401 | * Change mode of current_unit | |
402 | */ | |
403 | void change_mode(int mode) | |
404 | { | |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
405 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
406 | if ((current_unit->mode == UNITMODE_OFF) && (mode != UNITMODE_OFF)) { |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
407 | current_unit->mqtt_flag |= MQTT_FLAG_BIRTH; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
408 | } |
238 | 409 | syslog(LOG_NOTICE, "Mode from %s to %s via panel interface", UNITMODE[current_unit->mode], UNITMODE[mode]); |
410 | current_unit->mode = mode; | |
411 | /* Allways turn everything off after a mode change */ | |
367
b9130db48c63
Fixed compiling on a real RPi
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
412 | current_unit->PID_cool->OutP = current_unit->PID_heat->OutP = 0.0; |
b9130db48c63
Fixed compiling on a real RPi
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
413 | current_unit->PID_cool->Mode = current_unit->PID_heat->Mode = PID_MODE_NONE; |
582
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
414 | current_unit->heater_state = current_unit->cooler_state = current_unit->fan_state = current_unit->light_state = current_unit->light_timer = 0; |
367
b9130db48c63
Fixed compiling on a real RPi
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
415 | current_unit->heater_wait = current_unit->cooler_wait = current_unit->fan_wait = current_unit->light_wait = 0; |
238 | 416 | device_out(current_unit->heater_address, current_unit->heater_state); |
417 | device_out(current_unit->cooler_address, current_unit->cooler_state); | |
418 | device_out(current_unit->fan_address, current_unit->fan_state); | |
367
b9130db48c63
Fixed compiling on a real RPi
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
419 | device_out(current_unit->light_address, current_unit->light_state); |
238 | 420 | if (current_unit->mode == UNITMODE_PROFILE) { |
421 | /* | |
422 | * Set a sane default until it will be overruled by the | |
423 | * main processing loop. | |
424 | */ | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
425 | current_unit->prof_target_lo = 20.0; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
426 | current_unit->prof_target_hi = 20.0; |
406
44566f986f76
Fixed compiling on a real RPi.
Michiel Broek <mbroek@mbse.eu>
parents:
405
diff
changeset
|
427 | current_unit->prof_fridge_mode = 0; |
238 | 428 | } |
429 | } | |
430 | ||
431 | ||
28
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
432 | |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
433 | /* |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
434 | * Handle panel key events |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
435 | */ |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
436 | void panel_key_events(int key) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
437 | { |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
438 | units_list *unit; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
439 | int rc; |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
440 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
441 | switch (setupmenu) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
442 | case MENU_NONE: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
443 | if ((key == KEY_DOWN) || (key == KEY_UP)) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
444 | lcd_buf_step(key); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
445 | if ((key == KEY_CONFIRM) && (setupmenu == MENU_NONE)) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
446 | go_menu(MENU_TOP_DEFAULT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
447 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
448 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
449 | case MENU_TOP_DEFAULT: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
450 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
451 | go_menu(MENU_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
452 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
453 | go_menu(MENU_TOP_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
454 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
455 | go_menu(MENU_TOP_SYS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
456 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
457 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
458 | case MENU_TOP_UNITS: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
459 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
460 | go_menu(MENU_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
461 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
462 | go_menu(MENU_TOP_SYS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
463 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
464 | go_menu(MENU_TOP_DEFAULT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
465 | if ((key == KEY_ENTER) && Config.units) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
466 | /* |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
467 | * Start with the first unit |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
468 | */ |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
469 | current_unit = Config.units; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
470 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
471 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
472 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
473 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
474 | case MENU_UNITS: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
475 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
476 | go_menu(MENU_TOP_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
477 | if (key == KEY_DOWN) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
478 | if (current_unit->next) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
479 | current_unit = current_unit->next; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
480 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
481 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
482 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
483 | if (key == KEY_UP) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
484 | for (unit = Config.units; unit; unit = unit->next) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
485 | if (unit->next && (unit->next == current_unit)) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
486 | current_unit = unit; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
487 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
488 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
489 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
490 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
491 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
492 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
493 | /* |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
494 | * Drop into the current mode |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
495 | */ |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
496 | switch (current_unit->mode) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
497 | case UNITMODE_OFF: go_menu(MENU_MODE_OFF); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
498 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
499 | case UNITMODE_NONE: go_menu(MENU_MODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
500 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
501 | case UNITMODE_FRIDGE: go_menu(MENU_MODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
502 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
503 | case UNITMODE_BEER: go_menu(MENU_MODE_BEER); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
504 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
505 | case UNITMODE_PROFILE: go_menu(MENU_MODE_PROFILE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
506 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
507 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
508 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
509 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
510 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
511 | case MENU_MODE_OFF: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
512 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
513 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
514 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
515 | go_menu(MENU_MODE_NONE); |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
516 | if (key == KEY_UP) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
517 | if (current_unit->profile_uuid) |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
518 | go_menu(MENU_MODE_PROFILE); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
519 | else |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
520 | go_menu(MENU_MODE_BEER); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
521 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
522 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
523 | change_mode(UNITMODE_OFF); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
524 | go_menu(MENU_MODE_OFF); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
525 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
526 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
527 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
528 | case MENU_MODE_NONE: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
529 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
530 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
531 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
532 | go_menu(MENU_MODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
533 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
534 | go_menu(MENU_MODE_OFF); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
535 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
536 | if (current_unit->mode == UNITMODE_NONE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
537 | go_menu(MENU_NONE_HEAT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
538 | else { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
539 | change_mode(UNITMODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
540 | go_menu(MENU_MODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
541 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
542 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
543 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
544 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
545 | case MENU_NONE_HEAT: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
546 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
547 | go_menu(MENU_MODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
548 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
549 | go_menu(MENU_NONE_COOL); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
550 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
551 | go_menu(MENU_NONE_FAN); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
552 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
553 | if (current_unit->heater_state) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
554 | current_unit->heater_state = 0; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
555 | else |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
556 | current_unit->heater_state = 100; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
557 | go_menu(MENU_NONE_HEAT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
558 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
559 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
560 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
561 | case MENU_NONE_COOL: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
562 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
563 | go_menu(MENU_MODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
564 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
565 | go_menu(MENU_NONE_FAN); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
566 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
567 | go_menu(MENU_NONE_HEAT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
568 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
569 | if (current_unit->cooler_state) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
570 | current_unit->cooler_state = 0; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
571 | else |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
572 | current_unit->cooler_state = 100; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
573 | go_menu(MENU_NONE_COOL); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
574 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
575 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
576 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
577 | case MENU_NONE_FAN: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
578 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
579 | go_menu(MENU_MODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
580 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
581 | go_menu(MENU_NONE_HEAT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
582 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
583 | go_menu(MENU_NONE_COOL); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
584 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
585 | if (current_unit->fan_state) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
586 | current_unit->fan_state = 0; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
587 | else |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
588 | current_unit->fan_state = 100; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
589 | go_menu(MENU_NONE_FAN); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
590 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
591 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
592 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
593 | case MENU_MODE_FRIDGE: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
594 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
595 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
596 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
597 | go_menu(MENU_MODE_BEER); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
598 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
599 | go_menu(MENU_MODE_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
600 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
601 | if (current_unit->mode == UNITMODE_FRIDGE) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
602 | temp_temp = current_unit->fridge_set_lo; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
603 | go_menu(MENU_FRIDGE_TEMP_LO); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
604 | } else { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
605 | change_mode(UNITMODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
606 | go_menu(MENU_MODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
607 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
608 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
609 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
610 | |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
611 | case MENU_FRIDGE_TEMP_LO: |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
612 | if (key == KEY_ESCAPE) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
613 | temp_temp = current_unit->fridge_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
614 | go_menu(MENU_FRIDGE_TEMP_HI); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
615 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
616 | if (key == KEY_DOWN) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
617 | if (temp_temp > current_unit->temp_set_min) |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
618 | temp_temp -= 0.1; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
619 | go_menu(MENU_FRIDGE_TEMP_LO); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
620 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
621 | if (key == KEY_UP) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
622 | if (temp_temp < current_unit->temp_set_max) |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
623 | temp_temp += 0.1; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
624 | go_menu(MENU_FRIDGE_TEMP_LO); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
625 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
626 | if (key == KEY_CONFIRM) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
627 | if (temp_temp != current_unit->fridge_set_lo) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
628 | syslog(LOG_NOTICE, "Fridge temp low changed from %.1f to %.1f from the panel", current_unit->fridge_set_lo, temp_temp); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
629 | current_unit->fridge_set_lo = temp_temp; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
630 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
631 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
632 | temp_temp = current_unit->fridge_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
633 | go_menu(MENU_FRIDGE_TEMP_HI); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
634 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
635 | break; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
636 | |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
637 | case MENU_FRIDGE_TEMP_HI: |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
638 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
639 | go_menu(MENU_MODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
640 | if (key == KEY_DOWN) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
641 | if (temp_temp > current_unit->temp_set_min) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
642 | temp_temp -= 0.1; |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
643 | go_menu(MENU_FRIDGE_TEMP_HI); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
644 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
645 | if (key == KEY_UP) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
646 | if (temp_temp < current_unit->temp_set_max) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
647 | temp_temp += 0.1; |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
648 | go_menu(MENU_FRIDGE_TEMP_HI); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
649 | } |
302
3d2bd47f35b4
Use confirm instead of enter key when stepping to a new beer or fridge temperature
Michiel Broek <mbroek@mbse.eu>
parents:
297
diff
changeset
|
650 | if (key == KEY_CONFIRM) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
651 | if (temp_temp != current_unit->fridge_set_hi) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
652 | syslog(LOG_NOTICE, "Fridge temp high changed from %.1f to %.1f from the panel", current_unit->fridge_set_hi, temp_temp); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
653 | current_unit->fridge_set_hi = temp_temp; |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
654 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
655 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
656 | go_menu(MENU_MODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
657 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
658 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
659 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
660 | case MENU_MODE_BEER: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
661 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
662 | go_menu(MENU_UNITS); |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
663 | if (key == KEY_DOWN) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
664 | if (current_unit->profile_uuid) |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
665 | go_menu(MENU_MODE_PROFILE); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
666 | else |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
667 | go_menu(MENU_MODE_OFF); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
668 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
669 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
670 | go_menu(MENU_MODE_FRIDGE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
671 | if (key == KEY_ENTER) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
672 | if (current_unit->mode == UNITMODE_BEER) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
673 | temp_temp = current_unit->beer_set_lo; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
674 | go_menu(MENU_BEER_TEMP_LO); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
675 | } else { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
676 | change_mode(UNITMODE_BEER); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
677 | go_menu(MENU_MODE_BEER); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
678 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
679 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
680 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
681 | |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
682 | case MENU_BEER_TEMP_LO: |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
683 | if (key == KEY_ESCAPE) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
684 | temp_temp = current_unit->beer_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
685 | go_menu(MENU_BEER_TEMP_HI); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
686 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
687 | if (key == KEY_DOWN) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
688 | if (temp_temp > current_unit->temp_set_min) |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
689 | temp_temp -= 0.1; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
690 | go_menu(MENU_BEER_TEMP_LO); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
691 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
692 | if (key == KEY_UP) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
693 | if (temp_temp < current_unit->temp_set_max) |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
694 | temp_temp += 0.1; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
695 | go_menu(MENU_BEER_TEMP_LO); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
696 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
697 | if (key == KEY_CONFIRM) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
698 | if (temp_temp != current_unit->beer_set_lo ) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
699 | syslog(LOG_NOTICE, "Beer temp low changed from %.1f to %.1f from the panel", current_unit->beer_set_lo, temp_temp); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
700 | current_unit->beer_set_lo = temp_temp; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
701 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
702 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
703 | temp_temp = current_unit->beer_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
704 | go_menu(MENU_BEER_TEMP_HI); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
705 | } |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
706 | break; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
707 | |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
708 | case MENU_BEER_TEMP_HI: |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
709 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
710 | go_menu(MENU_MODE_BEER); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
711 | if (key == KEY_DOWN) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
712 | if (temp_temp > current_unit->temp_set_min) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
713 | temp_temp -= 0.1; |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
714 | go_menu(MENU_BEER_TEMP_HI); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
715 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
716 | if (key == KEY_UP) { |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
717 | if (temp_temp < current_unit->temp_set_max) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
718 | temp_temp += 0.1; |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
719 | go_menu(MENU_BEER_TEMP_HI); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
720 | } |
302
3d2bd47f35b4
Use confirm instead of enter key when stepping to a new beer or fridge temperature
Michiel Broek <mbroek@mbse.eu>
parents:
297
diff
changeset
|
721 | if (key == KEY_CONFIRM) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
722 | if (temp_temp != current_unit->beer_set_hi ) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
723 | syslog(LOG_NOTICE, "Beer temp high changed from %.1f to %.1f from the panel", current_unit->beer_set_hi, temp_temp); |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
724 | current_unit->beer_set_hi = temp_temp; |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
725 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
726 | } |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
727 | go_menu(MENU_MODE_BEER); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
728 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
729 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
730 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
731 | case MENU_MODE_PROFILE: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
732 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
733 | go_menu(MENU_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
734 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
735 | go_menu(MENU_MODE_OFF); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
736 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
737 | go_menu(MENU_MODE_BEER); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
738 | if (key == KEY_ENTER) { |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
739 | if (current_unit->mode == UNITMODE_PROFILE) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
740 | switch (current_unit->prof_state) { |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
741 | case PROFILE_OFF: go_menu(MENU_PROFILE_START); |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
742 | break; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
743 | case PROFILE_PAUSE: go_menu(MENU_PROFILE_RESUME); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
744 | break; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
745 | case PROFILE_RUN: go_menu(MENU_PROFILE_PAUSE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
746 | break; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
747 | case PROFILE_DONE: go_menu(MENU_PROFILE_GOOFF); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
748 | break; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
749 | } |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
750 | } else { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
751 | change_mode(UNITMODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
752 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
753 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
754 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
755 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
756 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
757 | case MENU_PROFILE_START: |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
758 | if (key == KEY_ESCAPE) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
759 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
760 | if (key == KEY_ENTER) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
761 | current_unit->prof_state = PROFILE_RUN; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
762 | current_unit->prof_started = time(NULL); |
289
d810df0df36a
Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents:
288
diff
changeset
|
763 | current_unit->prof_paused = current_unit->prof_primary_done = 0; |
d810df0df36a
Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents:
288
diff
changeset
|
764 | current_unit->prof_peak_abs = current_unit->prof_peak_rel = 0.0; |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
765 | syslog(LOG_NOTICE, "Profile started from the panel"); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
766 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
767 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
768 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
769 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
770 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
771 | case MENU_PROFILE_PAUSE: |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
772 | if (key == KEY_ESCAPE) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
773 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
774 | if ((key == KEY_DOWN) || (key == KEY_UP)) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
775 | go_menu(MENU_PROFILE_ABORT); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
776 | if (key == KEY_ENTER) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
777 | current_unit->prof_state = PROFILE_PAUSE; |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
778 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
779 | syslog(LOG_NOTICE, "Profile pause from the panel"); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
780 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
781 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
782 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
783 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
784 | case MENU_PROFILE_ABORT: |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
785 | if (key == KEY_ESCAPE) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
786 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
787 | if ((key == KEY_DOWN) || (key == KEY_UP)) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
788 | if (current_unit->prof_state == PROFILE_PAUSE) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
789 | go_menu(MENU_PROFILE_RESUME); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
790 | else if (current_unit->prof_state == PROFILE_RUN) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
791 | go_menu(MENU_PROFILE_PAUSE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
792 | } |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
793 | if ((key == KEY_ENTER) && ((current_unit->prof_state == PROFILE_RUN) || (current_unit->prof_state == PROFILE_PAUSE))) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
794 | current_unit->prof_state = PROFILE_OFF; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
795 | current_unit->prof_started = 0; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
796 | syslog(LOG_NOTICE, "Profile aborted from the panel"); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
797 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
798 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
799 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
800 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
801 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
802 | case MENU_PROFILE_RESUME: |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
803 | if (key == KEY_ESCAPE) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
804 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
805 | if ((key == KEY_DOWN) || (key == KEY_UP)) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
806 | go_menu(MENU_PROFILE_ABORT); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
807 | if (key == KEY_ENTER) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
808 | current_unit->prof_state = PROFILE_RUN; |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
809 | syslog(LOG_NOTICE, "Profile resume from the panel"); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
810 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
811 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
812 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
813 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
814 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
815 | case MENU_PROFILE_GOOFF: |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
816 | if (key == KEY_ESCAPE) |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
817 | go_menu(MENU_MODE_PROFILE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
818 | if (key == KEY_ENTER) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
819 | if (current_unit->prof_state == PROFILE_DONE) { |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
820 | current_unit->prof_state = PROFILE_OFF; |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
821 | current_unit->mqtt_flag |= MQTT_FLAG_DATA; |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
822 | syslog(LOG_NOTICE, "Profile from done to off from the panel"); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
823 | } |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
824 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
825 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
826 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
827 | case MENU_TOP_SYS: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
828 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
829 | go_menu(MENU_NONE); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
830 | if (key == KEY_DOWN) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
831 | go_menu(MENU_TOP_DEFAULT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
832 | if (key == KEY_UP) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
833 | go_menu(MENU_TOP_UNITS); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
834 | if (key == KEY_ENTER) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
835 | go_menu(MENU_SYS_HALT); |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
836 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
837 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
838 | case MENU_SYS_HALT: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
839 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
840 | go_menu(MENU_TOP_SYS); |
248
870d0be6880d
Removed two system menus that would not work correctly. All panel menus are complete now.
Michiel Broek <mbroek@mbse.eu>
parents:
247
diff
changeset
|
841 | if ((key == KEY_DOWN) || (key == KEY_UP)) |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
842 | go_menu(MENU_SYS_REBOOT); |
248
870d0be6880d
Removed two system menus that would not work correctly. All panel menus are complete now.
Michiel Broek <mbroek@mbse.eu>
parents:
247
diff
changeset
|
843 | if (key == KEY_CONFIRM) { |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
844 | rc = system("/sbin/halt"); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
845 | syslog(LOG_NOTICE, "System halt from panel: /sbin/halt rc=%d", rc); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
846 | go_menu(MENU_NONE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
847 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
848 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
849 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
850 | case MENU_SYS_REBOOT: |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
851 | if (key == KEY_ESCAPE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
852 | go_menu(MENU_TOP_SYS); |
248
870d0be6880d
Removed two system menus that would not work correctly. All panel menus are complete now.
Michiel Broek <mbroek@mbse.eu>
parents:
247
diff
changeset
|
853 | if ((key == KEY_DOWN) || (key == KEY_UP)) |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
854 | go_menu(MENU_SYS_HALT); |
248
870d0be6880d
Removed two system menus that would not work correctly. All panel menus are complete now.
Michiel Broek <mbroek@mbse.eu>
parents:
247
diff
changeset
|
855 | if (key == KEY_CONFIRM) { |
247
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
856 | rc = system("/sbin/reboot"); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
857 | syslog(LOG_NOTICE, "System reboot from panel: /sbin/reboot rc=%d", rc); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
858 | go_menu(MENU_NONE); |
f3d0e9445fcd
Added profile panel menus and system panel menus
Michiel Broek <mbroek@mbse.eu>
parents:
246
diff
changeset
|
859 | } |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
860 | break; |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
861 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
862 | } |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
863 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
864 | |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
865 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
866 | int main(int argc, char *argv[]) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
867 | { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
868 | int rc, c, i; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
869 | pid_t frk; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
870 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
871 | while (1) { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
872 | int option_index = 0; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
873 | static struct option long_options[] = { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
874 | {"debug", 0, 0, 'c'}, |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
875 | {"help", 0, 0, 'h'}, |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
876 | {0, 0, 0, 0} |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
877 | }; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
878 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
879 | c = getopt_long(argc, argv, "dh", long_options, &option_index); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
880 | if (c == -1) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
881 | break; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
882 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
883 | switch (c) { |
75
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
884 | case 'd': debug = TRUE; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
885 | break; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
886 | case 'h': help(); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
887 | return 1; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
888 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
889 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
890 | |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
891 | openlog("thermferm", LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_USER); |
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
892 | syslog(LOG_NOTICE, "mbsePi-apps thermferm v%s starting", VERSION); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
893 | if (debug) |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
894 | fprintf(stdout, "mbsePi-apps thermferm v%s starting\n", VERSION); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
895 | |
86
3d7a241329e2
Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
896 | if (rdconfig()) { |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
897 | fprintf(stderr, "Error reading configuration\n"); |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
898 | syslog(LOG_NOTICE, "Error reading configuration: halted"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
899 | return 1; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
900 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
901 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
902 | /* |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
903 | * Catch all the signals we can, and ignore the rest. Note that SIGKILL can't be ignored |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
904 | * but that's live. This daemon should only be stopped by SIGTERM. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
905 | * Don't catch SIGCHLD. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
906 | */ |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
907 | for (i = 0; i < NSIG; i++) { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
908 | if ((i != SIGCHLD) && (i != SIGKILL) && (i != SIGSTOP)) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
909 | signal(i, (void (*))die); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
910 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
911 | |
66
805f1d285acd
Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents:
64
diff
changeset
|
912 | #ifdef HAVE_WIRINGPI_H |
611 | 913 | if (wiringPiSetup () ) { |
914 | syslog(LOG_NOTICE, "Error wiringPiSetup(): halted"); | |
28
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
915 | return 1; |
611 | 916 | } |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
917 | #endif |
28
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
918 | |
108 | 919 | if ((rc = initLCD (Config.lcd_cols, Config.lcd_rows))) { |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
920 | fprintf(stderr, "Cannot initialize LCD display, rc=%d\n", rc); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
921 | return 1; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
922 | } |
28
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
923 | |
484
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
924 | #ifdef HAVE_WIRINGPI_H |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
925 | lcdCharDef(lcdHandle, 1, degC); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
926 | lcdCharDef(lcdHandle, 2, SP_Symbol); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
927 | lcdCharDef(lcdHandle, 3, CoolONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
928 | lcdCharDef(lcdHandle, 4, RevCoolONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
929 | lcdCharDef(lcdHandle, 5, HeatONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
930 | lcdCharDef(lcdHandle, 6, RevHeatONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
931 | #endif |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
932 | slcdCharDef(slcdHandle, 1, degC); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
933 | slcdCharDef(slcdHandle, 2, SP_Symbol); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
934 | slcdCharDef(slcdHandle, 3, CoolONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
935 | slcdCharDef(slcdHandle, 4, RevCoolONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
936 | slcdCharDef(slcdHandle, 5, HeatONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
937 | slcdCharDef(slcdHandle, 6, RevHeatONOFF); |
7362ebd40f26
Use user defined characters for the LCD display just like in Arduino projects.
Michiel Broek <mbroek@mbse.eu>
parents:
481
diff
changeset
|
938 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
939 | if (debug) { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
940 | /* |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
941 | * For debugging run in foreground. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
942 | */ |
550
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
943 | do { |
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
944 | rc = server(); |
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
945 | } while (my_reboot == TRUE); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
946 | } else { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
947 | /* |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
948 | * Server initialization is complete. Now we can fork the |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
949 | * daemon and return to the user. We need to do a setpgrp |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
950 | * so that the daemon will no longer be assosiated with the |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
951 | * users control terminal. This is done before the fork, so |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
952 | * that the child will not be a process group leader. Otherwise, |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
953 | * if the child were to open a terminal, it would become |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
954 | * associated with that terminal as its control terminal. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
955 | */ |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
956 | if ((pgrp = setpgid(0, 0)) == -1) { |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
957 | syslog(LOG_NOTICE, "setpgpid failed"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
958 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
959 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
960 | frk = fork(); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
961 | switch (frk) { |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
962 | case -1: |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
963 | syslog(LOG_NOTICE, "Daemon fork failed: %s", strerror(errno)); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
964 | stopLCD(); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
965 | exit(1); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
966 | case 0: /* |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
967 | * Run the daemon |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
968 | */ |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
969 | fclose(stdin); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
970 | if (open("/dev/null", O_RDONLY) != 0) { |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
971 | syslog(LOG_NOTICE, "Reopen of stdin to /dev/null failed"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
972 | _exit(2); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
973 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
974 | fclose(stdout); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
975 | if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) { |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
976 | syslog(LOG_NOTICE, "Reopen of stdout to /dev/null failed"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
977 | _exit(2); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
978 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
979 | fclose(stderr); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
980 | if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) { |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
981 | syslog(LOG_NOTICE, "Reopen of stderr to /dev/null failed"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
982 | _exit(2); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
983 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
984 | mypid = getpid(); |
550
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
985 | do { |
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
986 | rc = server(); |
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
987 | } while (my_reboot == TRUE); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
988 | break; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
989 | /* Not reached */ |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
990 | default: |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
991 | /* |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
992 | * Here we detach this process and let the child |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
993 | * run the deamon process. |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
994 | */ |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
995 | syslog(LOG_NOTICE, "Starting daemon with pid %d", frk); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
996 | exit(0); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
997 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
998 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
999 | |
561
fcfc3dbe85fa
Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
1000 | killconfig(); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1001 | syslog(LOG_NOTICE, "Finished, rc=%d", rc); |
597
93667d842c9b
Less debug messages on stdout
Michiel Broek <mbroek@mbse.eu>
parents:
596
diff
changeset
|
1002 | if (debug) |
93667d842c9b
Less debug messages on stdout
Michiel Broek <mbroek@mbse.eu>
parents:
596
diff
changeset
|
1003 | fprintf(stdout, "Finished, rc=%d\n", rc); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1004 | return rc; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1005 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1006 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1007 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1008 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1009 | int server(void) |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1010 | { |
544
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1011 | time_t now, last = (time_t)0, ndata = (time_t)0;; |
104 | 1012 | units_list *unit; |
194
9eaaba49450f
Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
1013 | prof_step *step; |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1014 | int row, rc, run = 1, seconds = 0, minutes = 0, temp; |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1015 | int run_seconds, run_minutes, run_hours, tot_minutes, key; |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1016 | struct tm *tm; |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1017 | #ifndef HAVE_WIRINGPI_H |
74 | 1018 | long t = 0; |
66
805f1d285acd
Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents:
64
diff
changeset
|
1019 | #endif |
398
efdfef1677d1
Fixed crash after profile is finished. Fixed error in UNIT GET output.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
1020 | int current_step, valid_step, time_until_now, previous_fridge_mode; |
397
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
395
diff
changeset
|
1021 | float previous_target_lo, previous_target_hi; |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1022 | float LCDair, LCDbeer, LCDspL, LCDspH; |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1023 | unsigned char LCDstatC, LCDstatH; |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1024 | int LCDunit; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1025 | |
550
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
1026 | syslog(LOG_NOTICE, "Server process started"); |
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
1027 | my_shutdown = my_reboot = FALSE; |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
1028 | if (lockprog((char *)"thermferm")) { |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
1029 | syslog(LOG_NOTICE, "Can't lock"); |
34 | 1030 | return 1; |
1031 | } | |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1032 | mqtt_connect(); |
497
18ace27338e5
Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents:
496
diff
changeset
|
1033 | |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1034 | if ((rc = devices_detect())) { |
158 | 1035 | syslog(LOG_NOTICE, "Detected %d new devices", rc); |
1036 | wrconfig(); | |
1037 | } | |
1038 | ||
66
805f1d285acd
Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents:
64
diff
changeset
|
1039 | #ifdef HAVE_WIRINGPI_H |
164
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1040 | rc = piThreadCreate(my_devices_loop); |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1041 | #else |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1042 | rc = pthread_create(&threads[t], NULL, my_devices_loop, (void *)t ); |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1043 | #endif |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1044 | if (rc) { |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1045 | fprintf(stderr, "my_devices_loop thread didn't start rc=%d\n", rc); |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
1046 | syslog(LOG_NOTICE, "my_devices_loop thread didn't start rc=%d", rc); |
164
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1047 | #ifndef HAVE_WIRINGPI_H |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1048 | } else { |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1049 | t++; |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1050 | #endif |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1051 | } |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1052 | |
f16def8472ba
Threads partly working via new devices interface
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
1053 | #ifdef HAVE_WIRINGPI_H |
43 | 1054 | rc = piThreadCreate(my_server_loop); |
74 | 1055 | #else |
75
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
1056 | rc = pthread_create(&threads[t], NULL, my_server_loop, (void *)t ); |
74 | 1057 | #endif |
43 | 1058 | if (rc) { |
1059 | fprintf(stderr, "my_server_loop thread didn't start rc=%d\n", rc); | |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
1060 | syslog(LOG_NOTICE, "my_server_loop thread didn't start rc=%d", rc); |
75
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
1061 | #ifndef HAVE_WIRINGPI_H |
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
1062 | } else { |
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
1063 | t++; |
4b976601737d
Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
1064 | #endif |
43 | 1065 | } |
1066 | ||
199 | 1067 | #ifdef HAVE_WIRINGPI_H |
423
02653162b03b
Fixed compiling for systems with wiringPi. Improved handling of udp sockets if there is no brewpanel running.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
1068 | rc = piThreadCreate(my_panel_loop); |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1069 | #else |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1070 | rc = pthread_create(&threads[t], NULL, my_panel_loop, (void *)t ); |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1071 | #endif |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1072 | if (rc) { |
199 | 1073 | fprintf(stderr, "my_panel_loop thread didn't start rc=%d\n", rc); |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
1074 | syslog(LOG_NOTICE, "my_panel_loop thread didn't start rc=%d", rc); |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1075 | #ifndef HAVE_WIRINGPI_H |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1076 | } else { |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1077 | t++; |
199 | 1078 | #endif |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1079 | } |
259
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1080 | |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1081 | #ifdef USE_SIMULATOR |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1082 | #ifdef HAVE_WIRINGPI_H |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1083 | rc = piThreadCreate(my_simulator_loop); |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1084 | #else |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1085 | rc = pthread_create(&threads[t], NULL, my_simulator_loop, (void *)t ); |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1086 | #endif |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1087 | if (rc) { |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1088 | fprintf(stderr, "my_simulator_loop thread didn't start rc=%d\n", rc); |
268
dda91dfa4aa8
All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents:
267
diff
changeset
|
1089 | syslog(LOG_NOTICE, "my_simulator_loop thread didn't start rc=%d", rc); |
259
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1090 | #ifndef HAVE_WIRINGPI_H |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1091 | } else { |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1092 | t++; |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1093 | #endif |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1094 | } |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1095 | #endif |
b7c967359771
Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents:
248
diff
changeset
|
1096 | |
497
18ace27338e5
Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents:
496
diff
changeset
|
1097 | |
182 | 1098 | /* |
1099 | * Initialize units for processing | |
1100 | */ | |
1101 | for (unit = Config.units; unit; unit = unit->next) { | |
1102 | /* | |
1103 | * Safety, turn everything off | |
1104 | */ | |
525 | 1105 | unit->mqtt_flag = unit->alarm_flag = unit->alarm_last = 0; |
582
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1106 | unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->light_state = unit->light_timer = 0; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1107 | unit->heater_wait = unit->cooler_wait = unit->fan_wait = unit->light_wait = 0; |
195
b34a1b2421fb
Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
1108 | if (unit->mode == UNITMODE_PROFILE) { |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1109 | if (!unit->profile_uuid) |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1110 | syslog(LOG_NOTICE, "Starting unit `%s' in profile mode, no profile defined.", unit->alias); |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1111 | else { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1112 | syslog(LOG_NOTICE, "Starting unit `%s' in profile state %s.", unit->alias, PROFSTATE[unit->prof_state]); |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1113 | } |
182 | 1114 | } else if (unit->mode == UNITMODE_BEER) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1115 | syslog(LOG_NOTICE, "Starting unit `%s' beer cooler at %.1f - %.1f degrees", unit->alias, unit->beer_set_lo, unit->beer_set_hi); |
182 | 1116 | } else if (unit->mode == UNITMODE_FRIDGE) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1117 | syslog(LOG_NOTICE, "Starting unit `%s' as refridgerator at %.1f - %.1f degrees", unit->alias, unit->fridge_set_lo, unit->fridge_set_hi); |
182 | 1118 | } else if (unit->mode == UNITMODE_NONE) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1119 | syslog(LOG_NOTICE, "Starting unit `%s' in inactive state", unit->alias); |
182 | 1120 | } else { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1121 | syslog(LOG_NOTICE, "Starting unit `%s' in off state", unit->alias); |
182 | 1122 | } |
1123 | } | |
547
0e4d4b45249f
Versie 0.8.0. Fixed eerste DBIRTH fout geinitialiseerde waardes.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
1124 | publishDBirthAll(); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1125 | |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1126 | for (unit = Config.units; unit; unit = unit->next) { |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1127 | if (unit->mode != UNITMODE_OFF) { |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1128 | unit->event_msg = xstrcpy((char *)"Startup"); |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1129 | publishDLog(unit); |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1130 | free(unit->event_msg); |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1131 | unit->event_msg = NULL; |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1132 | } |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1133 | } |
182 | 1134 | |
111 | 1135 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1136 | piLock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1137 | #endif |
238 | 1138 | lcd_buf_write(1, (char *)" ThermFerm "); |
108 | 1139 | lcd_buf_write(2, (char *)" Version %s ", VERSION); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1140 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1141 | piUnlock(LOCK_LCD); |
111 | 1142 | #endif |
108 | 1143 | |
33
2357e8636a60
Added user log with temperatures and cooler state
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
1144 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1145 | do { |
46
000399c64d3f
More client/server communications
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
1146 | if (my_shutdown) |
000399c64d3f
More client/server communications
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
1147 | run = 0; |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1148 | |
245
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1149 | /* |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1150 | * Use to stop processing units. Should be used when a unit is |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1151 | * added or removed. |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1152 | */ |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1153 | if (run_pause) { |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1154 | run_hold = TRUE; |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1155 | syslog(LOG_NOTICE, "run_pause: entering hold state"); |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1156 | for (;;) { |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1157 | usleep(100000); |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1158 | if (! run_pause) |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1159 | break; |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1160 | } |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1161 | syslog(LOG_NOTICE, "run_pause: leaving hold state"); |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1162 | run_hold = FALSE; |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1163 | #ifdef HAVE_WIRINGPI_H |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1164 | /* |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1165 | * In case the LCD buffers were cleared, setup the first page. |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1166 | */ |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1167 | piLock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1168 | #endif |
245
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1169 | lcd_buf_write(1, (char *)" ThermFerm "); |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1170 | lcd_buf_write(2, (char *)" Version %s ", VERSION); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1171 | #ifdef HAVE_WIRINGPI_H |
245
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1172 | piUnlock(LOCK_LCD); |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1173 | #endif |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1174 | } |
b01b6238eb67
You can now safely add and remove units on a running system.
Michiel Broek <mbroek@mbse.eu>
parents:
244
diff
changeset
|
1175 | |
64
2431965e8a8c
Write loglines only every 60 seconds
Michiel Broek <mbroek@mbse.eu>
parents:
63
diff
changeset
|
1176 | now = time(NULL); |
104 | 1177 | if (now != last) { |
189
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1178 | /* |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1179 | * Each second |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1180 | */ |
64
2431965e8a8c
Write loglines only every 60 seconds
Michiel Broek <mbroek@mbse.eu>
parents:
63
diff
changeset
|
1181 | last = now; |
104 | 1182 | seconds++; |
1183 | ||
108 | 1184 | row = 3; |
1185 | tm = localtime(&now); | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1186 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1187 | piLock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1188 | #endif |
108 | 1189 | lcd_buf_write(row++, " %02d-%02d-%04d ", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900); |
1190 | lcd_buf_write(row++, " %02d:%02d:%02d ", tm->tm_hour, tm->tm_min, tm->tm_sec); | |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1191 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1192 | piUnlock(LOCK_LCD); |
182 | 1193 | #endif |
105
a5a964148e34
Started code of roulating lcd display
Michiel Broek <mbroek@mbse.eu>
parents:
104
diff
changeset
|
1194 | |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1195 | #ifdef HAVE_WIRINGPI_H |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1196 | piLock(LOCK_LCD); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1197 | #endif |
497
18ace27338e5
Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents:
496
diff
changeset
|
1198 | lcd_buf_write(row, "Room temp N/A "); |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1199 | #ifdef HAVE_WIRINGPI_H |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1200 | piUnlock(LOCK_LCD); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1201 | #endif |
545
c382a6c58c20
Fixed compiling whithout mqtt support.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
1202 | int updateHT = 0; |
207 | 1203 | if (Config.temp_address) { |
395
e32e83550963
Switched to new device read code. Removed the incomplete support for the DS2408 1-wire chip.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
1204 | rc = device_in(Config.temp_address, &temp); |
207 | 1205 | if (rc == DEVPRESENT_YES) { |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1206 | if (Config.temp_value != temp) |
545
c382a6c58c20
Fixed compiling whithout mqtt support.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
1207 | updateHT = 1; |
207 | 1208 | Config.temp_value = temp; |
1209 | Config.temp_state = 0; | |
1210 | #ifdef HAVE_WIRINGPI_H | |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1211 | piLock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1212 | #endif |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1213 | lcd_buf_write(row, "Room temp %.1f%c ", Config.temp_value / 1000.0, 0x01); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1214 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1215 | piUnlock(LOCK_LCD); |
207 | 1216 | #endif |
1217 | } else if (rc == DEVPRESENT_ERROR) { | |
1218 | Config.temp_state = 1; | |
1219 | } else { | |
1220 | Config.temp_state = 2; | |
1221 | } | |
583
9795a16de807
Attempt to better check the temperature sensors and lower the cpu load.
Michiel Broek <mbroek@mbse.eu>
parents:
582
diff
changeset
|
1222 | usleep(10000); |
207 | 1223 | } |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1224 | row++; |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1225 | |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1226 | #ifdef HAVE_WIRINGPI_H |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1227 | piLock(LOCK_LCD); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1228 | #endif |
497
18ace27338e5
Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents:
496
diff
changeset
|
1229 | lcd_buf_write(row, " Humidity N/A "); |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1230 | #ifdef HAVE_WIRINGPI_H |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1231 | piUnlock(LOCK_LCD); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1232 | #endif |
207 | 1233 | |
1234 | if (Config.hum_address) { | |
395
e32e83550963
Switched to new device read code. Removed the incomplete support for the DS2408 1-wire chip.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
1235 | rc = device_in(Config.hum_address, &temp); |
207 | 1236 | if (rc == DEVPRESENT_YES) { |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1237 | if (Config.hum_value != temp) |
545
c382a6c58c20
Fixed compiling whithout mqtt support.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
1238 | updateHT = 1; |
207 | 1239 | Config.hum_value = temp; |
1240 | Config.hum_state = 0; | |
1241 | #ifdef HAVE_WIRINGPI_H | |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1242 | piLock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1243 | #endif |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1244 | lcd_buf_write(row, " Humidity %.1f%% ", Config.hum_value / 1000.0); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1245 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1246 | piUnlock(LOCK_LCD); |
207 | 1247 | #endif |
1248 | } else if (rc == DEVPRESENT_ERROR) { | |
1249 | Config.hum_state = 1; | |
1250 | } else { | |
1251 | Config.hum_state = 2; | |
1252 | } | |
583
9795a16de807
Attempt to better check the temperature sensors and lower the cpu load.
Michiel Broek <mbroek@mbse.eu>
parents:
582
diff
changeset
|
1253 | usleep(10000); |
207 | 1254 | } |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1255 | row++; |
544
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1256 | /* |
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1257 | * If TH(B) changed. or if 5 minutes without |
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1258 | * update, send the NDATA message. |
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1259 | */ |
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1260 | if (updateHT || (now > (ndata + 300))) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1261 | publishNData(false, 0); |
544
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1262 | ndata = now; |
e2889b17f48c
Versie 0.6.8. Code cleanup. Publish NDATA MQTT bericht iedere 5 minuten of als er een THB wijziging is.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
1263 | } |
207 | 1264 | |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1265 | LCDunit = 0; |
108 | 1266 | for (unit = Config.units; unit; unit = unit->next) { |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1267 | LCDunit++; |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1268 | unit->mqtt_flag &= ~MQTT_FLAG_DATA; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1269 | unit->alarm_flag = 0; |
506 | 1270 | |
182 | 1271 | if (unit->air_address) { |
395
e32e83550963
Switched to new device read code. Removed the incomplete support for the DS2408 1-wire chip.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
1272 | rc = device_in(unit->air_address, &temp); |
182 | 1273 | if (rc == DEVPRESENT_YES) { |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1274 | if (unit->air_temperature != temp) { |
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1275 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1276 | // pub_domoticz_temp(unit->air_idx, temp); |
182 | 1277 | } |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1278 | unit->air_temperature = temp; |
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1279 | unit->air_state = 0; |
182 | 1280 | } else if (rc == DEVPRESENT_ERROR) { |
1281 | unit->air_state = 1; | |
1282 | } else { | |
1283 | unit->air_state = 2; | |
1284 | } | |
1285 | } | |
1286 | ||
1287 | if (unit->beer_address) { | |
395
e32e83550963
Switched to new device read code. Removed the incomplete support for the DS2408 1-wire chip.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
1288 | rc = device_in(unit->beer_address, &temp); |
614
389097dc665d
Version 0.9.11. Removed lcd debug message after 7 years. Added setup for alternative beer sensor. If the main sensor is gone, the alternative will be used.
Michiel Broek <mbroek@mbse.eu>
parents:
611
diff
changeset
|
1289 | if ((rc == DEVPRESENT_NO) && unit->beer_address2) { |
389097dc665d
Version 0.9.11. Removed lcd debug message after 7 years. Added setup for alternative beer sensor. If the main sensor is gone, the alternative will be used.
Michiel Broek <mbroek@mbse.eu>
parents:
611
diff
changeset
|
1290 | /* Read alternative sensor */ |
389097dc665d
Version 0.9.11. Removed lcd debug message after 7 years. Added setup for alternative beer sensor. If the main sensor is gone, the alternative will be used.
Michiel Broek <mbroek@mbse.eu>
parents:
611
diff
changeset
|
1291 | rc = device_in(unit->beer_address2, &temp); |
389097dc665d
Version 0.9.11. Removed lcd debug message after 7 years. Added setup for alternative beer sensor. If the main sensor is gone, the alternative will be used.
Michiel Broek <mbroek@mbse.eu>
parents:
611
diff
changeset
|
1292 | } |
182 | 1293 | if (rc == DEVPRESENT_YES) { |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1294 | if (unit->beer_temperature != temp) { |
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1295 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1296 | // pub_domoticz_temp(unit->beer_idx, temp); |
182 | 1297 | } |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1298 | unit->beer_temperature = temp; |
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1299 | unit->beer_state = 0; |
182 | 1300 | } else if (rc == DEVPRESENT_ERROR) { |
1301 | unit->beer_state = 1; | |
1302 | } else { | |
1303 | unit->beer_state = 2; | |
1304 | } | |
1305 | } | |
184 | 1306 | |
518
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1307 | if (unit->chiller_address) { |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1308 | rc = device_in(unit->chiller_address, &temp); |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1309 | if (rc == DEVPRESENT_YES) { |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1310 | if (unit->chiller_temperature != temp) { |
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1311 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1312 | // pub_domoticz_temp(unit->chiller_idx, temp); |
518
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1313 | } |
596
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1314 | unit->chiller_temperature = temp; |
e3d3cde32847
Revoved old temperature sensors read errors workaround.
Michiel Broek <mbroek@mbse.eu>
parents:
594
diff
changeset
|
1315 | unit->chiller_state = 0; |
518
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1316 | } else if (rc == DEVPRESENT_ERROR) { |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1317 | unit->chiller_state = 1; |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1318 | } else { |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1319 | unit->chiller_state = 2; |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1320 | } |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1321 | } |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1322 | |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1323 | /* |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1324 | * Unit door state, default is closed. |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1325 | */ |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1326 | if (unit->door_address) { |
395
e32e83550963
Switched to new device read code. Removed the incomplete support for the DS2408 1-wire chip.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
1327 | rc = device_in(unit->door_address, &temp); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1328 | if (rc == DEVPRESENT_YES) { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1329 | if (temp) { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1330 | if (unit->door_state == 0) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1331 | syslog(LOG_NOTICE, "Unit `%s' door closed", unit->alias); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1332 | unit->door_state = 1; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1333 | // pub_domoticz_output(unit->door_idx, unit->door_state); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1334 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1335 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1336 | } else { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1337 | if (unit->door_state) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1338 | syslog(LOG_NOTICE, "Unit `%s' door opened", unit->alias); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1339 | unit->door_state = 0; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1340 | // pub_domoticz_output(unit->door_idx, unit->door_state); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1341 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1342 | } |
525 | 1343 | /* |
1344 | * If unit is active and the door is open | |
1345 | */ | |
1346 | if (unit->mode != UNITMODE_NONE) { | |
1347 | unit->alarm_flag |= ALARM_FLAG_DOOR; | |
1348 | } | |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1349 | } |
503
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1350 | } else { |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1351 | unit->door_state = 1; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1352 | } |
503
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1353 | } else { |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1354 | unit->door_state = 1; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1355 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1356 | |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1357 | /* |
503
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1358 | * Unit PSU state |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1359 | */ |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1360 | if (unit->psu_address) { |
395
e32e83550963
Switched to new device read code. Removed the incomplete support for the DS2408 1-wire chip.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
1361 | rc = device_in(unit->psu_address, &temp); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1362 | if (rc == DEVPRESENT_YES) { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1363 | if (temp) { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1364 | if (unit->psu_state == 0) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1365 | syslog(LOG_NOTICE, "Unit `%s' PSU (12 volt) is on", unit->alias); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1366 | unit->psu_state = 1; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1367 | // pub_domoticz_output(unit->psu_idx, unit->psu_state); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1368 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1369 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1370 | } else { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1371 | if (unit->psu_state) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1372 | syslog(LOG_NOTICE, "Unit `%s' PSU (12 volt) is off", unit->alias); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1373 | unit->psu_state = 0; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1374 | // pub_domoticz_output(unit->psu_idx, unit->psu_state); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1375 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1376 | } |
525 | 1377 | unit->alarm_flag |= ALARM_FLAG_PSU; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1378 | } |
503
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1379 | } else { |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1380 | unit->psu_state = 1; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1381 | } |
503
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1382 | } else { |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1383 | /* |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1384 | * No state available, assume Ok. |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1385 | */ |
003c20125212
Better door and 12 volt detection and logging
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
1386 | unit->psu_state = 1; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1387 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1388 | |
184 | 1389 | /* |
189
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1390 | * Handle profile |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1391 | */ |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1392 | if ((unit->mode == UNITMODE_PROFILE) && (unit->profile_uuid)) { |
189
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1393 | /* |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1394 | * unit->prof_started - start time or 0 if not yet running. |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1395 | * unit->prof_state - PROFILE_OFF|PROFILE_PAUSE|PROFILE_RUN|PROFILE_DONE |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1396 | * unit->prof_target - Calculated target temperature. |
194
9eaaba49450f
Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
1397 | * unit->prof_paused - Internal pause counter. |
289
d810df0df36a
Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents:
288
diff
changeset
|
1398 | * unit->prof_peak_abs - Peak temperature of the beer. |
d810df0df36a
Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents:
288
diff
changeset
|
1399 | * unit->prof_peak_rel - Peak temperature between beer and fridge. |
d810df0df36a
Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents:
288
diff
changeset
|
1400 | * unit->prof_primary_done - time when primary fermentation was over the peak. |
189
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1401 | */ |
219
ae720212accc
Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
1402 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1403 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1404 | * Safe defaults |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1405 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1406 | unit->prof_target_lo = unit->profile_inittemp_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1407 | unit->prof_target_hi = unit->profile_inittemp_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1408 | unit->prof_fridge_mode = 0; |
398
efdfef1677d1
Fixed crash after profile is finished. Fixed error in UNIT GET output.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
1409 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1410 | switch (unit->prof_state) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1411 | case PROFILE_OFF: |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1412 | unit->prof_percent = 0; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1413 | break; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1414 | case PROFILE_PAUSE: |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1415 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1416 | * Keep current temperature, measure pause time. For |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1417 | * temperature fall thru. |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1418 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1419 | unit->prof_paused++; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1420 | case PROFILE_RUN: |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1421 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1422 | * Calculate current profile step and desired temperature. |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1423 | * When all steps are done, set state to PROFILE_DONE. |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1424 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1425 | previous_target_lo = unit->profile_inittemp_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1426 | previous_target_hi = unit->profile_inittemp_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1427 | previous_fridge_mode = unit->profile_fridge_mode; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1428 | time_until_now = current_step = 0; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1429 | run_seconds = (int)(now - unit->prof_started - unit->prof_paused); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1430 | run_minutes = run_seconds / 60; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1431 | run_hours = run_minutes / 60; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1432 | if (debug) |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1433 | fprintf(stdout, "run_HMS=%d,%d,%d ", run_hours, run_minutes, run_seconds); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1434 | |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1435 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1436 | * Primary fermentation tests |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1437 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1438 | if ((unit->beer_temperature / 1000.0) > unit->prof_peak_abs) |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1439 | unit->prof_peak_abs = unit->beer_temperature / 1000.0; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1440 | if (((unit->beer_temperature - unit->air_temperature) / 1000.0) > unit->prof_peak_rel) |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1441 | unit->prof_peak_rel = (unit->beer_temperature - unit->air_temperature) / 1000.0; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1442 | if (unit->prof_primary_done == 0) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1443 | if (unit->cooler_address) { |
194
9eaaba49450f
Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
1444 | /* |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1445 | * There is a cooler. If the difference between the beer and air temperature |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1446 | * drops we assume the primary fermentation is done. |
277
6f9a7cca8f19
Fixed profile progess percentage
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
1447 | */ |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1448 | if (((unit->beer_temperature - unit->air_temperature) / 1000.0) < (unit->prof_peak_rel - 0.5)) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1449 | unit->prof_primary_done = time(NULL); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1450 | syslog(LOG_NOTICE, "Profile `%s' primary fermentation is ready (cooler mode)", unit->profile_name); |
575
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1451 | if (! unit->event_msg) |
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1452 | unit->event_msg = xstrcpy((char *)"Primary peak"); |
277
6f9a7cca8f19
Fixed profile progess percentage
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
1453 | } |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1454 | } else { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1455 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1456 | * This method works if the unit has no cooling or if the profile allowed the |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1457 | * beer temperature to rise freely. |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1458 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1459 | if ((unit->beer_temperature / 1000.0) < (unit->prof_peak_abs - 0.5)) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1460 | unit->prof_primary_done = time(NULL); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1461 | syslog(LOG_NOTICE, "Profile `%s' primary fermentation is ready (free rise mode)", unit->profile_name); |
575
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1462 | if (! unit->event_msg) |
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1463 | unit->event_msg = xstrcpy((char *)"Primary peak"); |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1464 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1465 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1466 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1467 | |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1468 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1469 | * See how long this profile will take |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1470 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1471 | tot_minutes = 0; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1472 | for (step = unit->profile_steps; step; step = step->next) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1473 | tot_minutes += ((step->steptime + step->resttime) * 60); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1474 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1475 | if ((tot_minutes == 0) && unit->profile_totalsteps) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1476 | syslog(LOG_NOTICE, "Profile `%s' steps disappeared", unit->profile_name); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1477 | unit->prof_state = PROFILE_OFF; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1478 | break; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1479 | } |
277
6f9a7cca8f19
Fixed profile progess percentage
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
1480 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1481 | valid_step = FALSE; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1482 | for (step = unit->profile_steps; step; step = step->next) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1483 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1484 | * step->steptime |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1485 | * step->resttime |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1486 | * step->target |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1487 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1488 | current_step++; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1489 | if ((run_hours >= time_until_now) && (run_hours < (time_until_now + step->steptime + step->resttime))) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1490 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1491 | * This is our current step |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1492 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1493 | valid_step = TRUE; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1494 | if ((run_hours - time_until_now) < step->steptime) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1495 | unit->prof_target_lo = previous_target_lo + (((run_minutes - (time_until_now * 60.0)) / (step->steptime * 60.0)) * (step->target_lo - previous_target_lo)); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1496 | unit->prof_target_hi = previous_target_hi + (((run_minutes - (time_until_now * 60.0)) / (step->steptime * 60.0)) * (step->target_hi - previous_target_hi)); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1497 | if (step->fridge_mode > previous_fridge_mode) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1498 | unit->prof_fridge_mode = (((run_minutes - (time_until_now * 60)) * 100) / (step->steptime * 60)); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1499 | } else if (step->fridge_mode < previous_fridge_mode) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1500 | unit->prof_fridge_mode = 100 - (((run_minutes - (time_until_now * 60)) * 100) / (step->steptime * 60)); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1501 | } else { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1502 | unit->prof_fridge_mode = step->fridge_mode; |
219
ae720212accc
Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
1503 | } |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1504 | if (debug) |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1505 | fprintf(stdout, "prof_fridge_mode=%d run_minutes=%d steptime=%d time_until_now=%d\n", |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1506 | unit->prof_fridge_mode, run_minutes, step->steptime, time_until_now); |
274
111b0e9663dc
Added logging if profile state is changed via the web interface. Log profile progress each half hour in syslog. Profile resttime steps 0 hours is allowed, meaning resttime or steptime must be set for a valid step. Updated the helptext on the web page.
Michiel Broek <mbroek@mbse.eu>
parents:
273
diff
changeset
|
1507 | } else { |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1508 | unit->prof_target_lo = step->target_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1509 | unit->prof_target_hi = step->target_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1510 | unit->prof_fridge_mode = step->fridge_mode; |
221
91a5e7281c35
Fixed end of profile steps, didn't go to the PROFILE_DONE state.
Michiel Broek <mbroek@mbse.eu>
parents:
219
diff
changeset
|
1511 | } |
194
9eaaba49450f
Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
1512 | break; |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1513 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1514 | time_until_now += step->steptime + step->resttime; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1515 | previous_target_lo = step->target_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1516 | previous_target_hi = step->target_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1517 | previous_fridge_mode = step->fridge_mode; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1518 | } |
221
91a5e7281c35
Fixed end of profile steps, didn't go to the PROFILE_DONE state.
Michiel Broek <mbroek@mbse.eu>
parents:
219
diff
changeset
|
1519 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1520 | if (valid_step == TRUE) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1521 | unit->prof_percent = (100 * run_minutes) / tot_minutes; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1522 | if (((minutes == 10) || (minutes == 40)) && (seconds == 1)) { |
571
6f8eda55ec2c
Version 0.9.1. Added fermentation profiles via MQTT. Added uuid field for loaded product. Removed some debug messages in the simulator. Removed dead code and debug messages from the lcd driver.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
1523 | syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, %d%% done, fridge/beer %d%% %.3f..%.3f degrees", |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1524 | unit->profile_name, run_hours / 24, run_hours % 24, run_minutes % 60, current_step, |
571
6f8eda55ec2c
Version 0.9.1. Added fermentation profiles via MQTT. Added uuid field for loaded product. Removed some debug messages in the simulator. Removed dead code and debug messages from the lcd driver.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
1525 | unit->prof_percent, unit->prof_fridge_mode, unit->prof_target_lo, unit->prof_target_hi); |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1526 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1527 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1528 | } else { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1529 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1530 | * No more steps to do |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1531 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1532 | unit->prof_state = PROFILE_DONE; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1533 | unit->prof_percent = 100; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1534 | syslog(LOG_NOTICE, "Profile `%s' is done", unit->profile_name); |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1535 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
575
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1536 | if (! unit->event_msg) |
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1537 | unit->event_msg = xstrcpy((char *)"Profile finished"); |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1538 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1539 | break; |
397
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
395
diff
changeset
|
1540 | |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1541 | case PROFILE_DONE: |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1542 | /* |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1543 | * Keep this state, set target temperature to the last step. |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1544 | */ |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1545 | previous_target_lo = unit->profile_inittemp_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1546 | previous_target_hi = unit->profile_inittemp_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1547 | previous_fridge_mode = unit->profile_fridge_mode; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1548 | for (step = unit->profile_steps; step; step = step->next) { |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1549 | if ((step->steptime + step->resttime) == 0) |
194
9eaaba49450f
Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
1550 | break; |
570
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1551 | previous_target_lo = step->target_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1552 | previous_target_hi = step->target_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1553 | previous_fridge_mode = step->fridge_mode; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1554 | } |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1555 | unit->prof_target_lo = previous_target_lo; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1556 | unit->prof_target_hi = previous_target_hi; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1557 | unit->prof_fridge_mode = previous_fridge_mode; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1558 | unit->prof_percent = 100; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1559 | break; |
1e0192b295b9
Removed useless version marks from the xml configuration. Added DCMD profile configuration to install and delete profiles in a fermenter. Removed the old profiles configuration. Removed useless xml configuration error check because none has been triggered in five years, Removed several obsolete upgrade functions. Updated the web liveview.
Michiel Broek <mbroek@mbse.eu>
parents:
569
diff
changeset
|
1560 | } /* switch */ |
402
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1561 | } else { |
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1562 | /* |
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1563 | * Set some sane values |
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1564 | */ |
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1565 | unit->prof_target_lo = 19.8; |
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1566 | unit->prof_target_hi = 20.2; |
6b9f0c3c7f63
Set sane default profile values when not using a profile.
Michiel Broek <mbroek@mbse.eu>
parents:
401
diff
changeset
|
1567 | unit->prof_fridge_mode = 0; |
189
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1568 | } |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1569 | |
cc2b04d4db99
Init logfile when a unit is turned on. Added comments for profile processing.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
1570 | /* |
184 | 1571 | * Manual switching |
1572 | */ | |
1573 | if (unit->mode == UNITMODE_NONE) { | |
1574 | device_out(unit->heater_address, unit->heater_state); | |
1575 | device_out(unit->cooler_address, unit->cooler_state); | |
1576 | device_out(unit->fan_address, unit->fan_state); | |
1577 | } | |
293 | 1578 | |
1579 | /* | |
1580 | * Usage counters | |
1581 | */ | |
1582 | if (unit->heater_address && unit->heater_state) | |
1583 | unit->heater_usage++; | |
1584 | if (unit->cooler_address && unit->cooler_state) | |
1585 | unit->cooler_usage++; | |
1586 | if (unit->fan_address && unit->fan_state) | |
1587 | unit->fan_usage++; | |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1588 | if (unit->light_address && unit->light_state) |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1589 | unit->light_usage++; |
293 | 1590 | |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1591 | /* |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1592 | * Interior lights |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1593 | */ |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1594 | if (unit->light_address) { |
582
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1595 | if (unit->light_timer) { |
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1596 | unit->light_timer--; |
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1597 | } |
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1598 | if (unit->door_state && !unit->light_timer && unit->light_state) { |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1599 | if (unit->light_wait > 0) { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1600 | unit->light_wait--; |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1601 | } else { |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1602 | unit->light_state = 0; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1603 | syslog(LOG_NOTICE, "Unit `%s' lights On => Off", unit->alias); |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1604 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1605 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1606 | } |
582
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1607 | if ((!unit->door_state || unit->light_timer) && !unit->light_state) { |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1608 | unit->light_wait = unit->light_delay; /* No delay to turn lights on */ |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1609 | unit->light_state = 1; |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1610 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1611 | syslog(LOG_NOTICE, "Unit `%s' lights Off => On", unit->alias); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1612 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1613 | device_out(unit->light_address, unit->light_state); |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1614 | } |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1615 | |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1616 | /* |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1617 | * Temperature control in this unit |
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1618 | */ |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1619 | if ((unit->mode == UNITMODE_FRIDGE) || (unit->mode == UNITMODE_BEER) || (unit->mode == UNITMODE_PROFILE)) { |
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1620 | |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1621 | /* |
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1622 | * Set both PID's to their input values. |
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1623 | */ |
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1624 | unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_NONE; |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1625 | if (unit->mode == UNITMODE_FRIDGE) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1626 | unit->PID_cool->SetP = unit->fridge_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1627 | unit->PID_heat->SetP = unit->fridge_set_lo; |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1628 | unit->PID_cool->Input = unit->PID_heat->Input = unit->air_temperature / 1000.0; |
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1629 | unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_BOO; |
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1630 | } else if (unit->mode == UNITMODE_BEER) { |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1631 | unit->PID_cool->SetP = unit->beer_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1632 | unit->PID_heat->SetP = unit->beer_set_lo; |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1633 | unit->PID_cool->Input = unit->PID_heat->Input = unit->beer_temperature / 1000.0; |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1634 | unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO; |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1635 | } else if (unit->mode == UNITMODE_PROFILE) { |
401
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1636 | double usetemp; |
397
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
395
diff
changeset
|
1637 | unit->PID_cool->SetP = unit->prof_target_hi; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
395
diff
changeset
|
1638 | unit->PID_heat->SetP = unit->prof_target_lo; |
401
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1639 | /* |
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1640 | * Get percentage to use from each thermometer. unit->prof_fridge_mode = 0..100 |
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1641 | */ |
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1642 | usetemp = ((unit->prof_fridge_mode * (unit->air_temperature / 1000.0)) + |
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1643 | ((100 - unit->prof_fridge_mode) * (unit->beer_temperature / 1000.0))) / 100.0; |
0226d0f37bb7
More fixes for profiles temperature window. Added the sliding beer/air target switch.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
1644 | unit->PID_cool->Input = unit->PID_heat->Input = usetemp; |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1645 | unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO; |
314 | 1646 | } |
316
73cd31dc6ce1
Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
315
diff
changeset
|
1647 | |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1648 | /* |
605
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
597
diff
changeset
|
1649 | * PID controller compute, simulate 100 mSec loops. |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1650 | */ |
605
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
597
diff
changeset
|
1651 | for (int i = 0; i < 10; i++) { |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
597
diff
changeset
|
1652 | UpdatePID(unit->PID_heat); |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
597
diff
changeset
|
1653 | UpdatePID(unit->PID_cool); |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
597
diff
changeset
|
1654 | } |
364
2f9bbbcd2407
Tuning PID code. Samll changes on the unit web page.
Michiel Broek <mbroek@mbse.eu>
parents:
363
diff
changeset
|
1655 | |
2f9bbbcd2407
Tuning PID code. Samll changes on the unit web page.
Michiel Broek <mbroek@mbse.eu>
parents:
363
diff
changeset
|
1656 | /* |
2f9bbbcd2407
Tuning PID code. Samll changes on the unit web page.
Michiel Broek <mbroek@mbse.eu>
parents:
363
diff
changeset
|
1657 | * Logging |
2f9bbbcd2407
Tuning PID code. Samll changes on the unit web page.
Michiel Broek <mbroek@mbse.eu>
parents:
363
diff
changeset
|
1658 | */ |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1659 | if (unit->heater_address) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1660 | /* |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1661 | * Prevent extreme heating |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1662 | */ |
524
bd1ea64ae484
Changed extreme PID control from 5to 8 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1663 | if ((unit->mode == UNITMODE_BEER) && ((unit->air_temperature / 1000.0) > (unit->PID_heat->Input + 8.0))) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1664 | unit->PID_heat->OutP = 0.0; |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1665 | } |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1666 | if (seconds == 60) { |
588
322a29000fd7
Added sensor precision initialize. Changed PID logging.
Michiel Broek <mbroek@mbse.eu>
parents:
583
diff
changeset
|
1667 | syslog(LOG_NOTICE, "Heat: sp=%.3f Input=%.3f iState=%.3f Err=%.3f Out=%.1f", |
363
468ec0d96cce
Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents:
362
diff
changeset
|
1668 | unit->PID_heat->SetP, unit->PID_heat->Input, unit->PID_heat->iState, unit->PID_heat->Err, unit->PID_heat->OutP); |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1669 | } |
494
092b45686a75
Fix Deadlok problem when there is only a heater or a cooler.
Michiel Broek <mbroek@mbse.eu>
parents:
492
diff
changeset
|
1670 | } else { |
092b45686a75
Fix Deadlok problem when there is only a heater or a cooler.
Michiel Broek <mbroek@mbse.eu>
parents:
492
diff
changeset
|
1671 | unit->PID_heat->OutP = 0.0; |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1672 | } |
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1673 | if (unit->cooler_address) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1674 | /* |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1675 | * Prevent extreme cooling |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1676 | */ |
524
bd1ea64ae484
Changed extreme PID control from 5to 8 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1677 | if ((unit->mode == UNITMODE_BEER) && ((unit->air_temperature / 1000.0) < (unit->PID_cool->Input - 8.0))) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1678 | unit->PID_cool->OutP = 0.0; |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1679 | } |
518
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1680 | /* |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1681 | * Prevent cooling if we use a chiller and the chiller temperature is not low enough. |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1682 | */ |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1683 | if (unit->chiller_address && (unit->chiller_state == 0)) { |
526
2f75f94d471b
Chiller alarm and cutoff now against the air temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
1684 | if ((unit->chiller_temperature / 1000.0) > ((unit->air_temperature / 1000.0) - 1)) { |
518
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1685 | unit->PID_cool->OutP = 0.0; |
525 | 1686 | unit->alarm_flag |= ALARM_FLAG_CHILLER; |
526
2f75f94d471b
Chiller alarm and cutoff now against the air temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
1687 | if (seconds == 60) { |
2f75f94d471b
Chiller alarm and cutoff now against the air temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
1688 | syslog(LOG_NOTICE, "Cool: Air=%.2f Chiller=%.2f alarm", unit->air_temperature / 1000.0, unit->chiller_temperature / 1000.0); |
2f75f94d471b
Chiller alarm and cutoff now against the air temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
1689 | } |
518
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1690 | } |
fd36bedab944
Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents:
516
diff
changeset
|
1691 | } |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1692 | if (seconds == 60) { |
588
322a29000fd7
Added sensor precision initialize. Changed PID logging.
Michiel Broek <mbroek@mbse.eu>
parents:
583
diff
changeset
|
1693 | syslog(LOG_NOTICE, "Cool: sp=%.3f Input=%.3f iState=%.3f Err=%.3f Out=%.1f", |
363
468ec0d96cce
Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents:
362
diff
changeset
|
1694 | unit->PID_cool->SetP, unit->PID_cool->Input, unit->PID_cool->iState, unit->PID_cool->Err, unit->PID_cool->OutP); |
317
18dd6eadba31
Simple temperature control in fridge mode.
Michiel Broek <mbroek@mbse.eu>
parents:
316
diff
changeset
|
1695 | } |
494
092b45686a75
Fix Deadlok problem when there is only a heater or a cooler.
Michiel Broek <mbroek@mbse.eu>
parents:
492
diff
changeset
|
1696 | } else { |
092b45686a75
Fix Deadlok problem when there is only a heater or a cooler.
Michiel Broek <mbroek@mbse.eu>
parents:
492
diff
changeset
|
1697 | unit->PID_cool->OutP = 0.0; |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1698 | } |
317
18dd6eadba31
Simple temperature control in fridge mode.
Michiel Broek <mbroek@mbse.eu>
parents:
316
diff
changeset
|
1699 | |
364
2f9bbbcd2407
Tuning PID code. Samll changes on the unit web page.
Michiel Broek <mbroek@mbse.eu>
parents:
363
diff
changeset
|
1700 | /* |
494
092b45686a75
Fix Deadlok problem when there is only a heater or a cooler.
Michiel Broek <mbroek@mbse.eu>
parents:
492
diff
changeset
|
1701 | * Deadlock, kill lowest value. |
364
2f9bbbcd2407
Tuning PID code. Samll changes on the unit web page.
Michiel Broek <mbroek@mbse.eu>
parents:
363
diff
changeset
|
1702 | */ |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1703 | if (unit->PID_cool->OutP && unit->PID_heat->OutP) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1704 | if (unit->PID_cool->OutP > unit->PID_heat->OutP) |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1705 | unit->PID_heat->OutP = 0.0; |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1706 | else |
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1707 | unit->PID_cool->OutP = 0.0; |
316
73cd31dc6ce1
Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
315
diff
changeset
|
1708 | } |
73cd31dc6ce1
Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
315
diff
changeset
|
1709 | |
318
aad7789a40f2
Better protection, fixed fridge mode.
Michiel Broek <mbroek@mbse.eu>
parents:
317
diff
changeset
|
1710 | if (unit->heater_address && ! unit->cooler_state) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1711 | if (unit->PID_heat->OutP >= 50) { |
313 | 1712 | if (unit->heater_wait < unit->heater_delay) { |
1713 | unit->heater_wait++; | |
273
b863e0147296
Fixed unit edit heater/cooler delay values. Heater and Cooler start/stop now use a different algorithm.
Michiel Broek <mbroek@mbse.eu>
parents:
270
diff
changeset
|
1714 | } else { |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1715 | int power = round(unit->PID_heat->OutP); |
319
8c454ec761a8
Actuators behind a PID now use power percentage instead of always 100%
Michiel Broek <mbroek@mbse.eu>
parents:
318
diff
changeset
|
1716 | if (unit->heater_state != power) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1717 | syslog(LOG_NOTICE, "Unit `%s' heater %d%% => %d%%", unit->alias, unit->heater_state, power); |
319
8c454ec761a8
Actuators behind a PID now use power percentage instead of always 100%
Michiel Broek <mbroek@mbse.eu>
parents:
318
diff
changeset
|
1718 | unit->heater_state = power; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1719 | // pub_domoticz_output(unit->heater_idx, unit->heater_state); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1720 | if (unit->heater_address) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1721 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1722 | } |
273
b863e0147296
Fixed unit edit heater/cooler delay values. Heater and Cooler start/stop now use a different algorithm.
Michiel Broek <mbroek@mbse.eu>
parents:
270
diff
changeset
|
1723 | } |
234
b69438db19ec
Added loggin when a device is switched on or off in beer/fridge/profile mode.
Michiel Broek <mbroek@mbse.eu>
parents:
233
diff
changeset
|
1724 | } |
313 | 1725 | } else { |
1726 | if (unit->heater_wait > 0) { | |
1727 | unit->heater_wait--; | |
1728 | } else { | |
1729 | if (unit->heater_state) { | |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1730 | syslog(LOG_NOTICE, "Unit `%s' heater On => Off", unit->alias); |
313 | 1731 | unit->heater_state = 0; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1732 | // pub_domoticz_output(unit->heater_idx, unit->heater_state); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1733 | if (unit->heater_address) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1734 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1735 | } |
313 | 1736 | } |
1737 | } | |
1738 | } | |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1739 | if (unit->door_state) { |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1740 | device_out(unit->heater_address, unit->heater_state); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1741 | } else { |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1742 | device_out(unit->heater_address, 0); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1743 | } |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1744 | } |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1745 | |
318
aad7789a40f2
Better protection, fixed fridge mode.
Michiel Broek <mbroek@mbse.eu>
parents:
317
diff
changeset
|
1746 | if (unit->cooler_address && ! unit->heater_state) { |
492
750f2468dec5
Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents:
491
diff
changeset
|
1747 | if (unit->PID_cool->OutP >= 50) { |
313 | 1748 | if (unit->cooler_wait < unit->cooler_delay) { |
1749 | unit->cooler_wait++; | |
273
b863e0147296
Fixed unit edit heater/cooler delay values. Heater and Cooler start/stop now use a different algorithm.
Michiel Broek <mbroek@mbse.eu>
parents:
270
diff
changeset
|
1750 | } else { |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1751 | int power = round(unit->PID_cool->OutP); |
319
8c454ec761a8
Actuators behind a PID now use power percentage instead of always 100%
Michiel Broek <mbroek@mbse.eu>
parents:
318
diff
changeset
|
1752 | if (unit->cooler_state != power) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1753 | syslog(LOG_NOTICE, "Unit `%s' cooler %d%% => %d%%", unit->alias, unit->cooler_state, power); |
319
8c454ec761a8
Actuators behind a PID now use power percentage instead of always 100%
Michiel Broek <mbroek@mbse.eu>
parents:
318
diff
changeset
|
1754 | unit->cooler_state = power; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1755 | // pub_domoticz_output(unit->cooler_idx, unit->cooler_state); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1756 | if (unit->cooler_address) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1757 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1758 | } |
270
df81d583c2c3
The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents:
268
diff
changeset
|
1759 | } |
234
b69438db19ec
Added loggin when a device is switched on or off in beer/fridge/profile mode.
Michiel Broek <mbroek@mbse.eu>
parents:
233
diff
changeset
|
1760 | } |
313 | 1761 | } else { |
1762 | if (unit->cooler_wait > 0) { | |
1763 | unit->cooler_wait--; | |
1764 | } else { | |
1765 | if (unit->cooler_state) { | |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1766 | syslog(LOG_NOTICE, "Unit `%s' cooler On => Off", unit->alias); |
313 | 1767 | unit->cooler_state = 0; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1768 | // pub_domoticz_output(unit->cooler_idx, unit->cooler_state); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1769 | if (unit->cooler_address) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1770 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1771 | } |
313 | 1772 | } |
1773 | } | |
1774 | } | |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1775 | if (unit->door_state) { |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1776 | device_out(unit->cooler_address, unit->cooler_state); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1777 | } else { |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1778 | device_out(unit->cooler_address, 0); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1779 | } |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1780 | } |
348 | 1781 | |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1782 | /* |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1783 | * If there is a fan, and the unit door is closed, and the unit should be doing |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1784 | * something, then turn on the global fan. |
531 | 1785 | * But if there is a chiller, do not turn it on if cooling. |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1786 | */ |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1787 | if (unit->fan_address) { |
531 | 1788 | if ((unit->door_state) && (unit->cooler_state == 0)) { |
349 | 1789 | if (unit->fan_wait < unit->fan_delay) { |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1790 | unit->fan_wait++; |
349 | 1791 | } else { |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1792 | if (! unit->fan_state) { |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1793 | syslog(LOG_NOTICE, "Unit `%s' Fan Off => On", unit->alias); |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1794 | unit->fan_state = 100; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1795 | // pub_domoticz_output(unit->fan_idx, unit->fan_state); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1796 | if (unit->fan_address) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1797 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1798 | } |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1799 | } |
349 | 1800 | } |
313 | 1801 | } else { |
349 | 1802 | if (unit->fan_wait > 0) { |
1803 | unit->fan_wait--; | |
1804 | } else { | |
1805 | if (unit->fan_state) { | |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1806 | syslog(LOG_NOTICE, "Unit `%s' Fan On => Off", unit->alias); |
349 | 1807 | unit->fan_state = 0; |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1808 | // pub_domoticz_output(unit->fan_idx, unit->fan_state); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1809 | if (unit->fan_address) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1810 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1811 | } |
349 | 1812 | } |
1813 | } | |
313 | 1814 | } |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1815 | device_out(unit->fan_address, unit->fan_state); |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1816 | } |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1817 | |
312
7b0f819a3805
Added more precision to the unit low and high black window margins. Switched to PID routine from Pid without a PhD. The PID compute routine is now in the one second loop. The switch delay times are now in seconds, 0..720.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
1818 | } else { |
362
c92651a54969
Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents:
361
diff
changeset
|
1819 | unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_NONE; |
349 | 1820 | } /* fridge beer or profile mode */ |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1821 | |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1822 | /* |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1823 | * Now everything is set and done, update the LCD display |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1824 | */ |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1825 | LCDair = unit->air_temperature / 1000.0; |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1826 | LCDbeer = unit->beer_temperature / 1000.0; |
490 | 1827 | LCDstatC = LCDstatH = ' '; |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1828 | if (unit->heater_address) { |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1829 | if (unit->heater_state) |
489 | 1830 | LCDstatH = '\6'; |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1831 | else |
489 | 1832 | LCDstatH = '\5'; |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1833 | } |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1834 | if (unit->cooler_address) { |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1835 | if (unit->cooler_state) |
489 | 1836 | LCDstatC = '\4'; |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1837 | else |
489 | 1838 | LCDstatC = '\3'; |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1839 | } |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1840 | LCDspH = LCDspL = 0.0; |
578
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1841 | if (unit->mode == UNITMODE_BEER) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1842 | LCDspH = unit->beer_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1843 | LCDspL = unit->beer_set_lo; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1844 | } else if (unit->mode == UNITMODE_FRIDGE) { |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1845 | LCDspH = unit->fridge_set_hi; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1846 | LCDspL = unit->fridge_set_lo; |
d694abd9d809
Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.
Michiel Broek <mbroek@mbse.eu>
parents:
576
diff
changeset
|
1847 | } else if (unit->mode == UNITMODE_PROFILE) { |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1848 | if (unit->prof_state != PROFILE_OFF) { |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1849 | LCDspL = unit->prof_target_lo; |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1850 | LCDspH = unit->prof_target_hi; |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1851 | } |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1852 | } |
608
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1853 | // if ((seconds == 60) && ((unit->mode == UNITMODE_FRIDGE) || (unit->mode == UNITMODE_BEER) || (unit->mode == UNITMODE_PROFILE))) { |
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1854 | // unit->mqtt_flag |= MQTT_FLAG_DATA; |
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1855 | // } |
a69b5d92fd72
Changed pub_domoticz mqtt publishing.
Michiel Broek <mbroek@mbse.eu>
parents:
606
diff
changeset
|
1856 | if (seconds == 60) { |
510
2da3d3340403
Version 0.6.0. The MQTT data messages are now allways the same length so that openhab will function with the message updates.
Michiel Broek <mbroek@mbse.eu>
parents:
507
diff
changeset
|
1857 | unit->mqtt_flag |= MQTT_FLAG_DATA; |
497
18ace27338e5
Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents:
496
diff
changeset
|
1858 | } |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1859 | #ifdef HAVE_WIRINGPI_H |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1860 | piLock(LOCK_LCD); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1861 | #endif |
496
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1862 | /* |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1863 | * Write 4 rows to the LCD to display the unit state |
5cf6f099c897
The FAN always runs if the unit is active. Bumped tp version 0.5.3
Michiel Broek <mbroek@mbse.eu>
parents:
494
diff
changeset
|
1864 | */ |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1865 | lcd_buf_write(row++, "Unit %d: %s ", LCDunit, UNITMODE[unit->mode]); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1866 | lcd_buf_write(row++, "%s ", unit->product_name); |
486
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1867 | lcd_buf_write(row++, "%c%5.1f\2 A%6.2f\1 ", LCDstatC, LCDspH, LCDair); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1868 | lcd_buf_write(row++, "%c%5.1f\2 B%6.2f\1 ", LCDstatH, LCDspL, LCDbeer); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1869 | #ifdef HAVE_WIRINGPI_H |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1870 | piUnlock(LOCK_LCD); |
5a237a99a793
Compacted LCD display for units, allways 4 instead of 4 to 6 lines. But it's a bit more cryptic. We could write a short manual.
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
1871 | #endif |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1872 | |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1873 | /* |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1874 | * Publish MQTT messages set in flag |
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1875 | */ |
506 | 1876 | if (unit->mqtt_flag) { |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1877 | if (unit->mqtt_flag & MQTT_FLAG_BIRTH) { |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1878 | publishDBirth(unit); |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1879 | unit->mqtt_flag &= ~MQTT_FLAG_BIRTH; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1880 | } else { |
605
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
597
diff
changeset
|
1881 | publishDData(unit); |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1882 | unit->mqtt_flag &= ~MQTT_FLAG_DATA; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1883 | } |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1884 | if (unit->mqtt_flag & MQTT_FLAG_DEATH) { |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1885 | publishDDeath(unit); |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1886 | unit->mqtt_flag &= ~MQTT_FLAG_DEATH; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1887 | } |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1888 | } |
525 | 1889 | |
1890 | /* | |
1891 | * Handle changed alarms | |
1892 | */ | |
1893 | if (unit->alarm_flag != unit->alarm_last) { | |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1894 | syslog(LOG_NOTICE, "Unit `%s' Alarm %d => %d", unit->alias, unit->alarm_last, unit->alarm_flag); |
525 | 1895 | unit->alarm_last = unit->alarm_flag; |
1896 | } | |
349 | 1897 | } /* for units */ |
182 | 1898 | |
204
9a14d6b2de7f
Fixed LCD display updates. Better key routines.
Michiel Broek <mbroek@mbse.eu>
parents:
200
diff
changeset
|
1899 | #ifdef HAVE_WIRINGPI_H |
244
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
1900 | piLock(LOCK_MENU); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1901 | #endif |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1902 | if (setupmenu == MENU_NONE) { |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1903 | #ifdef HAVE_WIRINGPI_H |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1904 | piLock(LOCK_LCD); |
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1905 | #endif |
205 | 1906 | lcd_buf_show(); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1907 | #ifdef HAVE_WIRINGPI_H |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1908 | piUnlock(LOCK_LCD); |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1909 | #endif |
241
4ba138737bf4
Added thread locks to all LCD access functions. This seems to have fixed the LCD corruption problems.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1910 | } |
418
0bfe08c7ba6e
Reenabled code round LCD driver.
Michiel Broek <mbroek@mbse.eu>
parents:
406
diff
changeset
|
1911 | #ifdef HAVE_WIRINGPI_H |
244
2f868eaefec2
Selecting units in setup does now work. Menu select variables are protected with thread locking.
Michiel Broek <mbroek@mbse.eu>
parents:
241
diff
changeset
|
1912 | piUnlock(LOCK_MENU); |
204
9a14d6b2de7f
Fixed LCD display updates. Better key routines.
Michiel Broek <mbroek@mbse.eu>
parents:
200
diff
changeset
|
1913 | #endif |
205 | 1914 | |
182 | 1915 | if (seconds == 60) { |
1916 | seconds = 0; | |
1917 | ||
1918 | /* | |
591
95cf33f8021f
Removed writing local unit data logs
Michiel Broek <mbroek@mbse.eu>
parents:
588
diff
changeset
|
1919 | * Publish data every minute if unit is active. |
182 | 1920 | */ |
1921 | for (unit = Config.units; unit; unit = unit->next) { | |
1922 | if (unit->mode != UNITMODE_OFF) { | |
575
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1923 | publishDLog(unit); |
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1924 | if (unit->event_msg) |
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1925 | free(unit->event_msg); |
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1926 | unit->event_msg = NULL; |
104 | 1927 | } |
1928 | } | |
167
56b008563db8
Fixed GET AIR|BEER commands. Save configuration every 30 minutes.
Michiel Broek <mbroek@mbse.eu>
parents:
165
diff
changeset
|
1929 | |
56b008563db8
Fixed GET AIR|BEER commands. Save configuration every 30 minutes.
Michiel Broek <mbroek@mbse.eu>
parents:
165
diff
changeset
|
1930 | minutes++; |
293 | 1931 | if (minutes == 60) { |
167
56b008563db8
Fixed GET AIR|BEER commands. Save configuration every 30 minutes.
Michiel Broek <mbroek@mbse.eu>
parents:
165
diff
changeset
|
1932 | minutes = 0; |
293 | 1933 | /* |
1934 | * Log usage counters every hour | |
1935 | */ | |
1936 | for (unit = Config.units; unit; unit = unit->next) { | |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1937 | syslog(LOG_NOTICE, "Unit `%s' usage heater=%d cooler=%d fan=%d", unit->alias, unit->heater_usage, unit->cooler_usage, unit->fan_usage); |
293 | 1938 | } |
1939 | } | |
167
56b008563db8
Fixed GET AIR|BEER commands. Save configuration every 30 minutes.
Michiel Broek <mbroek@mbse.eu>
parents:
165
diff
changeset
|
1940 | |
227
1cb55ea51f76
Remove debug log information about regular configuration saving.
Michiel Broek <mbroek@mbse.eu>
parents:
223
diff
changeset
|
1941 | /* |
1cb55ea51f76
Remove debug log information about regular configuration saving.
Michiel Broek <mbroek@mbse.eu>
parents:
223
diff
changeset
|
1942 | * Save the configuration each half hour. |
1cb55ea51f76
Remove debug log information about regular configuration saving.
Michiel Broek <mbroek@mbse.eu>
parents:
223
diff
changeset
|
1943 | */ |
1cb55ea51f76
Remove debug log information about regular configuration saving.
Michiel Broek <mbroek@mbse.eu>
parents:
223
diff
changeset
|
1944 | if ((minutes == 15) || (minutes == 45)) |
167
56b008563db8
Fixed GET AIR|BEER commands. Save configuration every 30 minutes.
Michiel Broek <mbroek@mbse.eu>
parents:
165
diff
changeset
|
1945 | wrconfig(); |
64
2431965e8a8c
Write loglines only every 60 seconds
Michiel Broek <mbroek@mbse.eu>
parents:
63
diff
changeset
|
1946 | } |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1947 | } |
200
a215ddaabbe2
Added first panel key routines. The LCD display steps manual only and has a 2 minutes backlight timeout.
Michiel Broek <mbroek@mbse.eu>
parents:
199
diff
changeset
|
1948 | |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
1949 | slcdDummy(slcdHandle); |
205 | 1950 | key = keycheck(); |
246
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
1951 | if (key != KEY_NONE) |
6df404da3537
Setting fridge and beer temperature from the panel implemented
Michiel Broek <mbroek@mbse.eu>
parents:
245
diff
changeset
|
1952 | panel_key_events(key); |
200
a215ddaabbe2
Added first panel key routines. The LCD display steps manual only and has a 2 minutes backlight timeout.
Michiel Broek <mbroek@mbse.eu>
parents:
199
diff
changeset
|
1953 | |
28
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
1954 | usleep(100000); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1955 | |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1956 | } while (run); |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1957 | |
182 | 1958 | /* |
1959 | * Stop units processing in a neat way | |
1960 | */ | |
1961 | for (unit = Config.units; unit; unit = unit->next) { | |
1962 | /* | |
1963 | * Turn everything off | |
1964 | */ | |
582
ba340e00aab2
Version 0.9.5, interior lights are now only controlled by the open door or a 5 minutes timer. The timer is started via an MQTT command. The BMS web application sends this command just before a webcam page is requested.
Chiel Broek <mbse@mbse.eu>
parents:
578
diff
changeset
|
1965 | unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->light_state = unit->light_timer = 0; |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1966 | unit->heater_wait = unit->cooler_wait = unit->fan_wait = unit->light_wait = 0; |
182 | 1967 | device_out(unit->heater_address, unit->heater_state); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1968 | pub_domoticz_output(unit->heater_idx, unit->heater_state); |
182 | 1969 | device_out(unit->cooler_address, unit->cooler_state); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1970 | pub_domoticz_output(unit->cooler_idx, unit->cooler_state); |
182 | 1971 | device_out(unit->fan_address, unit->fan_state); |
515
7ab5cf2afc0c
Only send domoticz changed values
Michiel Broek <mbroek@mbse.eu>
parents:
510
diff
changeset
|
1972 | pub_domoticz_output(unit->fan_idx, unit->fan_state); |
350
7283561977b1
Added door and PSU sensors. Added interior light logic and switching.
Michiel Broek <mbroek@mbse.eu>
parents:
349
diff
changeset
|
1973 | device_out(unit->light_address, unit->light_state); |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1974 | if (unit->mode != UNITMODE_OFF) { |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1975 | /* |
575
86496d2bc4bb
Version 0.9.2 DLOG messages every minute unless a unit is off. More event messages added. The target temperatur is now taken from the PIDs.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
1976 | * If unit is active, publish we are dying. |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1977 | */ |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1978 | unit->mqtt_flag = MQTT_FLAG_DATA; |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1979 | publishDData(unit); |
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1980 | publishDDeath(unit); |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1981 | unit->event_msg = xstrcpy((char *)"Shutdown"); |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1982 | publishDLog(unit); |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1983 | free(unit->event_msg); |
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1984 | unit->event_msg = NULL; |
533
49580ca85ab7
Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.
Michiel Broek <mbroek@mbse.eu>
parents:
532
diff
changeset
|
1985 | } |
554
ab9f22ab57b5
Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents:
550
diff
changeset
|
1986 | syslog(LOG_NOTICE, "Unit `%s' stopped in mode %s", unit->alias, UNITMODE[unit->mode]); |
182 | 1987 | } |
1988 | ||
505 | 1989 | usleep(100000); |
499
602d9968960f
Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5
Michiel Broek <mbroek@mbse.eu>
parents:
498
diff
changeset
|
1990 | mqtt_disconnect(); |
497
18ace27338e5
Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents:
496
diff
changeset
|
1991 | |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
1992 | syslog(LOG_NOTICE, "Out of loop"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1993 | |
28
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
1994 | /* |
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
1995 | * Give threads time to cleanup |
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
1996 | */ |
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
1997 | usleep(1500000); |
32ed1ea4d0b6
Coolers working with a hardcode reference
Michiel Broek <mbroek@mbse.eu>
parents:
27
diff
changeset
|
1998 | |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1999 | stopLCD(); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
2000 | if (sock != -1) { |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
2001 | if (shutdown(sock, SHUT_RDWR)) { |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
2002 | syslog(LOG_NOTICE, "Can't shutdown socket: %s", strerror(errno)); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
2003 | } |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
2004 | sock = -1; |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
418
diff
changeset
|
2005 | } |
561
fcfc3dbe85fa
Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2006 | lcd_buf_reset(); |
86
3d7a241329e2
Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
2007 | wrconfig(); |
41
f534ace74eea
Code preparation for client/server communication
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
2008 | ulockprog((char *)"thermferm"); |
550
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
2009 | |
04c942cded91
Versie 0.8.3. Enkele debug console berichten verwijderd. De MQTT NCMD reboot en rebirth commando's geimplementeerd.
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
2010 | syslog(LOG_NOTICE, "Server process ended"); |
26
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2011 | return 0; |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2012 | } |
9322c619c525
Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2013 |