Skip to content

Commit

Permalink
Add firmware version to tags in data payload
Browse files Browse the repository at this point in the history
This will help keep track of what version of the firmware each devise is
running.
  • Loading branch information
forkata committed Oct 23, 2021
1 parent 55561b6 commit 8d42782
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data to the Particle cloud in the following format
"tags" : {
"id": "t1",
"location": "fermentor 1"
"firmware": "0.0.1"
},
"values": {
"temperature_1": 18.750000,
Expand Down
5 changes: 4 additions & 1 deletion temperature.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// This #include statement was automatically added by the Particle IDE.
#include <OneWire.h>

#include "version.h"

#include <sstream>
#include <cstring>

Expand Down Expand Up @@ -91,9 +93,10 @@ void loop(){
Particle.variable("devices", &numberOfDevices, INT);

String data = String::format(
"{ \"tags\" : {\"id\": \"%s\", \"location\": \"%s\"}, \"values\": %s }",
"{ \"tags\" : {\"id\": \"%s\", \"location\": \"%s\", \"firmware\": \"%s\"}, \"values\": %s }",
"t2",
"fermentor 1",
FIRMWARE_VERSION,
values.c_str()
);

Expand Down
1 change: 1 addition & 0 deletions version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define FIRMWARE_VERSION "0.0.1"

0 comments on commit 8d42782

Please sign in to comment.