forked from rszimm/sprinklers_pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.h
79 lines (71 loc) · 1.51 KB
/
core.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// core.h
// This file constitutes the core functions that run the scheduling for the Sprinkler system.
// Author: Richard Zimmerman
// Copyright (c) 2013 Richard Zimmerman
//
#ifndef _CORE_h
#define _CORE_h
#ifdef ARDUINO
#include "nntp.h"
#endif
#include <inttypes.h>
#include "port.h"
#ifdef LOGGING
#include "Logging.h"
extern Logging log;
#endif
#ifndef VERSION
#define VERSION "0.0.0"
#endif
void mainLoop();
void ClearEvents();
void LoadSchedTimeEvents(int8_t sched_num, bool bQuickSchedule = false);
void ReloadEvents(bool bAllEvents = false);
bool isZoneOn(int iNum);
void TurnOnZone(int iValve);
void TurnOffZones();
void io_setup();
class runStateClass
{
public:
class DurationAdjustments {
public:
DurationAdjustments() : seasonal(-1), wunderground(-1) {}
DurationAdjustments(int16_t val) : seasonal(val), wunderground(val) {}
int16_t seasonal;
int16_t wunderground;
};
public:
runStateClass();
void SetSchedule(bool val, int8_t iSchedNum = -1, const runStateClass::DurationAdjustments * adj = 0);
void ContinueSchedule(int8_t zone, short endTime);
void SetManual(bool val, int8_t zone = -1);
bool isSchedule()
{
return m_bSchedule;
}
bool isManual()
{
return m_bManual;
}
int8_t getZone()
{
return m_zone;
}
short getEndTime()
{
return m_endTime;
}
private:
void LogSchedule();
bool m_bSchedule;
bool m_bManual;
int8_t m_iSchedule;
int8_t m_zone;
short m_endTime;
time_t m_eventTime;
DurationAdjustments m_adj;
};
extern runStateClass runState;
extern nntp nntpTimeServer;
#endif