-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path990_tickerCallback.ino
107 lines (104 loc) · 3.66 KB
/
990_tickerCallback.ino
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
void tickerSenCallback() // Timer Objekt Sensoren
{
cbpiEventSensors(sensorsStatus);
}
void tickerActCallback() // Timer Objekt Aktoren
{
cbpiEventActors(actorsStatus);
}
void tickerIndCallback() // Timer Objekt Induktion
{
cbpiEventInduction(inductionStatus);
}
void tickerDispCallback() // Timer Objekt Display
{
cbpiEventSystem(EM_DISPUP);
}
void tickerInfluxDBCallback() // Timer Objekt Influx Datenbank
{
cbpiEventSystem(EM_DB);
}
void tickerMQTTCallback() // Ticker helper function calling Event MQTT Error
{
if (TickerMQTT.counter() == 1)
{
switch (pubsubClient.state())
{
case -4: // MQTT_CONNECTION_TIMEOUT - the server didn't respond within the keepalive time
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECTION_TIMEOUT\n", pubsubClient.state());
break;
case -3: // MQTT_CONNECTION_LOST - the network connection was broken
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECTION_LOST\n", pubsubClient.state());
break;
case -2: // MQTT_CONNECT_FAILED - the network connection failed
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECT_FAILED\n", pubsubClient.state());
break;
case -1: // MQTT_DISCONNECTED - the client is disconnected cleanly
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_DISCONNECTED\n", pubsubClient.state());
break;
case 0: // MQTT_CONNECTED - the client is connected
pubsubClient.loop();
break;
case 1: // MQTT_CONNECT_BAD_PROTOCOL - the server doesn't support the requested version of MQTT
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECT_BAD_PROTOCOL\n", pubsubClient.state());
break;
case 2: // MQTT_CONNECT_BAD_CLIENT_ID - the server rejected the client identifier
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECT_BAD_CLIENT_ID\n", pubsubClient.state());
break;
case 3: // MQTT_CONNECT_UNAVAILABLE - the server was unable to accept the connection
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECT_UNAVAILABLE\n", pubsubClient.state());
break;
case 4: // MQTT_CONNECT_BAD_CREDENTIALS - the username/password were rejected
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECT_BAD_CREDENTIALS\n", pubsubClient.state());
break;
case 5: // MQTT_CONNECT_UNAUTHORIZED - the client was not authorized to connect
DEBUG_MSG("EM MQTT: Fehler rc=%d MQTT_CONNECT_UNAUTHORIZED\n", pubsubClient.state());
break;
default:
break;
}
}
cbpiEventSystem(EM_MQTTER);
}
void tickerWLANCallback() // Ticker helper function calling Event WLAN Error
{
DEBUG_MSG("%s", "tickerWLAN: callback\n");
if (TickerWLAN.counter() == 1)
{
switch (WiFi.status())
{
case 0: // WL_IDLE_STATUS
DEBUG_MSG("WiFi status: Fehler rc: %d WL_IDLE_STATUS");
break;
case 1: // WL_NO_SSID_AVAIL
DEBUG_MSG("WiFi status: Fehler rc: %d WL_NO_SSID_AVAIL");
break;
case 2: // WL_SCAN_COMPLETED
DEBUG_MSG("WiFi status: Fehler rc: %d WL_SCAN_COMPLETED");
break;
case 3: // WL_CONNECTED
DEBUG_MSG("WiFi status: Fehler rc: %d WL_CONNECTED");
break;
case 4: // WL_CONNECT_FAILED
DEBUG_MSG("WiFi status: Fehler rc: %d WL_CONNECT_FAILED");
break;
case 5: // WL_CONNECTION_LOST
DEBUG_MSG("WiFi status: Fehler rc: %d WL_CONNECTION_LOST");
break;
case 6: // WL_DISCONNECTED
DEBUG_MSG("WiFi status: Fehler rc: %d WL_DISCONNECTED");
break;
case 255: // WL_NO_SHIELD
DEBUG_MSG("WiFi status: Fehler rc: %d WL_NO_SHIELD");
break;
default:
break;
}
}
cbpiEventSystem(EM_WLANER);
}
void tickerNTPCallback() // Ticker helper function calling Event WLAN Error
{
timeClient.update();
Serial.printf("*** SYSINFO: %s\n", timeClient.getFormattedTime().c_str());
}