Skip to content

Commit ee698e8

Browse files
authored
extend diagnostics with client version (#14)
1 parent ae90ca9 commit ee698e8

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

examples/control/control.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ char wifiPassword[] = "__PASSWORD__";
1515
#define LED_BUILTIN 2
1616
#endif
1717

18-
// Decrease this value for testing purposes.
19-
const int dataSendingInterval = 300000; // milliseconds
20-
const int diagSendingInterval = 60000; // milliseconds
18+
const int dataSendingInterval = 60000; // milliseconds
19+
const int diagSendingInterval = 90000; // milliseconds
2120
const int pollInterval = 1000; // milliseconds
2221

2322
unsigned long dataTimer = 0;
@@ -27,7 +26,7 @@ const int eventCount = 3;
2726
String events[eventCount] = {
2827
"IDLE",
2928
"RING",
30-
"BOOM!"
29+
"BOOM"
3130
};
3231

3332
Cloud4RPi c4r(deviceToken);
@@ -61,6 +60,12 @@ void setup() {
6160
c4r.declareDiagVariable("RSSI"); // WiFi signal strength
6261
c4r.declareDiagVariable("Uptime");
6362

63+
String v = c4r.getVersion();
64+
c4r.declareDiagVariable("Client Version");
65+
c4r.setDiagVariable("Client Version", v);
66+
Serial.print("Cloud4RPi version: ");
67+
Serial.println(v);
68+
6469
c4r.loop();
6570
delay(1000);
6671
}

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build": {
2424
"flags": "-DMQTT_MAX_PACKET_SIZE=1024 -DMQTT_MAX_TRANSFER_SIZE=128"
2525
},
26-
"version": "1.0.2",
26+
"version": "1.0.3",
2727
"examples": "examples/*/*.ino",
2828
"frameworks": "arduino",
2929
"platforms": [

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=cloud4rpi-esp-arduino
2-
version=1.0.2
2+
version=1.0.3
33
author=Cloud4RPi <[email protected]>
44
maintainer=Cloud4RPi <[email protected]>
55
sentence=Connect a board to the Cloud4RPi control panel using MQTT - https://cloud4rpi.io.

src/Cloud4RPi.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,16 @@ void Cloud4RPi::onCommand(const String& command, JsonVariant value) {
299299
this->publishCore(doc, "/data/cr");
300300
}
301301

302+
String Cloud4RPi::getVersion() {
303+
return VERSION;
304+
}
305+
302306
void Cloud4RPi::printLogo() {
303-
CLOUD4RPI_PRINTLN();
304-
CLOUD4RPI_PRINTLN("_________ .__ .___ _________________________.__ ");
305-
CLOUD4RPI_PRINTLN("\\_ ___ \\| | ____ __ __ __| _// | \\______ \\______ \\__|");
306-
CLOUD4RPI_PRINTLN("/ \\ \\/| | / _ \\| | \\/ __ |/ | || _/| ___/ |");
307-
CLOUD4RPI_PRINTLN("\\ \\___| |_( <_> ) | / /_/ / ^ / | \\| | | |");
308-
CLOUD4RPI_PRINTLN(" \\______ /____/\\____/|____/\\____ \\____ ||____|_ /|____| |__|");
309-
CLOUD4RPI_PRINTLN(" \\/ \\/ |__| \\/");
307+
CLOUD4RPI_PRINTER.println();
308+
CLOUD4RPI_PRINTER.println("_________ .__ .___ _________________________.__ ");
309+
CLOUD4RPI_PRINTER.println("\\_ ___ \\| | ____ __ __ __| _// | \\______ \\______ \\__|");
310+
CLOUD4RPI_PRINTER.println("/ \\ \\/| | / _ \\| | \\/ __ |/ | || _/| ___/ |");
311+
CLOUD4RPI_PRINTER.println("\\ \\___| |_( <_> ) | / /_/ / ^ / | \\| | | |");
312+
CLOUD4RPI_PRINTER.println(" \\______ /____/\\____/|____/\\____ \\____ ||____|_ /|____| |__|");
313+
CLOUD4RPI_PRINTER.println(" \\/ \\/ |__| \\/");
310314
}

src/Cloud4RPi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
namespace {
2727
const String& MQTT_SERVER = "mq.cloud4rpi.io";
2828
const int MQTT_PORT = 1883;
29+
const String& VERSION = "1.0.3";
2930

3031
const String& VAR_TYPE_BOOL = "bool";
3132
const String& VAR_TYPE_NUMERIC = "numeric";
@@ -85,6 +86,7 @@ friend class C4RMqttCallback;
8586
bool publishDiag();
8687

8788
void printLogo();
89+
String getVersion();
8890
private:
8991
String deviceToken;
9092
String server;

0 commit comments

Comments
 (0)