Version 0.2.5. Added interval to the NBIRTH json data. Added global define 60 seconds.

Fri, 10 Apr 2020 11:51:40 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 10 Apr 2020 11:51:40 +0200
changeset 54
3b1834482899
parent 53
20c14b06f255
child 55
43362bb8f3c0

Version 0.2.5. Added interval to the NBIRTH json data. Added global define 60 seconds.

CMakeLists.txt file | annotate | diff | comparison | revisions
main/config.h file | annotate | diff | comparison | revisions
main/task_mqtt.c file | annotate | diff | comparison | revisions
main/task_user.c file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Mon Apr 06 20:01:51 2020 +0200
+++ b/CMakeLists.txt	Fri Apr 10 11:51:40 2020 +0200
@@ -2,7 +2,7 @@
 # in this exact order for cmake to work correctly
 cmake_minimum_required(VERSION 3.5)
 
-set(PROJECT_VER "0.2.4")
+set(PROJECT_VER "0.2.5")
 set(PROJECT_NAME "co2meter")
 
 include($ENV{IDF_PATH}/tools/cmake/project.cmake)
--- a/main/config.h	Mon Apr 06 20:01:51 2020 +0200
+++ b/main/config.h	Fri Apr 10 11:51:40 2020 +0200
@@ -59,6 +59,9 @@
 #include "updates.h"
 
 
+#define MAINLOOP_TIMER	60	///< Mainloop interval
+
+
 /**
  * @brief Mainloop 1 timed actions.
  */
--- a/main/task_mqtt.c	Mon Apr 06 20:01:51 2020 +0200
+++ b/main/task_mqtt.c	Fri Apr 10 11:51:40 2020 +0200
@@ -201,8 +201,10 @@
     payload = payload_header();
     payload = xstrcat(payload, (char *)"{\"uuid\":\"");
     payload = xstrcat(payload, config.uuid);
-    payload = xstrcat(payload, (char *)"\",");
-    payload = xstrcat(payload, (char *)"\"properties\":{\"hardwaremake\":\"Unknown\",\"hardwaremodel\":\"");
+    payload = xstrcat(payload, (char *)"\",\"interval\":");
+    sprintf(buf, "%d", MAINLOOP_TIMER);
+    payload = xstrcat(payload, buf);
+    payload = xstrcat(payload, (char *)",\"properties\":{\"hardwaremake\":\"Unknown\",\"hardwaremodel\":\"");
     sprintf(buf, "ESP32 %d cores rev %d, WiFi bgn", chip_info.cores, chip_info.revision);
     payload = xstrcat(payload, buf);
     payload = xstrcat(payload, (char *)"\",\"os\":\"esp-idf\",\"os_version\":\"");
--- a/main/task_user.c	Mon Apr 06 20:01:51 2020 +0200
+++ b/main/task_user.c	Fri Apr 10 11:51:40 2020 +0200
@@ -66,7 +66,7 @@
 void TimerCallback(void *arg)
 {
     SecsCount++;
-    if ((SecsCount % 60) == 0) {
+    if ((SecsCount % MAINLOOP_TIMER) == 0) {
 	if (Main_Loop1 == ML1_DONE && update_running == 0)
 	    Main_Loop1 = ML1_INIT;
     }

mercurial