RSeries astromech firmware
HeartBeat.h
Go to the documentation of this file.
1 #ifndef HeartBeat_h
2 #define HeartBeat_h
3 
4 #include "ReelTwo.h"
5 
6 #ifdef USE_SMQ
7 static void sendHeartBeat(const char* id, uint32_t ms)
8 {
9  static uint32_t sLastTime;
10  if (sLastTime + ms < millis())
11  {
12  if (SMQ::sendTopic("PULSE"))
13  {
14  SMQ::send_string(F("id"), id);
15  SMQ::send_end();
16  }
17  sLastTime = millis();
18  }
19 }
20 #else
21 #define sendHeartBeat(id,ms)
22 #endif
23 
24 #endif
ReelTwo.h
SMQ::send_end
static void send_end()
Definition: ReelTwoSMQ.h:463
SMQ::sendTopic
static bool sendTopic(const smq_id id)
Definition: ReelTwoSMQ.h:155
sendHeartBeat
#define sendHeartBeat(id, ms)
Definition: HeartBeat.h:21
SMQ::send_string
static void send_string(const char *str)
Definition: ReelTwoSMQ.h:106