diff --git a/.cproject b/.cproject
index 983e6d1..a85de02 100644
--- a/.cproject
+++ b/.cproject
@@ -24,6 +24,7 @@
+
@@ -32,6 +33,7 @@
+
diff --git a/ThermometerPro.cpp b/ThermometerPro.cpp
index 84cf590..9982e5f 100644
--- a/ThermometerPro.cpp
+++ b/ThermometerPro.cpp
@@ -1,6 +1,5 @@
#include "ThermometerPro.h"
-
#include "AD7190.h"
#include "cmd.h"
#include "test.h"
@@ -12,14 +11,11 @@ static TestCmd testCmd;
static Uptime uptime;
-
void setup() {
cmdServer.begin();
testCmd.registerYourself(&cmdServer);
uptime.begin(&cmdServer);
-
-
Serial.begin(9600);
delay(5000);
@@ -62,11 +58,11 @@ float pt1000(float r) {
void loop() {
+
cmdServer.exec();
uptime.exec();
-
Serial.print("Tick\n");
AD7190_ChannelSelect(AD7190_CH_AIN4P_AINCOM);
@@ -125,4 +121,5 @@ void loop() {
delay(1000);
+
}
diff --git a/uptime.cpp b/uptime.cpp
index a02d82c..78361f5 100644
--- a/uptime.cpp
+++ b/uptime.cpp
@@ -1,14 +1,18 @@
+
#include
#include "uptime.h"
+
+
UptimeCmd::UptimeCmd(Uptime *uptime) : m_uptime(uptime) {
}
String UptimeCmd::exec(String params) {
- return m_uptime->getDays() + String(" ") +
+ String res = m_uptime->getDays() + String(" ") +
m_uptime->getHours() + String(":") + m_uptime->getMinutes() + String(":") + m_uptime->getSeconds();
+ return res;
}
Uptime::Uptime() : m_uptimeCmd(this), m_seconds(0), m_minutes(0), m_hours(0), m_days(0) {
@@ -24,6 +28,7 @@ void Uptime::begin(CmdServer *cmdServer) {
void Uptime::exec() {
static unsigned long lastMillis = 0;
+
unsigned long currentMillis = millis();
if (currentMillis >= (lastMillis + 1000)) {
m_seconds += ((currentMillis - lastMillis) / 1000);
@@ -42,4 +47,5 @@ void Uptime::exec() {
lastMillis = currentMillis;
}
+
}