From 0ec527f79f12dccb76278aa17b1d4043c2ccc3ca Mon Sep 17 00:00:00 2001
From: Jochen Vothknecht <jochen3120@gmail.com>
Date: Sun, 10 Apr 2022 23:19:22 +0200
Subject: [PATCH] Adding include-guard

---
 CLC-qthing/IRSender.hpp                | 2 ++
 CLC-qthing/SiliconTorch/CyanBusCRC.hpp | 2 ++
 CLC-qthing/SiliconTorch/Metrics.cpp    | 2 ++
 CLC-qthing/SiliconTorch/Metrics.hpp    | 2 ++
 CLC-qthing/SimpleUART.hpp              | 1 +
 5 files changed, 9 insertions(+)

diff --git a/CLC-qthing/IRSender.hpp b/CLC-qthing/IRSender.hpp
index b97ed7f..82ebf9a 100644
--- a/CLC-qthing/IRSender.hpp
+++ b/CLC-qthing/IRSender.hpp
@@ -1,3 +1,5 @@
+#pragma once
+
 #include <cinttypes>
 
 #include <string>
diff --git a/CLC-qthing/SiliconTorch/CyanBusCRC.hpp b/CLC-qthing/SiliconTorch/CyanBusCRC.hpp
index 2b47a41..2cf93e5 100644
--- a/CLC-qthing/SiliconTorch/CyanBusCRC.hpp
+++ b/CLC-qthing/SiliconTorch/CyanBusCRC.hpp
@@ -1,3 +1,5 @@
+#pragma once
+
 // C++ system level
 #include <cinttypes>
 
diff --git a/CLC-qthing/SiliconTorch/Metrics.cpp b/CLC-qthing/SiliconTorch/Metrics.cpp
index c2170fa..0dce70f 100644
--- a/CLC-qthing/SiliconTorch/Metrics.cpp
+++ b/CLC-qthing/SiliconTorch/Metrics.cpp
@@ -103,6 +103,8 @@ namespace SiliconTorch {
       j["uptime"]   = uptime_ms() / 1000UL;
       j["lifetime"] = (lifeTime + (uptime_ms() - lifeTimeSaved)) / 1000UL;
 
+      if (birth > 0) j["birth"] = birth;
+
       publish_message(genDeviceTopic("metrics"), j.dump().c_str());
       lastPublished = uptime_ms();
     }
diff --git a/CLC-qthing/SiliconTorch/Metrics.hpp b/CLC-qthing/SiliconTorch/Metrics.hpp
index 116b8ef..7b00f41 100644
--- a/CLC-qthing/SiliconTorch/Metrics.hpp
+++ b/CLC-qthing/SiliconTorch/Metrics.hpp
@@ -86,6 +86,8 @@ namespace SiliconTorch {
         uint32_t bootCnt           = 0;
         uint32_t bootCntSaveUptime = 60;           // seconds
 
+        uint64_t birth             = 0;            // unix timestamp of first device activation
+
         void tickTask();
         void saveBootCntTask();
 
diff --git a/CLC-qthing/SimpleUART.hpp b/CLC-qthing/SimpleUART.hpp
index 01e5ce5..a16e17d 100644
--- a/CLC-qthing/SimpleUART.hpp
+++ b/CLC-qthing/SimpleUART.hpp
@@ -1,3 +1,4 @@
+#pragma once
 
 #include <cinttypes>
 
-- 
GitLab