changes
This commit is contained in:
parent
a8d1708512
commit
0c111dd818
@ -24,6 +24,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/arduino/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/arduino/variant}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/Libraries/SPI}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/Libraries/NilRTOS}""/>
|
||||
</option>
|
||||
<inputType id="it.baeyens.arduino.compiler.cpp.sketch.input.244106961" name="CPP source files" superClass="it.baeyens.arduino.compiler.cpp.sketch.input"/>
|
||||
</tool>
|
||||
@ -32,6 +33,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/arduino/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/arduino/variant}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/Libraries/SPI}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/ThermometerPro/Libraries/NilRTOS}""/>
|
||||
</option>
|
||||
<inputType id="it.baeyens.arduino.compiler.c.sketch.input.1503729033" name="C Source Files" superClass="it.baeyens.arduino.compiler.c.sketch.input"/>
|
||||
</tool>
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
|
||||
#include <WString.h>
|
||||
#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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user