Open Garden  0.10.1-21
ogstruct.h
Go to the documentation of this file.
1 /* This file is part of OpenGarden
2  * Copyright (C) 2011-2014 Enrico Rossi
3  *
4  * OpenGarden is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * OpenGarden is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
22 #ifndef OGSTR_H
23 #define OGSTR_H
24 
25 #include "date.h"
26 #include "debug.h"
27 
39 #define CHECK_VALID_CODE 0x09
40 
53 #define SERNO_SIZE 0x10
54 
56 #define MAX_PROGS 20
57 
58 #define PROG_MAX_FACTOR 3.0
59 
60 #define PROG_TOMORROW_FACTOR 2.0
61 
63 #define Q_NEW 0
64 
65 #define Q_OFF 1
66 
67 #define Q_RUN 2
68 
69 #define Q_DELAYED 3
70 
72 #define FULLSUN 0
73 
74 #define HALFSUN 1
75 
76 #define SHADOW 2
77 
79 #define MONOSTABLE 1
80 
81 #define BISTABLE 2
82 
84 #define FL_SUNSITE 0
85 
86 #define FL_VTYPE 2
87 
88 #define FL_LOG 3
89 
90 #define FL_LEVEL 4
91 
92 #define FL_LED 5
93 
103 #define FL_ALRM 6
104 
106 #define ALRM_THRESHOLD 3
107 
109 #define FALSE 0
110 
111 #define TRUE 1
112 
113 #define LOW 0
114 
115 #define HIGH 1
116 
117 #define OFF 0
118 
119 #define ON 1
120 
127 struct program_t {
139  uint8_t dow;
140 
142  uint8_t oline;
143 
145  uint8_t hstart;
147  uint8_t mstart;
149  uint16_t dmin;
150 };
151 
153 struct queue_t {
159  uint8_t oline;
161  uint8_t status;
162 };
163 
170 struct programs_t {
177  uint8_t check;
179  uint8_t number;
181  uint8_t qc;
183  struct program_t p[MAX_PROGS];
185  struct queue_t q[MAX_PROGS];
187  float tnow;
189  float t_mean;
191  float dfactor;
193  uint8_t position;
195  uint8_t valve;
197  uint8_t flags;
206  uint8_t ioline;
215  uint8_t ioline_alarm;
216 };
217 
218 
219 void flag_set(struct programs_t *progs, const uint8_t bit,
220  const uint8_t val);
221 uint8_t flag_get(struct programs_t *progs, const uint8_t bit);
222 
223 #endif
uint8_t valve
Definition: ogstruct.h:195
time_t stop
Definition: ogstruct.h:157
uint8_t flag_get(struct programs_t *progs, const uint8_t bit)
Definition: ogstruct.c:65
uint8_t dow
Days of the week.
Definition: ogstruct.h:139
uint8_t position
Definition: ogstruct.h:193
Functions to activare and display (rs232) debug.
#define MAX_PROGS
maximum number of programs
Definition: ogstruct.h:56
uint8_t ioline
I/O line in use (bitmapped). In bistable valve type, we store the line in use so it can be possible t...
Definition: ogstruct.h:206
uint8_t number
Definition: ogstruct.h:179
time_t start
Definition: ogstruct.h:155
uint8_t check
Definition: ogstruct.h:177
uint8_t hstart
start time (hours)
Definition: ogstruct.h:145
uint8_t oline
Definition: ogstruct.h:159
uint8_t mstart
Definition: ogstruct.h:147
uint8_t flags
Definition: ogstruct.h:197
uint8_t qc
Definition: ogstruct.h:181
the queue buffer
Definition: ogstruct.h:153
uint16_t dmin
Definition: ogstruct.h:149
uint8_t status
Definition: ogstruct.h:161
Definition: ogstruct.h:127
float dfactor
Definition: ogstruct.h:191
Definition: ogstruct.h:170
unsigned long time_t
Definition: time.h:62
uint8_t oline
Output line from 0 to 7.
Definition: ogstruct.h:142
time high level functions.
void flag_set(struct programs_t *progs, const uint8_t bit, const uint8_t val)
Definition: ogstruct.c:44
float tnow
Definition: ogstruct.h:187
float t_mean
Definition: ogstruct.h:189
uint8_t ioline_alarm
I/O lines alarm register (bitmapped).
Definition: ogstruct.h:215