device.h
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __DEVICE_H_
#define __DEVICE_H_
/* #include <stdio.h> */
/* #include <string.h> */
/* #include <stdlib.h> */
/* #include <time.h> */
/* #include <stddef.h> */
#include <string.h>
#include "pcf.h"
#include "mqtt.h"
// Number = pcfPIN - one action per pin / no diode crap anymore
#define dst_valve_rotate 1
#define dst_valve_watersource 2
#define diaphragm 3
#define peristaltic 4
#define peristaltic_reverse 5
#define dive 6
#define src_valve_pump 7
#define off 0
struct sequence {
struct action *action;
int device;
int start_value;
int end_value;
double start;
double end;
struct sequence *next;
};
struct sequence *sequence_head = NULL;
struct sequence *sequence_tail = NULL;
const int startpumpheight = 50;
const int stoppumpheight = 5;
int waterlevel = 0;
unsigned int pumpstate = 0;
unsigned long timeStored = 0;
void loop_device();
void insertSequence(int device, int start_value, int end_value, double duration, struct action *action);
void next_sequence_step();
void monitor_sequence_duration();
void set_relay(struct sequence *step);
int fill_start(struct action *ptr);
int rotate_start(struct action *ptr);
int rotate_start(struct button *ptr);
int fertilize_start(struct action *ptr);
#endif