-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects.cpp
More file actions
46 lines (32 loc) · 852 Bytes
/
objects.cpp
File metadata and controls
46 lines (32 loc) · 852 Bytes
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
//
//
//
#include "objects.h"
int64_t pumpStart = 0;
Config myConfig;
FileData data(&SD, "/configuration.dat", 'B', &myConfig, sizeof(myConfig));
char tstr[32] = "";
bool res = false;
FastBot bot(BOT_TOKEN);
RTC_DS3231 rtc;
HumiditySensors hs;
bool dropped = false;
bool rainNow = false;
bool nightNow = false;
byte oldMode[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
int64_t getUnixTime() {
if (bot.timeSynced()) {
return bot.getUnix() + 3600 * 3;
} else {
DateTime now = rtc.now();
return now.unixtime();
}
}
void (*p_sendTelegramFunction)(String text); // указатель на p_function
void attachSendFunction(void (*function)(String text)) { // передача указателя на функцию
p_sendTelegramFunction = *function;
}
void sendTelegramStatus(String text)
{
(*p_sendTelegramFunction)(text);
}