thermferm/thermferm.h

Tue, 01 Jul 2014 21:41:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 01 Jul 2014 21:41:31 +0200
changeset 84
ef4c0032b51f
parent 83
f99e9d6deff5
child 86
3d7a241329e2
permissions
-rw-r--r--

Can list the 1-wire bus

51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
1 #ifndef _MBSELIB_H
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
2 #define _MBSELIB_H
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
9322c619c525 Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 #define TRUE 1
9322c619c525 Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 #define FALSE 0
9322c619c525 Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
8 #include "../config.h"
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
9
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
10 #include <stdlib.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
11 #include <stdio.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
12 #include <stdint.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
13 #include <stdarg.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
14 #include <string.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
15 #include <ctype.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
16 #include <sys/types.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
17 #include <sys/stat.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
18 #include <sys/time.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
19 #include <time.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
20 #include <fcntl.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
21 #include <syslog.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
22 #include <unistd.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
23 #include <errno.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
24 #include <signal.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
25 #include <getopt.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
26 #include <limits.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
27 #include <sys/socket.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
28 #include <arpa/inet.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
29 #include <netdb.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
30 #include <poll.h>
84
ef4c0032b51f Can list the 1-wire bus
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
31 #include <dirent.h>
79
eb9dd60aa791 Added uuid library
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
32 #include <uuid/uuid.h>
74
879bd09e2b96 Reinstalled threads
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
33 #ifndef HAVE_WIRINGPI_H
879bd09e2b96 Reinstalled threads
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
34 #include <pthread.h>
879bd09e2b96 Reinstalled threads
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
35 #endif
73
4a28de5b9b47 Changed include files
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
36 #include <libxml/xmlmemory.h>
4a28de5b9b47 Changed include files
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
37 #include <libxml/parser.h>
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 74
diff changeset
38 #include <libxml/encoding.h>
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 74
diff changeset
39 #include <libxml/xmlwriter.h>
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
40
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
41 #ifdef HAVE_WIRINGPI_H
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
42 /* wiringPi */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
43 #include <wiringPi.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
44 #include <pcf8574.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
45 #include <lcd.h>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
46
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
47 #endif
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
48
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
49 #define TRUE 1
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
50 #define FALSE 0
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
52 #define MBSE_SS(x) (x)?(x):"(null)"
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
53
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
54 /* rdconfig.c */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
55 typedef struct _key_list {
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
56 char *key;
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
57 int (*prc)(char **);
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
58 char **dest;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
59 } key_list;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
60
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
61 /*
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
62 * Fermenter units. These units are connected via the 1-wire bus.
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
63 * Each unit can have:
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
64 * a DS18B20 sensor to measure the air temperature inside the unit.
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
65 * a DS18B20 sensor to measure the beer temperature.
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
66 * a DS2413 to turn the cooler and heater on or off.
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
67 * a DS2413 to switch the fan and sense the door.
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
68 */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
69 typedef struct _units_list {
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
70 struct _units_list *next;
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
71 char *uuid; /* uid code */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
72 char *name; /* friendly name */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
73 float volume; /* Volume of this unit */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
74 char *air_address; /* DS18B20 address */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
75 float air_temp; /* Air temperature */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
76 char *beer_address; /* DS18B20 address */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
77 float beer_temp; /* Beer temperature */
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
78 char *io1_address; /* DS2413 address */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
79 char *io2_address; /* DS2413 address */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 74
diff changeset
80 int heater_available; /* Heater available */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
81 int heater_state; /* Heater status */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 74
diff changeset
82 int cooler_available; /* Cooler available */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
83 int cooler_state; /* Cooler status */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 74
diff changeset
84 int fan_available; /* Fan available */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
85 int fan_state; /* Fan status */
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
86 int door_state; /* Door and light status */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
87 int mode; /* Unit mode */
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
88 float beer_set; /* Beer temperature setting */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
89 float fridge_set; /* Fridge temperature setting */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
90 float temp_set_min; /* Minimum temperature */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
91 float temp_set_max; /* Maximum temperature */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
92 float idle_rangeL; /* Idle temperature low */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
93 float idle_rangeH; /* Idle range high */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
94 char *profile; /* Active profile */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
95 time_t prof_started; /* Profile start time */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
96 } units_list;
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
97
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
98 #define UNITMODE_OFF 0 /* Unit turned off */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
99 #define UNITMODE_NONE 1 /* Unit on but does nothing */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
100 #define UNITMODE_FRIDGE 2 /* Unit acts as a fridge */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
101 #define UNITMODE_BEER 3 /* Unit acts as beer cooler */
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
102 #define UNITMODE_PROFILE 4 /* Unit runs in profile mode */
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
103
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
104 #define UNITIO_HEATER 0x01 /* Heater bit */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
105 #define UNITIO_COOLER 0x02 /* Cooler bit */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
106 #define UNITIO_FAN 0x04 /* Fan bit */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
107 #define UNITIO_LIGHT 0x08 /* Light bit */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
108 #define UNITIO_DOOR 0x10 /* Door status */
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
109
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
110 typedef struct _w1_therm {
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
111 struct _w1_therm *next;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
112 char *master; /* Master for this device */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
113 int bus; /* Reserved for ds2482-800 */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
114 char *name; /* Name of this device */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
115 char *alias; /* Friendly name */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
116 int present; /* 1=present, 0=absent */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
117 int lastval; /* Last valid value */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
118 int update; /* Value updated */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
119 } w1_therm;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
120
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
121 typedef struct _sys_config {
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
122 char *name; /* Configuration name */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
123 int my_port; /* my client/server port */
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
124 unsigned char tempFormat; /* Temperature format, C or F */
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
125 w1_therm *w1therms; /* 1-wire temp sensors */
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
126 #ifdef HAVE_WIRINGPI_H
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
127 int lcd_cols; /* LCD display columns */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
128 int lcd_rows; /* LCD display rows */
78
c49ab5179bf3 Added lcd i2c address to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
129 int lcd_address; /* LCD display i2c address */
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
130 #endif
71
a09c5cdc4022 Removed rc-switch
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
131 units_list *units; /* Fermenter units */
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
132 /* ControlSettings: */
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
133 unsigned char cs_mode; /* mode */
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
134 float cs_beerSet; /* beer temperature */
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
135 float cs_fridgeSet; /* fridge temperature */
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
136 float cs_heatEstimator;
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
137 float cs_coolEstimator;
54
c06190a58f22 More configuration changes. Writing settings implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
138 /* ControlConstants */
c06190a58f22 More configuration changes. Writing settings implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
139 float cc_tempSetMin;
c06190a58f22 More configuration changes. Writing settings implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
140 float cc_tempSetMax;
c06190a58f22 More configuration changes. Writing settings implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
141 float cc_idleRangeH;
c06190a58f22 More configuration changes. Writing settings implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
142 float cc_idleRangeL;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
143 } sys_config;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
144
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
145
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
146 void killconfig(void);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
147 int rdconfig(char *);
83
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 79
diff changeset
148 int wrconfig(char *);
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
149
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
150
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
151 /* lock.c */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
152 int lockprog(char *);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
153 void ulockprog(char *);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
154
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
155
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
156 /* xutil.c */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
157 char *xmalloc(size_t);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
158 char *xstrcpy(char *);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
159 char *xstrcat(char *, char *);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
160
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
161
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
162 #ifdef HAVE_WIRINGPI_H
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
163
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
164 /* lcd-pcf8574.c */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
165 // Defines for the pcf8574 Pi LCD interface board
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
166 #define AF_BASE 100
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
167
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
168 #define AF_RS (AF_BASE + 0)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
169 #define AF_RW (AF_BASE + 1)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
170 #define AF_E (AF_BASE + 2)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
171 #define AF_BACKLIGHT (AF_BASE + 3)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
172 #define AF_DB4 (AF_BASE + 4)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
173 #define AF_DB5 (AF_BASE + 5)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
174 #define AF_DB6 (AF_BASE + 6)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
175 #define AF_DB7 (AF_BASE + 7)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
176
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
177 void setBacklight (int);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
178 int initLCD (int, int);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
179 void mb_lcdPutchar(const int, unsigned char);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
180 void mb_lcdPuts(const int, const char *);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
181 void mb_lcdClear(const int);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
182
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
183 #endif
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
184
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
185 /* logger.c */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
186 void logger(char *, char *, char *);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
187
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
188 #ifdef HAVE_WIRINGPI_H
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
189 PI_THREAD (my_sensors_loop);
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
190 #else
74
879bd09e2b96 Reinstalled threads
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
191 void *my_sensors_loop(void *);
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
192 #endif
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
193
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
194 /* server.c */
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
195 void defaultControlSettings(void);
54
c06190a58f22 More configuration changes. Writing settings implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
196 void defaultControlConstants(void);
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
197 #ifdef HAVE_WIRINGPI_H
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
198 PI_THREAD (my_server_loop);
66
805f1d285acd Compiles with 1-wire bus on PC hardware
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
199 #else
74
879bd09e2b96 Reinstalled threads
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
200 void *my_server_loop(void *);
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
201 #endif
26
9322c619c525 Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202
46
000399c64d3f More client/server communications
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
203
26
9322c619c525 Added coolers program, first draft
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 #endif
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents: 48
diff changeset
205

mercurial